guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#30709] [PATCH 4/4] gnu: Add debootstrap.


From: Marius Bakke
Subject: [bug#30709] [PATCH 4/4] gnu: Add debootstrap.
Date: Sat, 10 Mar 2018 10:48:32 +0100
User-agent: Notmuch/0.26 (https://notmuchmail.org) Emacs/25.3.1 (x86_64-pc-linux-gnu)

Efraim Flashner <address@hidden> writes:

> * gnu/packages/debian.scm (debootstrap): New variable.

Thanks for packaging this!  I've worked on this too, and actually
packaged 'dpkg' separately.  Yet somehow I did not need to package the
keyrings (I guess it is necessary to work offline?).

Some comments inline, and my dpkg and debootstrap patches attached for
comparison.  Feel free to take inspiration from both.

> +(define-public debootstrap
> +  (package
> +    (name "debootstrap")
> +    (version "1.0.93")
> +    (source
> +      (origin
> +        (method git-fetch)
> +        (uri (git-reference
> +               (url "https://anonscm.debian.org/cgit/d-i/debootstrap.git";)
> +               (commit version)))
> +        (file-name (git-file-name name version))

Why use the git downloader here?

> +        (sha256
> +         (base32
> +          "1jxq91602a152c56l2f8kzkiszp26cziqddcs4v695bcif72kfz6"))))
> +    (build-system gnu-build-system)
> +    (arguments
> +     `(#:phases
> +       (modify-phases %standard-phases
> +         (delete 'configure)
> +         (delete 'build)
> +         (add-after 'unpack 'patch-source
> +           (lambda* (#:key inputs outputs #:allow-other-keys)
> +             (let ((out    (assoc-ref outputs "out"))
> +                   (debian (assoc-ref %build-inputs "debian"))
> +                   (ubuntu (assoc-ref %build-inputs "ubuntu")))

Use (assoc-ref inputs "debian") instead of accessing the global
%build-inputs.  I'd also call them "debian-keyring" and "ubuntu-keyring"
to make it clearer what's going on down below.

> +               (substitute* "scripts/sid"
> +                 (("/usr") debian))
> +               (substitute* "scripts/gutsy"
> +                 (("/usr") ubuntu))
> +               (substitute* "debootstrap"
> +                 (("=/usr") (string-append "=" out))
> +                 (("@VERSION@") ,version))

If you don't delete the build phase, @VERSION@ should be automatically
expanded to the correct value, methinks.

> +               (substitute* "functions"
> +                 (("wget ") (string-append (which "wget") " ")))
> +               #t)))
> +         (replace 'install
> +           (lambda* (#:key outputs #:allow-other-keys)
> +             (let ((out (assoc-ref outputs "out")))
> +               (copy-recursively "scripts"
> +                                 (string-append out 
> "/share/debootstrap/scripts"))
> +               (install-file "functions" (string-append out 
> "/share/debootstrap"))
> +               (install-file "debootstrap" (string-append out "/sbin"))
> +               (install-file "debootstrap.8" (string-append out 
> "/share/man/man8"))
> +               #t))))

Similarly, passing DESTDIR in #:make-flags should make this unnecessary.

> +       #:tests? #f)) ; no tests
> +    (inputs
> +     `(("debian" ,debian-archive-keyring)
> +       ("ubuntu" ,ubuntu-keyring)
> +       ("wget" ,wget)))
> +    ;; The following are required for debootstrap to work correctly
> +    (propagated-inputs
> +     `(("binutils" ,binutils)
> +       ("gnupg" ,gnupg)
> +       ("perl" ,perl)))
> +    (home-page "https://anonscm.debian.org/cgit/d-i/debootstrap.git";)
> +    (synopsis "Bootstrap a basic Debian system")
> +    (description "Debootstrap is used to create a Debian base system from
> +scratch, without requiring the availability of @code{dpkg} or @code{apt}.
> +It does this by downloading .deb files from a mirror site, and carefully
> +unpacking them into a directory which can eventually be chrooted into.")
> +    (license license:gpl2)))

I have not tried this debootstrap, but when testing the attached patch,
I found that debootstrap would fail on the first attempt, but simply
trying again made everything work.  Did you experience this?  Note that
I did not propagate binutils, perhaps that was the problem.

Or the confusion between Guix dpkg and the debootstrapped dpkg.

Behold...

Attachment: 0001-gnu-Add-dpkg.patch
Description: Text Data

Attachment: 0002-gnu-Add-debootstrap.patch
Description: Text Data

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]