Add `makecontainerpkg`
* Allow building Arch Linux packages within a "standard" container similar to how `makechrootpkg` allows building packages within a systemd-nspawn container * Add a Dockerfile to create an Arch Linux image suitable for package builds via `makepkg`
This commit is contained in:
parent
7a52af6090
commit
97dc991438
|
@ -0,0 +1,10 @@
|
|||
FROM archlinux:base as base
|
||||
MAINTAINER Martchus <martchus@gmx.net>
|
||||
|
||||
RUN mkdir -p /startdir /build && \
|
||||
useradd -m -d /build -u 1000 -U -s /bin/bash builduser && \
|
||||
chown -R builduser:builduser /build && \
|
||||
pacman -Syu --noconfirm --needed base-devel pacman-contrib && \
|
||||
pacman -Scc --noconfirm && \
|
||||
paccache -r -k0 && \
|
||||
rm -rf /usr/share/man/* /tmp/* /var/tmp/*
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
source PKGBUILD
|
||||
pacman -Syu --noconfirm --needed "${depends[@]}" "${makedepends[@]}" "${checkdepends[@]}"
|
||||
export LOGDEST=$PWD SRCPKGDEST=$PWD SRCDEST=$PWD PKGDEST=$PWD BUILDDIR=/build
|
||||
export BUILDTOOL=makecontainerbuild BUILDTOOLVER="0.0.1"
|
||||
chown builduser:builduser "$PWD"
|
||||
sudo --preserve-env=LOGDEST,SRCPKGDEST,SRCDEST,PKGDEST,BUILDDIR,BUILDTOOL,BUILDTOOLVER --user builduser makepkg
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
bindir=$(dirname "$0")
|
||||
"${CRE:-docker}" image build --tag "${CRE_IMAGE:-archlinux-base-devel}" "$bindir/base-devel"
|
|
@ -0,0 +1,28 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# load "containerbuild" script
|
||||
bindir=$(dirname "$0")
|
||||
script=$(cat "$bindir/containerbuild")
|
||||
|
||||
# parse arguments
|
||||
cre_args=(--workdir "/startdir" -v "$PWD":/startdir --rm)
|
||||
script_args= read_script_args=
|
||||
for arg in "$@"; do
|
||||
if [[ $read_script_args ]]; then
|
||||
script_args+=" '$arg'"
|
||||
else
|
||||
if [[ $arg == '--' ]]; then
|
||||
read_script_args=1
|
||||
else
|
||||
cre_args+=("$arg")
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# allow one to prevent the container from stopping via DEBUG variable
|
||||
if [[ $DEBUG ]]; then
|
||||
script_args+=' ; sleep infinity'
|
||||
fi
|
||||
|
||||
"${CRE:-docker}" run "${cre_args[@]}" "${CRE_IMAGE:-archlinux-base-devel}" bash -c "$script $script_args"
|
Loading…
Reference in New Issue