my-guix/wip/pbuilder.scm
2021-11-14 15:03:35 +02:00

120 lines
5.1 KiB
Scheme

;;; Copyright © 2020, 2021 Efraim Flashner <efraim@flashner.co.il>
;;;
;;; 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)
#:use-module (gnu packages debian)
#:use-module (gnu packages gettext)
#:use-module (gnu packages linux)
#:use-module (gnu packages man)
#:use-module (gnu packages perl)
#:use-module (gnu packages xml))
;; TODO: Wrap bins with Debian's devscripts
(define-public pbuilder
(package
(name "pbuilder")
(version "0.231")
(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
"0z6f1fgcrkfql9ayc3d0nxra2y6cn91xd5lvr0hd8gdlp9xdvxbc"))))
(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
((".*-C Documentation.*") ""))
(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")))
(substitute* '("debuild-pbuilder"
"pbuilder"
"pbuilder-buildpackage"
"pbuilder-checkparams"
"pbuilder-loadconfig"
"pbuilderrc"
"pdebuild"
"pdebuild-checkparams"
"pdebuild-internal")
(("/usr/lib/pbuilder")
(string-append out "/lib/pbuilder")))
(substitute* "pbuildd/buildd-config.sh"
(("/usr/share/doc/pbuilder")
(string-append out "/share/doc/pbuilder")))
(substitute* "pbuilderrc"
(("dpkg --print-architecture")
(string-append (which "dpkg") " --print-architecture")))
#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
`("PATH" ":" prefix (,(dirname (which "sed"))
,(dirname (which "readlink"))
,(dirname (which "dpkg-architecture"))
,(dirname (which "debootstrap"))))
`("PERL5LIB" ":" prefix (,(getenv "PERL5LIB")))))
(cons* (string-append out "/bin/pdebuild")
(string-append out "/sbin/pbuilder")
(find-files (string-append out "/lib/pbuilder"))))
#t))))
#:make-flags (list (string-append "DESTDIR=" (assoc-ref %outputs "out")))
#:tests? #f))
(inputs
`(("dpkg" ,dpkg)
("debootstrap" ,debootstrap)
("perl" ,perl)))
(native-inputs
`(("grep" ,grep)
("libxslt" ,libxslt)
("man-db" ,man-db)
("po4a" ,po4a)
("util-linux" ,util-linux)))
(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+)))