1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2018 Efraim Flashner <efraim@flashner.co.il>
3 ;;; Copyright © 2018, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
5 ;;; This file is part of GNU Guix.
7 ;;; GNU Guix is free software; you can redistribute it and/or modify it
8 ;;; under the terms of the GNU General Public License as published by
9 ;;; the Free Software Foundation; either version 3 of the License, or (at
10 ;;; your option) any later version.
12 ;;; GNU Guix is distributed in the hope that it will be useful, but
13 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;;; GNU General Public License for more details.
17 ;;; You should have received a copy of the GNU General Public License
18 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20 (define-module (gnu packages debian)
21 #:use-module ((guix licenses) #:prefix license:)
22 #:use-module (guix download)
23 #:use-module (guix git-download)
24 #:use-module (guix packages)
25 #:use-module (guix build-system gnu)
26 #:use-module (guix build-system trivial)
27 #:use-module (gnu packages base)
28 #:use-module (gnu packages compression)
29 #:use-module (gnu packages gnupg)
30 #:use-module (gnu packages wget)
31 #:use-module (gnu packages perl))
33 (define-public debian-archive-keyring
35 (name "debian-archive-keyring")
41 (url "https://salsa.debian.org/release-team/debian-archive-keyring.git")
43 (file-name (git-file-name name version))
46 "0bphwji3ywk1zi5bq8bhqk7l51fwjy1idwsw7zfqnxca8m5wvw1g"))))
47 (build-system gnu-build-system)
49 '(#:test-target "verify-results"
50 #:parallel-build? #f ; has race conditions
52 (modify-phases %standard-phases
53 (delete 'configure) ; no configure script
55 (lambda* (#:key outputs #:allow-other-keys)
56 (let* ((out (assoc-ref outputs "out"))
57 (apt (string-append out "/etc/apt/trusted.gpg.d/"))
58 (key (string-append out "/share/keyrings/")))
59 (install-file "keyrings/debian-archive-keyring.gpg" key)
60 (install-file "keyrings/debian-archive-removed-keys.gpg" key)
61 (for-each (lambda (file)
62 (install-file file apt))
63 (find-files "trusted.gpg" "\\.gpg$")))
67 ("jetring" ,jetring)))
68 (home-page "https://packages.qa.debian.org/d/debian-archive-keyring.html")
69 (synopsis "GnuPG archive keys of the Debian archive")
71 "The Debian project digitally signs its Release files. This package
72 contains the archive keys used for that.")
73 (license (list license:public-domain ; the keys
74 license:gpl2+)))) ; see debian/copyright
76 (define-public ubuntu-keyring
78 (name "ubuntu-keyring")
79 (version "2018.09.18.1")
83 (uri (string-append "https://launchpad.net/ubuntu/+archive/primary/"
84 "+files/" name "_" version ".tar.gz"))
87 "0csx2n62rj9rxjv4y8qhby7l9rbybfwrb0406pc2cjr7f2yk91af"))))
88 (build-system trivial-build-system)
90 `(#:modules ((guix build utils))
92 (use-modules (guix build utils))
93 (let* ((out (assoc-ref %outputs "out"))
94 (apt (string-append out "/etc/apt/trusted.gpg.d/"))
95 (key (string-append out "/share/keyrings/")))
96 (setenv "PATH" (string-append
97 (assoc-ref %build-inputs "gzip") "/bin:"
98 (assoc-ref %build-inputs "tar") "/bin"))
99 (invoke "tar" "xvf" (assoc-ref %build-inputs "source"))
100 (for-each (lambda (file)
101 (install-file file apt))
102 (find-files "." "ubuntu-[^am].*\\.gpg$"))
103 (for-each (lambda (file)
104 (install-file file key))
105 (find-files "." "ubuntu-[am].*\\.gpg$")))
110 (home-page "https://launchpad.net/ubuntu/+source/ubuntu-keyring")
111 (synopsis "GnuPG keys of the Ubuntu archive")
113 "The Ubuntu project digitally signs its Release files. This package
114 contains the archive keys used for that.")
115 (license (list license:public-domain ; the keys
116 license:gpl2+)))) ; see debian/copyright
118 (define-public debootstrap
126 (url "https://salsa.debian.org/installer-team/debootstrap.git")
128 (file-name (git-file-name name version))
130 (base32 "0fr5ir8arzisx71jybbk4xz85waz50lf2y052nfimzh6vv9dx54c"))))
131 (build-system gnu-build-system)
134 (modify-phases %standard-phases
136 (add-after 'unpack 'patch-source
137 (lambda* (#:key inputs outputs #:allow-other-keys)
138 (let ((out (assoc-ref outputs "out"))
139 (tzdata (assoc-ref inputs "tzdata"))
140 (debian (assoc-ref inputs "debian-keyring"))
141 (ubuntu (assoc-ref inputs "ubuntu-keyring")))
142 (substitute* "Makefile"
144 (("-o root -g root") "")
145 (("chown root.*") "\n"))
146 (substitute* '("scripts/etch"
151 "scripts/woody.buildd")
153 (substitute* "scripts/gutsy"
155 (substitute* "debootstrap"
156 (("=/usr") (string-append "=" out)))
157 ;; Ensure PATH works both in guix and within the debian chroot
158 ;; workaround for: https://bugs.debian.org/929889
159 (substitute* "functions"
160 (("PATH=/sbin:/usr/sbin:/bin:/usr/bin")
161 "PATH=$PATH:/sbin:/usr/sbin:/bin:/usr/bin"))
162 (substitute* (find-files "scripts" ".")
163 (("/usr/share/zoneinfo") (string-append tzdata "/share/zoneinfo")))
165 (add-after 'install 'install-man-file
166 (lambda* (#:key outputs #:allow-other-keys)
167 (let ((out (assoc-ref outputs "out")))
168 (install-file "debootstrap.8"
169 (string-append out "/share/man/man8"))
171 (add-after 'install 'wrap-executable
172 (lambda* (#:key outputs #:allow-other-keys)
173 (let ((debootstrap (string-append (assoc-ref outputs "out")
174 "/sbin/debootstrap"))
175 (path (getenv "PATH")))
176 (wrap-program debootstrap
177 `("PATH" ":" prefix (,path)))
179 #:make-flags (list (string-append "DESTDIR=" (assoc-ref %outputs "out")))
180 #:tests? #f)) ; no tests
182 `(("debian-keyring" ,debian-archive-keyring)
183 ("ubuntu-keyring" ,ubuntu-keyring)
187 (home-page "https://tracker.debian.org/pkg/debootstrap")
188 (synopsis "Bootstrap a basic Debian system")
189 (description "Debootstrap is used to create a Debian base system from
190 scratch, without requiring the availability of @code{dpkg} or @code{apt}.
191 It does this by downloading .deb files from a mirror site, and carefully
192 unpacking them into a directory which can eventually be chrooted into.")
193 (license license:gpl2)))
196 (define-public apt-mirror
197 (let ((commit "e664486a5d8947c2579e16dd793d762ea3de4202")
201 (version (git-version "0.5.4" revision commit))
205 (url "https://github.com/apt-mirror/apt-mirror/")
207 (file-name (git-file-name name version))
210 "0qj6b7gldwcqyfs2kp6amya3ja7s4vrljs08y4zadryfzxf35nqq"))))
211 (build-system gnu-build-system)
215 ;; sysconfdir is not PREFIXed in the makefile but DESTDIR is
216 ;; honored correctly; we therefore use DESTDIR for our
217 ;; needs. A more correct fix would involve patching.
218 #:make-flags (list (string-append "DESTDIR=" (assoc-ref %outputs "out"))
220 #:phases (modify-phases %standard-phases (delete 'configure))))
224 (home-page "http://apt-mirror.github.io/")
225 (synopsis "Script for mirroring a Debian repository")
227 "apt-mirror is a small tool that provides the ability to
228 selectively mirror Debian and Ubuntu GNU/Linux distributions or any
229 other apt sources typically provided by open source developers.")
230 (license license:gpl2))))