From 1d46cde88b06e37af1a0ffcfc6c6fb63b097633e Mon Sep 17 00:00:00 2001 From: Balakrishnan Balasubramanian Date: Thu, 27 Mar 2025 13:56:35 -0400 Subject: [PATCH] Cleanup 1. Save output along with log inside output directory 2. Remove wip yay support --- Containerfile | 2 -- Makefile | 2 +- README.md | 14 +++++++++----- run.sh | 43 +++++++++++++++++-------------------------- 4 files changed, 27 insertions(+), 34 deletions(-) diff --git a/Containerfile b/Containerfile index acceb66..06c0a94 100644 --- a/Containerfile +++ b/Containerfile @@ -5,7 +5,6 @@ LABEL Description="Container to build archlinux packages" COPY makepkg.conf /etc/makepkg.conf.d/custom.conf COPY sudoers /etc/sudoers.d/builder COPY run.sh /run.sh -# COPY ./yay /usr/bin/yay RUN echo "169.254.1.2 archmirror.i.balki.me" >> /etc/hosts @@ -13,7 +12,6 @@ COPY mirrorlist /etc/pacman.d/mirrorlist RUN pacman -Sy --noconfirm git - RUN useradd builder -m WORKDIR /home/builder diff --git a/Makefile b/Makefile index 7fba488..0241c79 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ build: - podman build -t gitea.balki.me/balki/aur_builder:exp -t gitea.balki.me/balki/aur_builder:`date -I` . + podman build -t aur_builder:latest -t aur_builder:`date -I` . pull: podman pull docker.io/archlinux:base-devel diff --git a/README.md b/README.md index c92d832..4f38a81 100644 --- a/README.md +++ b/README.md @@ -15,14 +15,18 @@ Build Archlinux packages in rootless podman container ### Command to build ``` -cd ~/projects/mine/aur_builder/ -podman build -t gitea.balki.me/balki/aur_builder:exp . +podman build -t aur_builder:latest . ``` ### Command to run ``` -cd /home/balki/gotosocial_aur/ -podman run --rm -v $PWD:/w -it gitea.balki.me/balki/aur_builder:exp -Y +cd /path/to/PKGBUILD_dir +podman run --rm -it -v $PWD:/w aur_builder:latest +``` + +Drop to shell before building. + +``` +podman run --rm -it -v $PWD:/w -e DEBUG_SHELL=y aur_builder:latest ``` diff --git a/run.sh b/run.sh index dafe45f..9f56ea0 100755 --- a/run.sh +++ b/run.sh @@ -2,41 +2,32 @@ set -xeuo pipefail -sudo sh -c 'echo "169.254.1.2 archmirror.i.balki.me" >> /etc/hosts' -sudo sh -c 'echo "169.254.1.2 gitea.balki.me" >> /etc/hosts' +# /etc/hosts is managed by podman. Copying or editing with `sed -i` does not seem to work. Only appendig works +# podman sets up 169.254.1.2 to be the ip of the host +sudo sh -c 'echo "169.254.1.2 archmirror.i.balki.me" >> /etc/hosts' +sudo sh -c 'echo "169.254.1.2 gitea.balki.me" >> /etc/hosts' sudo pacman -Syu -yay_build() { - # not working yet - # rm-rf .git - - git config --global user.email "aur_builder@balki.me" - git config --global user.name "Balakrishnan Balasubramanian" - makepkg --printsrcinfo >.SRCINFO - - yay -Bi "$PWD" - -} - -makepkg_build() { - if [ -d deps ]; then - sudo pacman -U deps/*pkg.tar* - fi - makepkg -s -} - +mkdir output cp -r /w . - cd ./w if [ "${DEBUG_SHELL-n}" = y ]; then + echo "Stopping before build... Run 'exit 1' to skip building" + tail -12 "$0" bash fi -# bash -# yay_build +if [ -d deps ]; then + sudo pacman -U deps/*pkg.tar* +fi -makepkg_build +LOGDEST=../output PKGDEST=../output makepkg --syncdeps --log -sudo cp ./*pkg.tar* /w +sudo cp -r ../output /w + +if [ "${DEBUG_SHELL-n}" = y ]; then + echo "Build complete" + bash +fi