diff options
author | Jonas Gunz <himself@jonasgunz.de> | 2022-11-11 00:18:46 +0100 |
---|---|---|
committer | Jonas Gunz <himself@jonasgunz.de> | 2022-11-11 00:18:46 +0100 |
commit | 1cb62685afe79e7d3ab5c38b1ff6900c587f96d3 (patch) | |
tree | ef73c4093cc1fc8224e038eae8fccb171fba24c9 | |
parent | 800ded9aac3cb1d735609748a3967af3532d0cd9 (diff) | |
download | aurbuilder-1cb62685afe79e7d3ab5c38b1ff6900c587f96d3.tar.gz |
more working
-rw-r--r-- | Dockerfile | 12 | ||||
-rwxr-xr-x | bin/buildpackage.sh | 20 | ||||
-rwxr-xr-x | testrun.sh | 5 |
3 files changed, 22 insertions, 15 deletions
@@ -1,9 +1,10 @@ FROM archlinux:base-devel -ARG AUR_RPC_BASE_URL="https://aur.archlinux.org/rpc/" -ARG PACKAGE_NAME="" -ARG BUILD_ALL_AUR_DEPENDS="no" -ARG PACKAGER="John Doe <john@doe.com>" +ENV PACKAGE_NAME="" +ENV PACKAGER="John Doe <John.Doe@example.com>" +ENV ARCH="x86_64" +ENV FORCE_REBUILD="no" +ENV CHOWM="" RUN pacman --noconfirm -Syu RUN pacman --noconfirm -S git sudo @@ -13,9 +14,8 @@ RUN useradd -G sudo -d /workdir -m aurbuilder COPY --chown=root:root sudoers /etc/sudoers -RUN mkdir /pkgout /db +RUN mkdir /pkgout VOLUME /pkgout -VOLUME /db RUN pacman --noconfirm -S python python-requests diff --git a/bin/buildpackage.sh b/bin/buildpackage.sh index 4be1b3a..ace52fd 100755 --- a/bin/buildpackage.sh +++ b/bin/buildpackage.sh @@ -1,18 +1,26 @@ #!/bin/bash echo "BUILDING: $PACKAGE_NAME" -echo "Build Deps: $BUILD_ALL_AUR_DEPENDS" +echo "PACKAGER: $PACKAGER" cd /workdir || exit 1 -while read NAME BASE VER _; do - echo $NAME $BASE $VER +while read -r NAME BASE VER _; do + echo "$NAME $VER for $ARCH" + OUTNAME="$NAME-$VER-$ARCH.pkg" + + # Only build when needed + if [ ! "$FORCE_REBUILD" = "yes" ] && compgen -G "/pkgout/${OUTNAME}*"; then + echo "$NAME $VER ($ARCH) is already built. Skipping." + continue + fi sudo -u aurbuilder git clone "https://aur.archlinux.org/$BASE.git" "$BASE" cd "$BASE" || exit 1 - # TODO: PKGDEST instead of copy - sudo -u aurbuilder makepkg --syncdeps --noconfirm --install + sudo -u aurbuilder CARCH="$ARCH" PACKAGER="$PACKAGER" PKGDEST="/pkgout/" \ + makepkg --force --syncdeps --noconfirm --install - cp ./*.pkg.tar.zst /pkgout + #cp ./*.pkg.tar.zst /pkgout + test -n "$CHOWN" && sudo chown "$CHOWN" "/pkgout/${OUTNAME}"* done <<< "$(getpackage.py "$PACKAGE_NAME")" @@ -1,13 +1,12 @@ #!/bin/bash - -mkdir -p testrun/db mkdir -p testrun/pkgout ./build.sh docker run --name archpkg-test --env PACKAGE_NAME=minipro \ - -v $(pwd)/testrun/db:/db -v $(pwd)/testrun/pkgout:/pkgout \ + --env FORCE_REBUILD=yes --env CHOWN="$UID:$(id -g "$USER")" \ + -v "$(pwd)/testrun/pkgout:/pkgout" \ archpkg docker rm archpkg-test |