feat: support exposing buildtool to aid reproducible builds configs
This helps to map the correct build tool configs that are required to reproduce a specific package and have the appropriate *FLAGS etc.
This commit is contained in:
parent
60e96c9d4b
commit
0a0e66a784
2
Makefile
2
Makefile
|
@ -89,7 +89,7 @@ edit = sed -e "s|@pkgdatadir[@]|$(PREFIX)/share/devtools|g"
|
||||||
%: %.in Makefile lib/common.sh
|
%: %.in Makefile lib/common.sh
|
||||||
@echo "GEN $@"
|
@echo "GEN $@"
|
||||||
@$(RM) "$@"
|
@$(RM) "$@"
|
||||||
@{ echo -n 'm4_changequote([[[,]]])'; cat $@.in; } | m4 -P | $(edit) >$@
|
@{ echo -n 'm4_changequote([[[,]]])'; cat $@.in; } | m4 -P --define=m4_devtools_version=$V | $(edit) >$@
|
||||||
@chmod a-w "$@"
|
@chmod a-w "$@"
|
||||||
@chmod +x "$@"
|
@chmod +x "$@"
|
||||||
@bash -O extglob -n "$@"
|
@bash -O extglob -n "$@"
|
||||||
|
|
|
@ -14,6 +14,10 @@ $_INCLUDE_COMMON_SH
|
||||||
# Avoid any encoding problems
|
# Avoid any encoding problems
|
||||||
export LANG=C
|
export LANG=C
|
||||||
|
|
||||||
|
# Set buildtool properties
|
||||||
|
export BUILDTOOL=devtools
|
||||||
|
export BUILDTOOLVER=m4_devtools_version
|
||||||
|
|
||||||
shopt -s extglob
|
shopt -s extglob
|
||||||
|
|
||||||
# check if messages are to be printed using color
|
# check if messages are to be printed using color
|
||||||
|
|
|
@ -190,6 +190,8 @@ EOF
|
||||||
printf '#!/bin/bash\n'
|
printf '#!/bin/bash\n'
|
||||||
declare -f _chrootbuild
|
declare -f _chrootbuild
|
||||||
declare -p SOURCE_DATE_EPOCH 2>/dev/null || true
|
declare -p SOURCE_DATE_EPOCH 2>/dev/null || true
|
||||||
|
declare -p BUILDTOOL 2>/dev/null
|
||||||
|
declare -p BUILDTOOLVER 2>/dev/null
|
||||||
printf '_chrootbuild "$@" || exit\n'
|
printf '_chrootbuild "$@" || exit\n'
|
||||||
|
|
||||||
if (( run_namcap )); then
|
if (( run_namcap )); then
|
||||||
|
@ -213,7 +215,10 @@ _chrootbuild() {
|
||||||
# use "$" in arguments to commands with "sudo -i". ${foo} or
|
# use "$" in arguments to commands with "sudo -i". ${foo} or
|
||||||
# ${1} is OK, but $foo or $1 isn't.
|
# ${1} is OK, but $foo or $1 isn't.
|
||||||
# https://bugzilla.sudo.ws/show_bug.cgi?id=765
|
# https://bugzilla.sudo.ws/show_bug.cgi?id=765
|
||||||
sudo --preserve-env=SOURCE_DATE_EPOCH -iu builduser bash -c 'cd /startdir; makepkg "$@"' -bash "$@"
|
sudo --preserve-env=SOURCE_DATE_EPOCH \
|
||||||
|
--preserve-env=BUILDTOOL \
|
||||||
|
--preserve-env=BUILDTOOLVER \
|
||||||
|
-iu builduser bash -c 'cd /startdir; makepkg "$@"' -bash "$@"
|
||||||
ret=$?
|
ret=$?
|
||||||
case $ret in
|
case $ret in
|
||||||
0|14)
|
0|14)
|
||||||
|
@ -298,7 +303,7 @@ done
|
||||||
[[ -n $makepkg_user && -z $(id -u "$makepkg_user") ]] && die 'Invalid makepkg user.'
|
[[ -n $makepkg_user && -z $(id -u "$makepkg_user") ]] && die 'Invalid makepkg user.'
|
||||||
makepkg_user=${makepkg_user:-${SUDO_USER:-$USER}}
|
makepkg_user=${makepkg_user:-${SUDO_USER:-$USER}}
|
||||||
|
|
||||||
check_root SOURCE_DATE_EPOCH,GNUPGHOME,SRCDEST,SRCPKGDEST,PKGDEST,LOGDEST,MAKEFLAGS,PACKAGER
|
check_root SOURCE_DATE_EPOCH,BUILDTOOL,BUILDTOOLVER,GNUPGHOME,SRCDEST,SRCPKGDEST,PKGDEST,LOGDEST,MAKEFLAGS,PACKAGER
|
||||||
|
|
||||||
# Canonicalize chrootdir, getting rid of trailing /
|
# Canonicalize chrootdir, getting rid of trailing /
|
||||||
chrootdir=$(readlink -e "$passeddir")
|
chrootdir=$(readlink -e "$passeddir")
|
||||||
|
|
|
@ -178,6 +178,8 @@ parse_buildinfo < <(bsdtar -xOqf "${splitpkgs[0]}" .BUILDINFO)
|
||||||
export SOURCE_DATE_EPOCH="${buildinfo[builddate]}"
|
export SOURCE_DATE_EPOCH="${buildinfo[builddate]}"
|
||||||
PACKAGER="${buildinfo[packager]}"
|
PACKAGER="${buildinfo[packager]}"
|
||||||
BUILDDIR="${buildinfo[builddir]}"
|
BUILDDIR="${buildinfo[builddir]}"
|
||||||
|
BUILDTOOL="${buildinfo[buildtool]}"
|
||||||
|
BUILDTOOLVER="${buildinfo[buildtoolver]}"
|
||||||
PKGEXT=${splitpkgs[0]#${splitpkgs[0]%.pkg.tar*}}
|
PKGEXT=${splitpkgs[0]#${splitpkgs[0]%.pkg.tar*}}
|
||||||
|
|
||||||
# nuke and restore reproducible testenv
|
# nuke and restore reproducible testenv
|
||||||
|
@ -201,7 +203,7 @@ makechrootpkg -r "${buildroot}" -l "${chroot}" -- --packagelist || exit 1
|
||||||
|
|
||||||
# set detected makepkg.conf options
|
# set detected makepkg.conf options
|
||||||
{
|
{
|
||||||
for var in PACKAGER BUILDDIR PKGEXT; do
|
for var in PACKAGER BUILDDIR BUILDTOOL BUILDTOOLVER PKGEXT; do
|
||||||
printf '%s=%s\n' "${var}" "${!var@Q}"
|
printf '%s=%s\n' "${var}" "${!var@Q}"
|
||||||
done
|
done
|
||||||
printf 'OPTIONS=(%s)\n' "${buildopts[*]@Q}"
|
printf 'OPTIONS=(%s)\n' "${buildopts[*]@Q}"
|
||||||
|
|
Loading…
Reference in New Issue