xbps-builder: update to use ethereal build-style instead of fakedchroot (they're the same Actually but w/e)
continuous-integration/drone/push Build is failing Details

master
eater 5 years ago
parent 4a208dc64f
commit 047a02a9f7
Signed by: eater
GPG Key ID: AD2560A0F84F0759

@ -1,4 +1,4 @@
FROM d.xr.to/base:glibc
COPY files/* /opt/dxrto/
RUN chmod a+x /opt/dxrto/setup-fakedchroot /opt/dxrto/fakedchroot.sh /opt/dxrto/xbps-build && /opt/dxrto/setup-fakedchroot && ln -s /opt/dxrto/xbps-build /bin/xbps-build
RUN chmod a+x /opt/dxrto/setup-fakedchroot /opt/dxrto/xbps-build && /opt/dxrto/setup-fakedchroot && ln -s /opt/dxrto/xbps-build /bin/xbps-build
WORKDIR '/_workdir'

@ -1,80 +0,0 @@
#!/bin/sh
#
# This chroot script uses bad design
#
fake_mount() {
#
# Fake mount works by removing the dir, and replacing it with a symlink
# This created the illusion of a bind.
#
local FROM="$1";
local TO="$2"
if [ -d "$TO" ]; then
rmdir "$TO";
fi
ln -s "$FROM" "$TO";
}
fake_umount() {
#
# Remove the symlink and recreate the dir
#
rm "$1";
mkdir "$1";
}
readonly MASTERDIR="$1"
readonly DISTDIR="$2"
readonly HOSTDIR="$3"
readonly EXTRA_ARGS="$4"
readonly CMD="$5"
shift 5
if [ -z "$MASTERDIR" -o -z "$DISTDIR" ]; then
echo "$0 MASTERDIR/DISTDIR not set"
exit 1
fi
fake_mount $DISTDIR $MASTERDIR/void-packages;
if [ ! -z "$HOSTDIR" ]; then
fake_mount $HOSTDIR $MASTERDIR/host;
fi
ITEMS="";
# xbps-src may send some other binds, parse them here
while getopts 'b:' c -- "$EXTRA_ARGS"; do
# Skip everything that's not a bind
[ "$c" = "b" ] || continue;
_FROM="$(cut -d: -f1 <<< "$OPTARG")";
_TO="$(cut -d: -f2 <<< "$OPTARG")";
fake_mount "${_FROM}" "${_TO}";
# Save created mounts so we can clean them up later
ITEMS+="${_TO} "
done
CURR_DIR="${PWD}";
# To give the illusion we entered the chroot, cd to /
cd /;
# Tell xbps-src that we are "in the chroot".
IN_CHROOT=1 $CMD $@;
# Save exit code for after clean up
X="$?";
# cd back to the old pwd, so everything is the same again
cd "$CURR_DIR";
if [ ! -z "$HOSTDIR" ]; then
fake_umount $MASTERDIR/host;
fi
fake_umount $MASTERDIR/void-packages;
# "umount" on demand created "mounts"
for i in $ITEMS; do
fake_umount "$i";
done
# Exit with the returned exit code
exit "$X";

@ -1,37 +1,25 @@
#!/usr/bin/env bash
set -e;
if [ "$1" == "--fix" ]; then
sed -i 's:check_installed_pkg base-chroot-0.1_1:true:' common/xbps-src/shutils/common.sh;
exit $?
fi
readonly WORKDIR="/_workdir"
# Install base utils required for downloading latest void packages and running xbps-src
xbps-install -Sy xtools base-devel chroot-git chroot-util-linux tar wget coreutils
xbps-remote xtools base-devel chroot-git chroot-util-linux tar wget coreutils
# Clone void-packages into workdir, with depth 1, as template history is irrelevant
git clone --depth 1 'https://github.com/void-linux/void-packages.git' "${WORKDIR}";
cd "${WORKDIR}";
# Copy fakedchroot chroot style into chroot-style dir and make it executable
ln -s /opt/dxrto/fakedchroot.sh "${WORKDIR}/common/chroot-style/fakedchroot.sh";
# If masterdir exists: remove it, because we will replace it with a symlink
if [ -d "${WORKDIR}/masterdir" ]; then
rm "${WORKDIR}/masterdir";
fi
# Make $WORKDIR/masterdir point to /
ln -s / "${WORKDIR}/masterdir";
# Tell xbps-src to used our new chroot style: fakedchroot
echo XBPS_CHROOT_CMD=fakedchroot >> etc/conf;
# Tell xbps-src we init'd the chroot
touch "${WORKDIR}/masterdir/.xbps_chroot_init"
# Since base-chroot has some conflicts with a normal base, replace the check with true
sed -i 's:check_installed_pkg base-chroot-0.1_1:true:' common/xbps-src/shutils/common.sh
# Tell xbps-src to use the ehtereal build style
echo XBPS_CHROOT_CMD=ethereal >> etc/conf;
echo XBPS_ALLOW_CHROOT_BREAKOUT=yes >> etc/conf
# Install the non-conflicting dependencies of base-chroot anyway
xbps-install -Sy $(xbps-query -Rx base-chroot | grep -v 'bash\|texinfo');

@ -6,7 +6,5 @@ cd /_workdir;
echo "Updating srcpkgs";
git checkout .;
git pull --ff;
echo "Fixing fakedchroot";
/opt/dxrto/setup-fakedchroot --fix;
echo "Running build";
./xbps-src pkg "$@";

Loading…
Cancel
Save