aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@gentoo.org>2024-09-10 15:17:53 -0400
committerEli Schwartz <eschwartz@gentoo.org>2024-09-10 20:31:02 -0400
commitd06884c8ce125cf6ee217afbb38cdb5b3fe1d101 (patch)
tree8122f17af9e78979582b9c74f84cec7124783fa6
parentgnome: try once again to fix the qml tangle (diff)
downloadbinhost-d06884c8ce125cf6ee217afbb38cdb5b3fe1d101.tar.gz
binhost-d06884c8ce125cf6ee217afbb38cdb5b3fe1d101.tar.bz2
binhost-d06884c8ce125cf6ee217afbb38cdb5b3fe1d101.zip
Add variant mechanism to build temporary packages.
Build some variants for gnome, to demonstrate how: - nopulse - an "I'm feeling lucky" mode that randomly attempts to build one of the ten thousand packages with stable keywords that isn't yet installed via autounmask - compile some unstable compilers via --buildpkgonly. Nothing is ever installed or can mix with the system, so it cannot ever have an effect on other binhost packages. But users can install upcoming compilers for testing. Variant builds are built in an ephemeral nspawn container based on the original one. The primary build has to succeed in order to build a variant, otherwise we assume resolution fails anyway. The ephemeral container means we can freely modify the portage config, even in totally broken ways, and our changes get automatically wiped after exiting. The only persistent data is the binpkgs cache, which is mounted from the real location. Signed-off-by: Eli Schwartz <eschwartz@gentoo.org>
-rwxr-xr-xbuilders/milou/binhost-update17
-rw-r--r--builders/milou/gnome-23/portage/variants/lucky/.run_marker1
-rw-r--r--builders/milou/gnome-23/portage/variants/nopulse/package.use/nopulse1
-rwxr-xr-xbuilders/milou/gnome-23/portage/variants/unstable/buildpkgonly9
-rw-r--r--builders/milou/gnome-23/portage/variants/unstable/package.accept_keywords/gcc2
-rwxr-xr-xbuilders/milou/gnome-23/run-update38
-rw-r--r--builders/milou/gnome-v3-23/portage/variants/lucky/.run_marker1
-rw-r--r--builders/milou/gnome-v3-23/portage/variants/nopulse/package.use/nopulse1
-rwxr-xr-xbuilders/milou/gnome-v3-23/portage/variants/unstable/buildpkgonly9
-rw-r--r--builders/milou/gnome-v3-23/portage/variants/unstable/package.accept_keywords/gcc2
-rwxr-xr-xbuilders/milou/gnome-v3-23/run-update38
11 files changed, 112 insertions, 7 deletions
diff --git a/builders/milou/binhost-update b/builders/milou/binhost-update
index 8a304dd..d48e15e 100755
--- a/builders/milou/binhost-update
+++ b/builders/milou/binhost-update
@@ -113,15 +113,26 @@ emerge --sync -q &>> ${TMPFILE}
anyfail=0
+nspawn_command=(systemd-nspawn --bind /var/cache/distfiles --bind-ro /var/db/repos/gentoo --tmpfs=/var/tmp:mode=1777,size=${TMPFS_SIZE}g)
for n in ${NSPAWN_NAMES} ; do
+ machinedir=/var/lib/machines/${n}
echo Machine ${n} &>> ${TMPFILE}
echo &>> ${TMPFILE}
- cd /var/lib/machines/${n}/etc/binhost &>> ${TMPFILE}
+ cd ${machinedir}/etc/binhost &>> ${TMPFILE}
git reset --hard &>> ${TMPFILE}
git pull &>> ${TMPFILE}
cd /root &>> ${TMPFILE}
- systemd-nspawn --bind /var/cache/distfiles --bind-ro /var/db/repos/gentoo --tmpfs=/var/tmp:mode=1777,size=${TMPFS_SIZE}g -M ${n} /root/bin/run-update &>> ${TMPFILE}
- let "anyfail+=$?"
+ "${nspawn_command[@]}" -M ${n} /root/bin/run-update &>> ${TMPFILE}
+ ret=$?
+ let "anyfail+=${ret}"
+ if [[ ${ret} = 0 ]]; then
+ builder=$(readlink ${machinedir}/etc/portage)
+ for variant in ${machinedir}/${builder}/variants/*; do
+ [[ -d ${variant} ]] || break
+ "${nspawn_command[@]}" --ephemeral --bind ${machinedir}/var/cache/binpkgs -M ${n} /root/bin/run-update ${variant##*/} &>> ${TMPFILE}
+ let "anyfail+=$?"
+ done
+ fi
done
diff --git a/builders/milou/gnome-23/portage/variants/lucky/.run_marker b/builders/milou/gnome-23/portage/variants/lucky/.run_marker
new file mode 100644
index 0000000..722c3eb
--- /dev/null
+++ b/builders/milou/gnome-23/portage/variants/lucky/.run_marker
@@ -0,0 +1 @@
+I'm feeling lucky!
diff --git a/builders/milou/gnome-23/portage/variants/nopulse/package.use/nopulse b/builders/milou/gnome-23/portage/variants/nopulse/package.use/nopulse
new file mode 100644
index 0000000..3f33baa
--- /dev/null
+++ b/builders/milou/gnome-23/portage/variants/nopulse/package.use/nopulse
@@ -0,0 +1 @@
+*/* -pulseaudio -screencast
diff --git a/builders/milou/gnome-23/portage/variants/unstable/buildpkgonly b/builders/milou/gnome-23/portage/variants/unstable/buildpkgonly
new file mode 100755
index 0000000..e344f3c
--- /dev/null
+++ b/builders/milou/gnome-23/portage/variants/unstable/buildpkgonly
@@ -0,0 +1,9 @@
+#!/bin/bash
+set -e
+
+# We must use buildpkgonly here since we do not want to actually install
+# unstable packages. buildpkgonly will fatally error if any dependencies aren't
+# installed.
+emerge --buildpkgonly sys-devel/gcc:15 sys-devel/gcc:14 sys-devel/gcc:12
+# ... and clean it up
+rm /etc/portage/package.accept_keywords/gcc
diff --git a/builders/milou/gnome-23/portage/variants/unstable/package.accept_keywords/gcc b/builders/milou/gnome-23/portage/variants/unstable/package.accept_keywords/gcc
new file mode 100644
index 0000000..8b9d7eb
--- /dev/null
+++ b/builders/milou/gnome-23/portage/variants/unstable/package.accept_keywords/gcc
@@ -0,0 +1,2 @@
+sys-devel/gcc ~amd64
+<sys-devel/gcc-15.0.9999:15 **
diff --git a/builders/milou/gnome-23/run-update b/builders/milou/gnome-23/run-update
index 02cdf8a..84bf589 100755
--- a/builders/milou/gnome-23/run-update
+++ b/builders/milou/gnome-23/run-update
@@ -3,6 +3,40 @@
# if one thing fails, abort entirely
set -e
-emerge -uDNkq --changed-deps --backtrack=100 --keep-going world
+to_install=(world)
-emerge --depclean --quiet-unmerge-warn
+if [[ $1 = lucky ]]; then
+ eix-update
+ eix --stable --only-names | grep -E -v '^(acct|virtual|sec)-' | sort -u > /tmp/stable
+ eix --installed --only-names | sort -u > /tmp/installed
+ comm -23 /tmp/stable /tmp/installed > /tmp/uninstalled-stable
+ sed -i 's/--binpkg-respect-use//' /etc/portage/make.conf
+
+ to_install=(--autounmask --autounmask-keep-keywords --autounmask-write --autounmask-continue $(shuf -n1 /tmp/uninstalled-stable))
+elif [[ $1 ]]; then
+ pushd /etc/portage/variants/$1
+ while read -r -d '' line; do
+ dest=../../${line%.footer}
+ if [[ ${line} = world* ]]; then
+ dest=/var/lib/portage/world
+ fi
+
+ if [[ ${line} = world.remove ]]; then
+ emerge -C $(<"${line}")
+ elif [[ ${line} = *.footer ]]; then
+ cat "${line}" >> "${dest}"
+ else
+ cp "${line}" "${dest}"
+ fi
+ done < <(find . -type f -printf '%P\0')
+ if [[ -f buildpkgonly ]]; then
+ ./buildpkgonly
+ fi
+ popd
+fi
+
+emerge -uDNkq --changed-deps --backtrack=100 --keep-going "${to_install[@]}"
+
+if [[ ! $1 ]]; then
+ emerge --depclean --quiet-unmerge-warn
+fi
diff --git a/builders/milou/gnome-v3-23/portage/variants/lucky/.run_marker b/builders/milou/gnome-v3-23/portage/variants/lucky/.run_marker
new file mode 100644
index 0000000..722c3eb
--- /dev/null
+++ b/builders/milou/gnome-v3-23/portage/variants/lucky/.run_marker
@@ -0,0 +1 @@
+I'm feeling lucky!
diff --git a/builders/milou/gnome-v3-23/portage/variants/nopulse/package.use/nopulse b/builders/milou/gnome-v3-23/portage/variants/nopulse/package.use/nopulse
new file mode 100644
index 0000000..3f33baa
--- /dev/null
+++ b/builders/milou/gnome-v3-23/portage/variants/nopulse/package.use/nopulse
@@ -0,0 +1 @@
+*/* -pulseaudio -screencast
diff --git a/builders/milou/gnome-v3-23/portage/variants/unstable/buildpkgonly b/builders/milou/gnome-v3-23/portage/variants/unstable/buildpkgonly
new file mode 100755
index 0000000..e344f3c
--- /dev/null
+++ b/builders/milou/gnome-v3-23/portage/variants/unstable/buildpkgonly
@@ -0,0 +1,9 @@
+#!/bin/bash
+set -e
+
+# We must use buildpkgonly here since we do not want to actually install
+# unstable packages. buildpkgonly will fatally error if any dependencies aren't
+# installed.
+emerge --buildpkgonly sys-devel/gcc:15 sys-devel/gcc:14 sys-devel/gcc:12
+# ... and clean it up
+rm /etc/portage/package.accept_keywords/gcc
diff --git a/builders/milou/gnome-v3-23/portage/variants/unstable/package.accept_keywords/gcc b/builders/milou/gnome-v3-23/portage/variants/unstable/package.accept_keywords/gcc
new file mode 100644
index 0000000..8b9d7eb
--- /dev/null
+++ b/builders/milou/gnome-v3-23/portage/variants/unstable/package.accept_keywords/gcc
@@ -0,0 +1,2 @@
+sys-devel/gcc ~amd64
+<sys-devel/gcc-15.0.9999:15 **
diff --git a/builders/milou/gnome-v3-23/run-update b/builders/milou/gnome-v3-23/run-update
index 02cdf8a..84bf589 100755
--- a/builders/milou/gnome-v3-23/run-update
+++ b/builders/milou/gnome-v3-23/run-update
@@ -3,6 +3,40 @@
# if one thing fails, abort entirely
set -e
-emerge -uDNkq --changed-deps --backtrack=100 --keep-going world
+to_install=(world)
-emerge --depclean --quiet-unmerge-warn
+if [[ $1 = lucky ]]; then
+ eix-update
+ eix --stable --only-names | grep -E -v '^(acct|virtual|sec)-' | sort -u > /tmp/stable
+ eix --installed --only-names | sort -u > /tmp/installed
+ comm -23 /tmp/stable /tmp/installed > /tmp/uninstalled-stable
+ sed -i 's/--binpkg-respect-use//' /etc/portage/make.conf
+
+ to_install=(--autounmask --autounmask-keep-keywords --autounmask-write --autounmask-continue $(shuf -n1 /tmp/uninstalled-stable))
+elif [[ $1 ]]; then
+ pushd /etc/portage/variants/$1
+ while read -r -d '' line; do
+ dest=../../${line%.footer}
+ if [[ ${line} = world* ]]; then
+ dest=/var/lib/portage/world
+ fi
+
+ if [[ ${line} = world.remove ]]; then
+ emerge -C $(<"${line}")
+ elif [[ ${line} = *.footer ]]; then
+ cat "${line}" >> "${dest}"
+ else
+ cp "${line}" "${dest}"
+ fi
+ done < <(find . -type f -printf '%P\0')
+ if [[ -f buildpkgonly ]]; then
+ ./buildpkgonly
+ fi
+ popd
+fi
+
+emerge -uDNkq --changed-deps --backtrack=100 --keep-going "${to_install[@]}"
+
+if [[ ! $1 ]]; then
+ emerge --depclean --quiet-unmerge-warn
+fi