debian.scm 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2018, 2020, 2021 Efraim Flashner <efraim@flashner.co.il>
  3. ;;; Copyright © 2018, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
  4. ;;; Copyright © 2020 Marius Bakke <marius@gnu.org>
  5. ;;;
  6. ;;; This file is part of GNU Guix.
  7. ;;;
  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. (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 autotools)
  28. #:use-module (gnu packages backup)
  29. #:use-module (gnu packages base)
  30. #:use-module (gnu packages compression)
  31. #:use-module (gnu packages crypto)
  32. #:use-module (gnu packages dbm)
  33. #:use-module (gnu packages gettext)
  34. #:use-module (gnu packages gnupg)
  35. #:use-module (gnu packages ncurses)
  36. #:use-module (gnu packages perl)
  37. #:use-module (gnu packages pkg-config)
  38. #:use-module (gnu packages wget))
  39. (define-public debian-archive-keyring
  40. (package
  41. (name "debian-archive-keyring")
  42. (version "2021.1.1")
  43. (source
  44. (origin
  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))
  50. (sha256
  51. (base32
  52. "0dcmv7y1k6j3a646kr0rkd2a0c4j2wrz868bh8j9zjx1npzns73q"))))
  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
  78. contains the archive keys used for that.")
  79. (license (list license:public-domain ; the keys
  80. license:gpl2+)))) ; see debian/copyright
  81. (define-public debian-ports-archive-keyring
  82. (package
  83. (name "debian-ports-archive-keyring")
  84. (version "2020.02.02")
  85. (source
  86. (origin
  87. (method url-fetch)
  88. (uri (string-append "mirror://debian/pool/main/d"
  89. "/debian-ports-archive-keyring"
  90. "/debian-ports-archive-keyring_" version ".tar.xz"))
  91. (sha256
  92. (base32
  93. "0746zfc3n4f77wlrd9a9a6r4mahz2cx5wdd9izg65vmn5qwamgza"))))
  94. (build-system gnu-build-system)
  95. (arguments
  96. '(#:tests? #f ; No test suite.
  97. #:phases
  98. (modify-phases %standard-phases
  99. (delete 'configure) ; No configure script.
  100. (replace 'build
  101. (lambda _
  102. ;; gpg options derived from the debian/rules file.
  103. (let ((gpg-options (list "--no-options" "--no-default-keyring"
  104. "--no-auto-check-trustdb" "--no-keyring"
  105. "--import-options" "import-export"
  106. "--import")))
  107. (with-output-to-file "debian-ports-archive-keyring.gpg"
  108. (lambda _
  109. (apply invoke "gpg"
  110. (append gpg-options (find-files "active-keys")))))
  111. (with-output-to-file "debian-ports-archive-keyring-removed.gpg"
  112. (lambda _
  113. (apply invoke "gpg"
  114. (append gpg-options (find-files "removed-keys")))))
  115. (mkdir "trusted.gpg")
  116. (for-each
  117. (lambda (key)
  118. (with-output-to-file
  119. (string-append "trusted.gpg/" (basename key ".key") ".gpg")
  120. (lambda _
  121. (apply invoke "gpg" (append gpg-options (list key))))))
  122. (find-files "active-keys"))
  123. #t)))
  124. (replace 'install
  125. (lambda* (#:key outputs #:allow-other-keys)
  126. (let* ((out (assoc-ref outputs "out"))
  127. (apt (string-append out "/etc/apt/trusted.gpg.d/"))
  128. (key (string-append out "/share/keyrings/")))
  129. (install-file "debian-ports-archive-keyring.gpg" key)
  130. (install-file "debian-ports-archive-keyring-removed.gpg" key)
  131. (for-each (lambda (file)
  132. (install-file file apt))
  133. (find-files "trusted.gpg" "\\.gpg$")))
  134. #t)))))
  135. (native-inputs
  136. `(("gnupg" ,gnupg)))
  137. (home-page "https://tracker.debian.org/pkg/debian-ports-archive-keyring")
  138. (synopsis "GnuPG archive keys of the Debian ports archive")
  139. (description
  140. "The Debian ports-archive digitally signs its Release files. This package
  141. contains the archive keys used for that.")
  142. ;; "The keys in the keyrings don't fall under any copyright."
  143. (license license:public-domain)))
  144. (define-public ubuntu-keyring
  145. (package
  146. (name "ubuntu-keyring")
  147. (version "2021.03.26")
  148. (source
  149. (origin
  150. (method url-fetch)
  151. (uri (string-append "https://launchpad.net/ubuntu/+archive/primary/"
  152. "+files/" name "_" version ".tar.gz"))
  153. (sha256
  154. (base32
  155. "1ccvwh4s51viyhcg8gh189jmvbrhc5wv1bbp4minz3200rffsbj9"))))
  156. (build-system trivial-build-system)
  157. (arguments
  158. `(#:modules ((guix build utils))
  159. #:builder (begin
  160. (use-modules (guix build utils))
  161. (let* ((out (assoc-ref %outputs "out"))
  162. (apt (string-append out "/etc/apt/trusted.gpg.d/"))
  163. (key (string-append out "/share/keyrings/")))
  164. (setenv "PATH" (string-append
  165. (assoc-ref %build-inputs "gzip") "/bin:"
  166. (assoc-ref %build-inputs "tar") "/bin"))
  167. (invoke "tar" "xvf" (assoc-ref %build-inputs "source"))
  168. (for-each (lambda (file)
  169. (install-file file apt))
  170. (find-files "." "ubuntu-[^am].*\\.gpg$"))
  171. (for-each (lambda (file)
  172. (install-file file key))
  173. (find-files "." "ubuntu-[am].*\\.gpg$")))
  174. #t)))
  175. (native-inputs
  176. `(("tar" ,tar)
  177. ("gzip" ,gzip)))
  178. (home-page "https://launchpad.net/ubuntu/+source/ubuntu-keyring")
  179. (synopsis "GnuPG keys of the Ubuntu archive")
  180. (description
  181. "The Ubuntu project digitally signs its Release files. This package
  182. contains the archive keys used for that.")
  183. (license (list license:public-domain ; the keys
  184. license:gpl2+)))) ; see debian/copyright
  185. (define-public debootstrap
  186. (package
  187. (name "debootstrap")
  188. (version "1.0.124")
  189. (source
  190. (origin
  191. (method git-fetch)
  192. (uri (git-reference
  193. (url "https://salsa.debian.org/installer-team/debootstrap.git")
  194. (commit version)))
  195. (file-name (git-file-name name version))
  196. (sha256
  197. (base32 "0pbvrp7gb87pwmjika5hy97342mdfvm0gmy23ag8xz1nnpmn160j"))))
  198. (build-system gnu-build-system)
  199. (arguments
  200. `(#:phases
  201. (modify-phases %standard-phases
  202. (delete 'configure)
  203. (add-after 'unpack 'patch-source
  204. (lambda* (#:key inputs outputs #:allow-other-keys)
  205. (let ((out (assoc-ref outputs "out"))
  206. (tzdata (assoc-ref inputs "tzdata"))
  207. (debian (assoc-ref inputs "debian-keyring"))
  208. (ubuntu (assoc-ref inputs "ubuntu-keyring")))
  209. (substitute* "Makefile"
  210. (("/usr") "")
  211. (("-o root -g root") "")
  212. (("chown root.*") "\n"))
  213. (substitute* '("scripts/etch"
  214. "scripts/potato"
  215. "scripts/sarge"
  216. "scripts/sid"
  217. "scripts/woody"
  218. "scripts/woody.buildd")
  219. (("/usr") debian))
  220. (substitute* "scripts/gutsy"
  221. (("/usr") ubuntu))
  222. (substitute* "debootstrap"
  223. (("=/usr") (string-append "=" out)))
  224. ;; Ensure PATH works both in guix and within the debian chroot
  225. ;; workaround for: https://bugs.debian.org/929889
  226. (substitute* "functions"
  227. (("PATH=/sbin:/usr/sbin:/bin:/usr/bin")
  228. "PATH=$PATH:/sbin:/usr/sbin:/bin:/usr/bin"))
  229. (substitute* (find-files "scripts" ".")
  230. (("/usr/share/zoneinfo") (string-append tzdata "/share/zoneinfo")))
  231. #t)))
  232. (add-after 'install 'install-man-file
  233. (lambda* (#:key outputs #:allow-other-keys)
  234. (let ((out (assoc-ref outputs "out")))
  235. (install-file "debootstrap.8"
  236. (string-append out "/share/man/man8"))
  237. #t)))
  238. (add-after 'install 'wrap-executable
  239. (lambda* (#:key outputs #:allow-other-keys)
  240. (let ((debootstrap (string-append (assoc-ref outputs "out")
  241. "/sbin/debootstrap"))
  242. (path (getenv "PATH")))
  243. (wrap-program debootstrap
  244. `("PATH" ":" prefix (,path)))
  245. #t))))
  246. #:make-flags (list (string-append "DESTDIR=" (assoc-ref %outputs "out")))
  247. #:tests? #f)) ; no tests
  248. (inputs
  249. `(("debian-keyring" ,debian-archive-keyring)
  250. ("ubuntu-keyring" ,ubuntu-keyring)
  251. ("tzdata" ,tzdata)
  252. ;; Called at run-time from various places, needs to be in PATH.
  253. ("gnupg" ,gnupg)
  254. ("wget" ,wget)))
  255. (native-inputs
  256. `(("perl" ,perl)))
  257. (home-page "https://tracker.debian.org/pkg/debootstrap")
  258. (synopsis "Bootstrap a basic Debian system")
  259. (description "Debootstrap is used to create a Debian base system from
  260. scratch, without requiring the availability of @code{dpkg} or @code{apt}.
  261. It does this by downloading .deb files from a mirror site, and carefully
  262. unpacking them into a directory which can eventually be chrooted into.")
  263. (license license:gpl2)))
  264. (define-public debianutils
  265. (package
  266. (name "debianutils")
  267. (version "4.11.1")
  268. (source (origin
  269. (method git-fetch)
  270. (uri (git-reference
  271. (url "https://salsa.debian.org/debian/debianutils.git")
  272. (commit (string-append "debian/" version))))
  273. (file-name (git-file-name "debianutils" version))
  274. (sha256
  275. (base32
  276. "18ypb7fivch53wwrdf73yhf1fhkwn9kvw1kfdc1m450241d6191w"))))
  277. (build-system gnu-build-system)
  278. (arguments
  279. '(#:phases (modify-phases %standard-phases
  280. (add-after 'bootstrap 'create-translations
  281. (lambda _
  282. (with-directory-excursion "po4a"
  283. (invoke "po4a" "--no-backups" "po4a.conf"))
  284. #t)))))
  285. (native-inputs
  286. `(("autoconf" ,autoconf)
  287. ("automake" ,automake)
  288. ("gettext" ,gettext-minimal)
  289. ("po4a" ,po4a)))
  290. (home-page "https://packages.debian.org/unstable/debianutils")
  291. (synopsis "Miscellaneous shell utilities")
  292. (description
  293. "This package provides a number of utilities which are mostly for use
  294. in installation scripts of Debian packages. The programs included are
  295. @command{add-shell}, @command{installkernel}, @command{ischroot},
  296. @command{remove-shell}, @command{run-parts}, @command{savelog},
  297. @command{tempfile}, and @command{which}.")
  298. (license (list license:gpl2+
  299. ;; The 'savelog' program is distributed under a
  300. ;; GPL-compatible copyleft license.
  301. (license:fsf-free "file://debian/copyright"
  302. "The SMAIL General Public License, see
  303. debian/copyright for more information.")))))
  304. (define-public apt-mirror
  305. (let ((commit "e664486a5d8947c2579e16dd793d762ea3de4202")
  306. (revision "1"))
  307. (package
  308. (name "apt-mirror")
  309. (version (git-version "0.5.4" revision commit))
  310. (source (origin
  311. (method git-fetch)
  312. (uri (git-reference
  313. (url "https://github.com/apt-mirror/apt-mirror/")
  314. (commit commit)))
  315. (file-name (git-file-name name version))
  316. (sha256
  317. (base32
  318. "0qj6b7gldwcqyfs2kp6amya3ja7s4vrljs08y4zadryfzxf35nqq"))))
  319. (build-system gnu-build-system)
  320. (outputs '("out"))
  321. (arguments
  322. `(#:tests? #f
  323. ;; sysconfdir is not PREFIXed in the makefile but DESTDIR is
  324. ;; honored correctly; we therefore use DESTDIR for our
  325. ;; needs. A more correct fix would involve patching.
  326. #:make-flags (list (string-append "DESTDIR=" (assoc-ref %outputs "out"))
  327. "PREFIX=/")
  328. #:phases (modify-phases %standard-phases (delete 'configure))))
  329. (inputs
  330. `(("wget" ,wget)
  331. ("perl" ,perl)))
  332. (home-page "http://apt-mirror.github.io/")
  333. (synopsis "Script for mirroring a Debian repository")
  334. (description
  335. "apt-mirror is a small tool that provides the ability to
  336. selectively mirror Debian and Ubuntu GNU/Linux distributions or any
  337. other apt sources typically provided by open source developers.")
  338. (license license:gpl2))))
  339. (define-public dpkg
  340. (package
  341. (name "dpkg")
  342. (version "1.20.9")
  343. (source
  344. (origin
  345. (method git-fetch)
  346. (uri (git-reference
  347. (url "https://git.dpkg.org/git/dpkg/dpkg")
  348. (commit version)))
  349. (file-name (git-file-name name version))
  350. (sha256
  351. (base32
  352. "16wlb8hwbdvxar187bjd4pzdzj95g3l2ryi2khqqmwbyca4sjm1n"))))
  353. (build-system gnu-build-system)
  354. (arguments
  355. `(#:phases
  356. (modify-phases %standard-phases
  357. (add-before 'bootstrap 'patch-version
  358. (lambda _
  359. (patch-shebang "get-version")
  360. (with-output-to-file ".dist-version"
  361. (lambda () (display ,version)))
  362. #t))
  363. (add-after 'unpack 'set-perl-libdir
  364. (lambda* (#:key inputs outputs #:allow-other-keys)
  365. (let ((out (assoc-ref outputs "out"))
  366. (perl (assoc-ref inputs "perl")))
  367. (setenv "PERL_LIBDIR"
  368. (string-append out
  369. "/lib/perl5/site_perl/"
  370. ,(package-version perl)))
  371. #t))))))
  372. (native-inputs
  373. `(("autoconf" ,autoconf)
  374. ("automake" ,automake)
  375. ("gettext" ,gettext-minimal)
  376. ("libtool" ,libtool)
  377. ("pkg-config" ,pkg-config)
  378. ("perl-io-string" ,perl-io-string)))
  379. (inputs
  380. `(("bzip2" ,bzip2)
  381. ("libmd" ,libmd)
  382. ("ncurses" ,ncurses)
  383. ("perl" ,perl)
  384. ("xz" ,xz)
  385. ("zlib" ,zlib)))
  386. (home-page "https://wiki.debian.org/Teams/Dpkg")
  387. (synopsis "Debian package management system")
  388. (description "This package provides the low-level infrastructure for
  389. handling the installation and removal of Debian software packages.")
  390. (license license:gpl2+)))
  391. (define-public reprepro
  392. (package
  393. (name "reprepro")
  394. (version "5.3.0")
  395. (source
  396. (origin
  397. (method git-fetch)
  398. (uri (git-reference
  399. (url "https://salsa.debian.org/brlink/reprepro.git/")
  400. (commit (string-append name "-" version))))
  401. (file-name (git-file-name name version))
  402. (sha256
  403. (base32
  404. "1kn7m5rxay6q2c4vgjgm4407xx2r46skkkb6rn33m6dqk1xfkqnh"))))
  405. (build-system gnu-build-system)
  406. (arguments
  407. `(#:tests? #f ; testtool not found
  408. #:phases
  409. (modify-phases %standard-phases
  410. (replace 'check
  411. (lambda* (#:key tests? #:allow-other-keys)
  412. (if tests?
  413. (with-directory-excursion "tests"
  414. (invoke (which "sh") "test.sh"))
  415. #t)))
  416. (add-after 'install 'install-completions
  417. (lambda* (#:key outputs #:allow-other-keys)
  418. (let* ((out (assoc-ref outputs "out"))
  419. (bash (string-append out "/etc/bash_completion.d/"))
  420. (zsh (string-append out "/share/zsh/site-fucnctions/")))
  421. (mkdir-p bash)
  422. (mkdir-p zsh)
  423. (copy-file "docs/reprepro.bash_completion"
  424. (string-append bash "reprepro"))
  425. (copy-file "docs/reprepro.zsh_completion"
  426. (string-append zsh "_reprepro"))
  427. #t))))))
  428. (inputs
  429. `(("bdb" ,bdb)
  430. ("bzip2" ,bzip2)
  431. ("gpgme" ,gpgme)
  432. ("libarchive" ,libarchive)
  433. ("xz" ,xz)
  434. ("zlib" ,zlib)))
  435. (native-inputs
  436. `(("autoconf" ,autoconf)
  437. ("automake" ,automake)))
  438. (home-page "https://salsa.debian.org/brlink/reprepro")
  439. (synopsis "Debian package repository producer")
  440. (description "Reprepro is a tool to manage a repository of Debian packages
  441. (@code{.deb}, @code{.udeb}, @code{.dsc}, ...). It stores files either being
  442. injected manually or downloaded from some other repository (partially) mirrored
  443. into one pool/ hierarchy. Managed packages and files are stored in a Berkeley
  444. DB, so no database server is needed. Checking signatures of mirrored
  445. repositories and creating signatures of the generated Package indices is
  446. supported.")
  447. (license license:gpl2)))