Skip to content

Commit

Permalink
repro: add -f switch for using PKGBUILD in working directory
Browse files Browse the repository at this point in the history
Note: Also removed setsid from the build command

Signed-off-by: Morten Linderud <[email protected]>
  • Loading branch information
Foxboron committed Jun 6, 2020
1 parent 839e3e8 commit 5896d79
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions repro.in
Original file line number Diff line number Diff line change
Expand Up @@ -193,18 +193,22 @@ function create_snapshot (){
function build_package(){
local build=$1
local builddir=${2:-"/startdir"}
local args=""
local cmds=""
if ((NOCHECK)); then
cmds="--nocheck"
fi
if ((pkgbuild_file)); then
args=--bind="${PWD}:/startdir"
fi
exec_nspawn "$build" \
bash <<-__END__
set -e
install -d -o builduser -g builduser /pkgdest
install -d -o builduser -g builduser /srcpkgdest
install -d -o builduser -g builduser /build
__END__
exec_nspawn "$build" /usr/bin/setsid -f -c -w sudo -iu builduser bash -c ". /etc/profile; cd /startdir; SOURCE_DATE_EPOCH=$SOURCE_DATE_EPOCH makepkg -sc --noconfirm --skippgpcheck $cmds"
exec_nspawn "$build" $args sudo -iu builduser bash -c ". /etc/profile; cd /startdir; SOURCE_DATE_EPOCH=$SOURCE_DATE_EPOCH makepkg -sc --noconfirm --skippgpcheck $cmds"
mkdir -p "./build"
for pkgfile in "$BUILDDIRECTORY/$build"/pkgdest/*; do
mv "$pkgfile" "./build/"
Expand Down Expand Up @@ -311,6 +315,7 @@ function cmd_check(){
create_snapshot "$build" 0

# Father I have sinned
if ((!pkgbuild_file)); then
exec_nspawn "$build" --bind="$(readlink -e ${cachedir}):/var/cache/pacman/pkg" \
bash <<-__END__
shopt -s globstar
Expand All @@ -331,6 +336,15 @@ for rev in \$(git rev-list --all -- repos/); do
done
exit 1
__END__
elif [[ -r "PKGBUILD" ]]; then
if [[ "$(sha256sum PKGBUILD | awk '{print $1}')" != "$pkgbuild_sha256sum" ]]; then
error "PKGBUILD doesn't match the checksum"
exit 1
fi
else
error "No PKGBUILD file present!"
exit 1
fi

# Setup environment
{
Expand Down Expand Up @@ -420,6 +434,9 @@ hash buildinfo 2>/dev/null || { error "Require buildinfo in path! Aborting...";
# Default options
run_diffoscope=0

# By default we don't assume a PKGBUILD
pkgbuild_file=0

repro_conf=$CONFIGDIR/repro.conf
if [[ -r $repro_conf ]]; then
# shellcheck source=/dev/null
Expand All @@ -436,9 +453,10 @@ elif [[ -r "$HOME/.repro.conf" ]]; then
fi


while getopts :hdn arg; do
while getopts :hdnf arg; do
case $arg in
h) print_help; exit 0;;
f) pkgbuild_file=1;;
d) run_diffoscope=1;;
n) NOCHECK=1;;
*) ;;
Expand Down

0 comments on commit 5896d79

Please sign in to comment.