debian.scm 16 KB

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