diff options
author | Allan McRae <allan@archlinux.org> | 2015-10-17 00:57:12 +0000 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2015-12-06 10:20:53 +1000 |
commit | 137ea39fa11c321a9c33000ff1b5c6cc3c59b47d (patch) | |
tree | 1de2c393f6fad65deaa6c90c2e59f0a335b3fabf | |
parent | 9cdfd18739cc4b0e2b2efeb9a92a3ea612c8505f (diff) | |
download | pacman-137ea39fa11c321a9c33000ff1b5c6cc3c59b47d.tar.xz |
makepkg: record build information in .BUILDINFO
This information can be used to reproduce build conditions, which can then be
used to determine if a package builds reproducibly.
Signed-off-by: Allan McRae <allan@archlinux.org>
-rw-r--r-- | scripts/makepkg.sh.in | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 43584c3b..d5853ceb 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -223,7 +223,7 @@ run_pacman() { else cmd=("$PACMAN_PATH" "$@") fi - if [[ $1 != -@(T|Qq) ]]; then + if [[ $1 != -@(T|Qq|Q) ]]; then if type -p sudo >/dev/null; then cmd=(sudo "${cmd[@]}") else @@ -1147,19 +1147,23 @@ write_pkginfo() { [[ $optdepends ]] && printf "optdepend = %s\n" "${optdepends[@]//+([[:space:]])/ }" [[ $makedepends ]] && printf "makedepend = %s\n" "${makedepends[@]}" [[ $checkdepends ]] && printf "checkdepend = %s\n" "${checkdepends[@]}" +} - local it - for it in "${packaging_options[@]}"; do - check_option "$it" "y" - case $? in - 0) - printf "makepkgopt = %s\n" "$it" - ;; - 1) - printf "makepkgopt = %s\n" "!$it" - ;; - esac - done +write_buildinfo() { + msg2 "$(gettext "Generating %s file...")" ".BUILDINFO" + + printf "builddir = %s\n" "${BUILDDIR}" + + local sum="$(openssl dgst -sha256 "${BUILDFILE}")" + sum=${sum##* } + + printf "pkgbuild_sha256sum = %s\n" $sum + + printf "buildenv = %s\n" "${BUILDENV[@]}" + printf "options = %s\n" "${OPTIONS[@]}" + + local pkglist=($(run_pacman -Q | sed "s# #-#")) + printf "installed = %s\n" "${pkglist[@]}" } create_package() { @@ -1176,8 +1180,9 @@ create_package() { pkgarch=$(get_pkg_arch) write_pkginfo > .PKGINFO + write_buildinfo > .BUILDINFO - local comp_files=('.PKGINFO') + local comp_files=('.PKGINFO' '.BUILDINFO') # check for changelog/install files for i in 'changelog/.CHANGELOG' 'install/.INSTALL'; do |