aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Dockerfile12
-rwxr-xr-xbin/buildpackage.sh20
-rwxr-xr-xtestrun.sh5
3 files changed, 22 insertions, 15 deletions
diff --git a/Dockerfile b/Dockerfile
index e19e7af..b16d2bb 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -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")"
diff --git a/testrun.sh b/testrun.sh
index 955bc95..774962d 100755
--- a/testrun.sh
+++ b/testrun.sh
@@ -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