my-guix/wip/pbuilder.scm

121 lines
5.1 KiB
Scheme
Raw Normal View History

2021-01-15 12:19:02 +01:00
;;; Copyright © 2020, 2021 Efraim Flashner <efraim@flashner.co.il>
2020-09-06 14:28:07 +02:00
;;;
;;; This file is an addendum to GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (wip pbuilder)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix git-download)
#:use-module (guix packages)
#:use-module (guix utils)
#:use-module (guix build-system gnu)
#:use-module (gnu packages base)
2020-11-25 08:16:54 +01:00
#:use-module (gnu packages debian)
2020-09-06 14:28:07 +02:00
#:use-module (gnu packages gettext)
#:use-module (gnu packages linux)
#:use-module (gnu packages man)
#:use-module (gnu packages perl)
2021-01-15 12:19:02 +01:00
#:use-module (gnu packages xml))
2020-09-06 14:28:07 +02:00
;; TODO: Wrap bins with Debian's devscripts
(define-public pbuilder
(package
(name "pbuilder")
2021-02-24 15:42:28 +01:00
(version "0.231")
2020-09-06 14:28:07 +02:00
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://salsa.debian.org/pbuilder-team/pbuilder.git/")
(commit version)))
(file-name (git-file-name name version))
(sha256
(base32
2021-02-24 15:42:28 +01:00
"0z6f1fgcrkfql9ayc3d0nxra2y6cn91xd5lvr0hd8gdlp9xdvxbc"))))
2020-09-06 14:28:07 +02:00
(build-system gnu-build-system)
(arguments
'(#:phases
(modify-phases %standard-phases
(delete 'configure) ; no configure script
(add-after 'unpack 'patch-source
(lambda* (#:key outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out")))
(substitute* '("Makefile"
"pbuildd/Makefile")
(("/usr") "")
;; Skip documentation for now
2021-01-15 12:19:02 +01:00
((".*-C Documentation.*") ""))
2021-11-14 14:03:35 +01:00
(substitute* '("pbuilder-checkparams"
"pbuilder-loadconfig"
"pbuilder-satisfydepends-apt"
"pbuilder-satisfydepends-aptitude"
"pbuilder-satisfydepends-classic")
(("\\$\\{PBUILDER_PKGLIBDIR:-\\$PBUILDER_ROOT/usr/lib/pbuilder\\}")
(string-append out "/lib/pbuilder"))
(("\\$\\{PBUILDER_PKGDATADIR:-\\$PBUILDER_ROOT/usr/share/pbuilder\\}")
(string-append out "/share/pbuilder"))
(("\\$\\{PBUILDER_SYSCONFDIR:-\\$PBUILDER_ROOT/etc\\}")
(string-append out "/etc")))
2021-01-15 12:19:02 +01:00
(substitute* '("debuild-pbuilder"
2020-09-06 14:28:07 +02:00
"pbuilder"
2021-01-15 12:19:02 +01:00
"pbuilder-buildpackage"
2020-09-06 14:28:07 +02:00
"pbuilder-checkparams"
"pbuilder-loadconfig"
2021-01-15 12:19:02 +01:00
"pbuilderrc"
2020-09-06 14:28:07 +02:00
"pdebuild"
2021-01-15 12:19:02 +01:00
"pdebuild-checkparams"
"pdebuild-internal")
2020-12-03 08:10:03 +01:00
(("/usr/lib/pbuilder")
2021-01-15 12:19:02 +01:00
(string-append out "/lib/pbuilder")))
2020-09-06 14:28:07 +02:00
(substitute* "pbuildd/buildd-config.sh"
2020-12-03 08:10:03 +01:00
(("/usr/share/doc/pbuilder")
2021-01-15 12:19:02 +01:00
(string-append out "/share/doc/pbuilder")))
(substitute* "pbuilderrc"
(("dpkg --print-architecture")
(string-append (which "dpkg") " --print-architecture")))
2020-09-06 14:28:07 +02:00
#t)))
(add-after 'install 'wrap-programs
(lambda* (#:key inputs outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out")))
(for-each
(lambda (file)
(wrap-program file
2020-12-03 08:10:03 +01:00
`("PATH" ":" prefix (,(dirname (which "sed"))
,(dirname (which "readlink"))
,(dirname (which "dpkg-architecture"))
2021-01-15 12:19:02 +01:00
,(dirname (which "debootstrap"))))
`("PERL5LIB" ":" prefix (,(getenv "PERL5LIB")))))
2020-09-06 14:28:07 +02:00
(cons* (string-append out "/bin/pdebuild")
2020-12-03 08:10:03 +01:00
(string-append out "/sbin/pbuilder")
2021-01-15 12:19:02 +01:00
(find-files (string-append out "/lib/pbuilder"))))
#t))))
2020-09-06 14:28:07 +02:00
#:make-flags (list (string-append "DESTDIR=" (assoc-ref %outputs "out")))
2021-01-15 12:19:02 +01:00
#:tests? #f))
2020-09-06 14:28:07 +02:00
(inputs
2021-01-15 12:19:02 +01:00
`(("dpkg" ,dpkg)
("debootstrap" ,debootstrap)
("perl" ,perl)))
2020-09-06 14:28:07 +02:00
(native-inputs
2021-01-15 12:19:02 +01:00
`(("grep" ,grep)
2020-09-06 14:28:07 +02:00
("libxslt" ,libxslt)
("man-db" ,man-db)
("po4a" ,po4a)
2021-01-15 12:19:02 +01:00
("util-linux" ,util-linux)))
2020-09-06 14:28:07 +02:00
(home-page "https://pbuilder-team.pages.debian.net/pbuilder/")
(synopsis "Personal package builder for Debian packages")
(description
"@code{pbuilder} is a personal package builder for Debian packages.")
(license license:gpl2+)))