gnu: Add dpkg.
[jackhill/guix/guix.git] / gnu / packages / debian.scm
CommitLineData
1779aaa0 1;;; GNU Guix --- Functional package management for GNU
d82766e6 2;;; Copyright © 2018, 2020 Efraim Flashner <efraim@flashner.co.il>
6729488f 3;;; Copyright © 2018, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
dd3bd0be 4;;; Copyright © 2020 Marius Bakke <marius@gnu.org>
8e1cd1a2 5;;;
1779aaa0
TGR
6;;; This file is part of GNU Guix.
7;;;
8e1cd1a2
EF
8;;; GNU Guix is free software; you can redistribute it and/or modify it
9;;; under the terms of the GNU General Public License as published by
10;;; the Free Software Foundation; either version 3 of the License, or (at
11;;; your option) any later version.
12;;;
13;;; GNU Guix is distributed in the hope that it will be useful, but
14;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16;;; GNU General Public License for more details.
17;;;
18;;; You should have received a copy of the GNU General Public License
19;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20
21(define-module (gnu packages debian)
22 #:use-module ((guix licenses) #:prefix license:)
23 #:use-module (guix download)
5743ba49 24 #:use-module (guix git-download)
8e1cd1a2
EF
25 #:use-module (guix packages)
26 #:use-module (guix build-system gnu)
b3230c28 27 #:use-module (guix build-system trivial)
dd3bd0be 28 #:use-module (gnu packages autotools)
b3230c28
EF
29 #:use-module (gnu packages base)
30 #:use-module (gnu packages compression)
d82766e6 31 #:use-module (gnu packages crypto)
dd3bd0be 32 #:use-module (gnu packages gettext)
298a2c1e 33 #:use-module (gnu packages gnupg)
d82766e6
EF
34 #:use-module (gnu packages ncurses)
35 #:use-module (gnu packages perl)
36 #:use-module (gnu packages pkg-config)
37 #:use-module (gnu packages wget))
8e1cd1a2
EF
38
39(define-public debian-archive-keyring
40 (package
41 (name "debian-archive-keyring")
76513c94 42 (version "2019.1")
8e1cd1a2
EF
43 (source
44 (origin
f909e217
EF
45 (method git-fetch)
46 (uri (git-reference
47 (url "https://salsa.debian.org/release-team/debian-archive-keyring.git")
48 (commit version)))
49 (file-name (git-file-name name version))
8e1cd1a2
EF
50 (sha256
51 (base32
76513c94 52 "0bphwji3ywk1zi5bq8bhqk7l51fwjy1idwsw7zfqnxca8m5wvw1g"))))
8e1cd1a2
EF
53 (build-system gnu-build-system)
54 (arguments
55 '(#:test-target "verify-results"
56 #:parallel-build? #f ; has race conditions
57 #:phases
58 (modify-phases %standard-phases
59 (delete 'configure) ; no configure script
60 (replace 'install
61 (lambda* (#:key outputs #:allow-other-keys)
62 (let* ((out (assoc-ref outputs "out"))
63 (apt (string-append out "/etc/apt/trusted.gpg.d/"))
64 (key (string-append out "/share/keyrings/")))
65 (install-file "keyrings/debian-archive-keyring.gpg" key)
66 (install-file "keyrings/debian-archive-removed-keys.gpg" key)
67 (for-each (lambda (file)
68 (install-file file apt))
69 (find-files "trusted.gpg" "\\.gpg$")))
70 #t)))))
71 (native-inputs
72 `(("gnupg" ,gnupg)
73 ("jetring" ,jetring)))
74 (home-page "https://packages.qa.debian.org/d/debian-archive-keyring.html")
75 (synopsis "GnuPG archive keys of the Debian archive")
76 (description
77 "The Debian project digitally signs its Release files. This package
78contains the archive keys used for that.")
79 (license (list license:public-domain ; the keys
80 license:gpl2+)))) ; see debian/copyright
b3230c28
EF
81
82(define-public ubuntu-keyring
83 (package
84 (name "ubuntu-keyring")
4aa64e3a 85 (version "2018.09.18.1")
b3230c28
EF
86 (source
87 (origin
88 (method url-fetch)
89 (uri (string-append "https://launchpad.net/ubuntu/+archive/primary/"
90 "+files/" name "_" version ".tar.gz"))
91 (sha256
92 (base32
4aa64e3a 93 "0csx2n62rj9rxjv4y8qhby7l9rbybfwrb0406pc2cjr7f2yk91af"))))
b3230c28
EF
94 (build-system trivial-build-system)
95 (arguments
96 `(#:modules ((guix build utils))
97 #:builder (begin
98 (use-modules (guix build utils))
99 (let* ((out (assoc-ref %outputs "out"))
100 (apt (string-append out "/etc/apt/trusted.gpg.d/"))
101 (key (string-append out "/share/keyrings/")))
102 (setenv "PATH" (string-append
103 (assoc-ref %build-inputs "gzip") "/bin:"
104 (assoc-ref %build-inputs "tar") "/bin"))
105 (invoke "tar" "xvf" (assoc-ref %build-inputs "source"))
106 (for-each (lambda (file)
107 (install-file file apt))
108 (find-files "." "ubuntu-[^am].*\\.gpg$"))
109 (for-each (lambda (file)
110 (install-file file key))
111 (find-files "." "ubuntu-[am].*\\.gpg$")))
112 #t)))
113 (native-inputs
114 `(("tar" ,tar)
115 ("gzip" ,gzip)))
116 (home-page "https://launchpad.net/ubuntu/+source/ubuntu-keyring")
117 (synopsis "GnuPG keys of the Ubuntu archive")
118 (description
119 "The Ubuntu project digitally signs its Release files. This package
120contains the archive keys used for that.")
121 (license (list license:public-domain ; the keys
122 license:gpl2+)))) ; see debian/copyright
298a2c1e
EF
123
124(define-public debootstrap
125 (package
126 (name "debootstrap")
6729488f 127 (version "1.0.123")
298a2c1e
EF
128 (source
129 (origin
5743ba49
EF
130 (method git-fetch)
131 (uri (git-reference
132 (url "https://salsa.debian.org/installer-team/debootstrap.git")
133 (commit version)))
134 (file-name (git-file-name name version))
298a2c1e 135 (sha256
6729488f 136 (base32 "0fr5ir8arzisx71jybbk4xz85waz50lf2y052nfimzh6vv9dx54c"))))
298a2c1e
EF
137 (build-system gnu-build-system)
138 (arguments
139 `(#:phases
140 (modify-phases %standard-phases
141 (delete 'configure)
142 (add-after 'unpack 'patch-source
143 (lambda* (#:key inputs outputs #:allow-other-keys)
144 (let ((out (assoc-ref outputs "out"))
7111ea0d 145 (tzdata (assoc-ref inputs "tzdata"))
298a2c1e
EF
146 (debian (assoc-ref inputs "debian-keyring"))
147 (ubuntu (assoc-ref inputs "ubuntu-keyring")))
148 (substitute* "Makefile"
149 (("/usr") "")
150 (("-o root -g root") "")
151 (("chown root.*") "\n"))
7111ea0d
EF
152 (substitute* '("scripts/etch"
153 "scripts/potato"
154 "scripts/sarge"
155 "scripts/sid"
156 "scripts/woody"
157 "scripts/woody.buildd")
298a2c1e
EF
158 (("/usr") debian))
159 (substitute* "scripts/gutsy"
160 (("/usr") ubuntu))
161 (substitute* "debootstrap"
162 (("=/usr") (string-append "=" out)))
90041e9c
VC
163 ;; Ensure PATH works both in guix and within the debian chroot
164 ;; workaround for: https://bugs.debian.org/929889
165 (substitute* "functions"
166 (("PATH=/sbin:/usr/sbin:/bin:/usr/bin")
167 "PATH=$PATH:/sbin:/usr/sbin:/bin:/usr/bin"))
7111ea0d
EF
168 (substitute* (find-files "scripts" ".")
169 (("/usr/share/zoneinfo") (string-append tzdata "/share/zoneinfo")))
298a2c1e
EF
170 #t)))
171 (add-after 'install 'install-man-file
172 (lambda* (#:key outputs #:allow-other-keys)
173 (let ((out (assoc-ref outputs "out")))
174 (install-file "debootstrap.8"
175 (string-append out "/share/man/man8"))
7111ea0d
EF
176 #t)))
177 (add-after 'install 'wrap-executable
178 (lambda* (#:key outputs #:allow-other-keys)
179 (let ((debootstrap (string-append (assoc-ref outputs "out")
180 "/sbin/debootstrap"))
181 (path (getenv "PATH")))
182 (wrap-program debootstrap
183 `("PATH" ":" prefix (,path)))
298a2c1e
EF
184 #t))))
185 #:make-flags (list (string-append "DESTDIR=" (assoc-ref %outputs "out")))
186 #:tests? #f)) ; no tests
187 (inputs
7111ea0d 188 `(("debian-keyring" ,debian-archive-keyring)
298a2c1e 189 ("ubuntu-keyring" ,ubuntu-keyring)
6941004f
MB
190 ("tzdata" ,tzdata)
191
192 ;; Called at run-time from various places, needs to be in PATH.
193 ("gnupg" ,gnupg)
194 ("wget" ,wget)))
7111ea0d
EF
195 (native-inputs
196 `(("perl" ,perl)))
5743ba49 197 (home-page "https://tracker.debian.org/pkg/debootstrap")
298a2c1e
EF
198 (synopsis "Bootstrap a basic Debian system")
199 (description "Debootstrap is used to create a Debian base system from
200scratch, without requiring the availability of @code{dpkg} or @code{apt}.
201It does this by downloading .deb files from a mirror site, and carefully
90041e9c 202unpacking them into a directory which can eventually be chrooted into.")
298a2c1e 203 (license license:gpl2)))
524e5fe5 204
dd3bd0be
MB
205(define-public debianutils
206 (package
207 (name "debianutils")
34017e3f 208 (version "4.11.1")
dd3bd0be
MB
209 (source (origin
210 (method git-fetch)
211 (uri (git-reference
212 (url "https://salsa.debian.org/debian/debianutils.git")
213 (commit (string-append "debian/" version))))
214 (file-name (git-file-name "debianutils" version))
215 (sha256
216 (base32
34017e3f 217 "18ypb7fivch53wwrdf73yhf1fhkwn9kvw1kfdc1m450241d6191w"))))
dd3bd0be
MB
218 (build-system gnu-build-system)
219 (arguments
220 '(#:phases (modify-phases %standard-phases
221 (add-after 'bootstrap 'create-translations
222 (lambda _
223 (with-directory-excursion "po4a"
224 (invoke "po4a" "--no-backups" "po4a.conf"))
225 #t)))))
226 (native-inputs
227 `(("autoconf" ,autoconf)
228 ("automake" ,automake)
229 ("gettext" ,gettext-minimal)
230 ("po4a" ,po4a)))
231 (home-page "https://packages.debian.org/unstable/debianutils")
232 (synopsis "Miscellaneous shell utilities")
233 (description
234 "This package provides a number of utilities which are mostly for use
235in installation scripts of Debian packages. The programs included are
236@command{add-shell}, @command{installkernel}, @command{ischroot},
237@command{remove-shell}, @command{run-parts}, @command{savelog},
238@command{tempfile}, and @command{which}.")
239 (license (list license:gpl2+
240 ;; The 'savelog' program is distributed under a
241 ;; GPL-compatible copyleft license.
242 (license:fsf-free "file://debian/copyright"
243 "The SMAIL General Public License, see
244debian/copyright for more information.")))))
524e5fe5
JBN
245
246(define-public apt-mirror
247 (let ((commit "e664486a5d8947c2579e16dd793d762ea3de4202")
248 (revision "1"))
249 (package
250 (name "apt-mirror")
251 (version (git-version "0.5.4" revision commit))
252 (source (origin
253 (method git-fetch)
254 (uri (git-reference
255 (url "https://github.com/apt-mirror/apt-mirror/")
256 (commit commit)))
257 (file-name (git-file-name name version))
258 (sha256
259 (base32
260 "0qj6b7gldwcqyfs2kp6amya3ja7s4vrljs08y4zadryfzxf35nqq"))))
261 (build-system gnu-build-system)
262 (outputs '("out"))
263 (arguments
264 `(#:tests? #f
265 ;; sysconfdir is not PREFIXed in the makefile but DESTDIR is
266 ;; honored correctly; we therefore use DESTDIR for our
267 ;; needs. A more correct fix would involve patching.
268 #:make-flags (list (string-append "DESTDIR=" (assoc-ref %outputs "out"))
269 "PREFIX=/")
270 #:phases (modify-phases %standard-phases (delete 'configure))))
271 (inputs
272 `(("wget" ,wget)
273 ("perl" ,perl)))
274 (home-page "http://apt-mirror.github.io/")
275 (synopsis "Script for mirroring a Debian repository")
276 (description
277 "apt-mirror is a small tool that provides the ability to
278selectively mirror Debian and Ubuntu GNU/Linux distributions or any
279other apt sources typically provided by open source developers.")
280 (license license:gpl2))))
d82766e6
EF
281
282(define-public dpkg
283 (package
284 (name "dpkg")
285 (version "1.20.5")
286 (source
287 (origin
288 (method git-fetch)
289 (uri (git-reference
290 (url "https://git.dpkg.org/git/dpkg/dpkg")
291 (commit version)))
292 (file-name (git-file-name name version))
293 (sha256
294 (base32
295 "190q968g1vdz07byvfvc2gladhpq3yl765mfiacglyix3nkisy0j"))))
296 (build-system gnu-build-system)
297 (arguments
298 `(#:phases
299 (modify-phases %standard-phases
300 (add-before 'bootstrap 'patch-version
301 (lambda _
302 (patch-shebang "get-version")
303 (with-output-to-file ".dist-version"
304 (lambda () (display ,version)))
305 #t))
306 (add-after 'unpack 'set-perl-libdir
307 (lambda* (#:key inputs outputs #:allow-other-keys)
308 (let ((out (assoc-ref outputs "out"))
309 (perl (assoc-ref inputs "perl")))
310 (setenv "PERL_LIBDIR"
311 (string-append out
312 "/lib/perl5/site_perl/"
313 ,(package-version perl)))
314 #t))))))
315 (native-inputs
316 `(("autoconf" ,autoconf)
317 ("automake" ,automake)
318 ("gettext" ,gettext-minimal)
319 ("libtool" ,libtool)
320 ("pkg-config" ,pkg-config)
321 ("perl-io-string" ,perl-io-string)))
322 (inputs
323 `(("bzip2" ,bzip2)
324 ("libmd" ,libmd)
325 ("ncurses" ,ncurses)
326 ("perl" ,perl)
327 ("xz" ,xz)
328 ("zlib" ,zlib)))
329 (home-page "https://wiki.debian.org/Teams/Dpkg")
330 (synopsis "Debian package management system")
331 (description "This package provides the low-level infrastructure for
332handling the installation and removal of Debian software packages.")
333 (license license:gpl2+)))