1. Save output along with log inside output directory
2. Remove wip yay support
This commit is contained in:
Balakrishnan Balasubramanian 2025-03-27 13:56:35 -04:00
parent 9ac300e528
commit 1d46cde88b
4 changed files with 27 additions and 34 deletions

View File

@ -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

View File

@ -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

View File

@ -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
```

43
run.sh
View File

@ -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