commit:     a7cb9a4b03f0d7799a86da075d8de14d2ea73e7b
Author:     Eli Schwartz <eschwartz <AT> gentoo <DOT> org>
AuthorDate: Wed Jan  8 23:55:30 2025 +0000
Commit:     Eli Schwartz <eschwartz <AT> gentoo <DOT> org>
CommitDate: Thu Jan  9 00:06:39 2025 +0000
URL:        https://gitweb.gentoo.org/proj/binhost.git/commit/?id=a7cb9a4b

dola: sync over the control script changes for variant builds

We have had lots of good results running on milou. Let's allow dola to
build variants as well.

Signed-off-by: Eli Schwartz <eschwartz <AT> gentoo.org>

 builders/dola/binhost-update       | 19 +++++++++++++++---
 builders/dola/gnome-23/run-update  | 40 +++++++++++++++++++++++++++++++++++---
 builders/dola/kde-23/run-update    | 40 +++++++++++++++++++++++++++++++++++---
 builders/dola/server-23/run-update | 40 +++++++++++++++++++++++++++++++++++---
 builders/dola/server-23/world      |  1 +
 5 files changed, 128 insertions(+), 12 deletions(-)

diff --git a/builders/dola/binhost-update b/builders/dola/binhost-update
index d306a79..fe480c3 100755
--- a/builders/dola/binhost-update
+++ b/builders/dola/binhost-update
@@ -96,15 +96,28 @@ 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 -q &>> ${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)
+               echo "Starting variant builds for ${machinedir}/${builder}..." 
&>> ${TMPFILE}
+               for variant in ${machinedir}/${builder}/variants/*; do
+                       [[ -d ${variant} ]] || break
+                       echo "Variant: ${variant}" &>> ${TMPFILE}
+                       "${nspawn_command[@]}" --ephemeral --bind 
${machinedir}/var/cache/binpkgs:/var/cache/binpkgs -M ${n} /root/bin/run-update 
${variant##*/} &>> ${TMPFILE}
+                       let "anyfail+=$?"
+               done
+       fi
 done
 
 cp ${TMPFILE} 
/var/lib/machines/binhost-arm64-kde-23/var/cache/binpkgs/last-build.log

diff --git a/builders/dola/gnome-23/run-update 
b/builders/dola/gnome-23/run-update
index fff9934..2977128 100755
--- a/builders/dola/gnome-23/run-update
+++ b/builders/dola/gnome-23/run-update
@@ -3,8 +3,42 @@
 # 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
 
-eclean-pkg -C
+       to_install=(--autounmask-write --autounmask-continue $(shuf -n3 
/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
+                       mkdir -p "${dest%/*}"
+                       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
+       eclean-pkg
+fi

diff --git a/builders/dola/kde-23/run-update b/builders/dola/kde-23/run-update
index fff9934..2977128 100755
--- a/builders/dola/kde-23/run-update
+++ b/builders/dola/kde-23/run-update
@@ -3,8 +3,42 @@
 # 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
 
-eclean-pkg -C
+       to_install=(--autounmask-write --autounmask-continue $(shuf -n3 
/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
+                       mkdir -p "${dest%/*}"
+                       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
+       eclean-pkg
+fi

diff --git a/builders/dola/server-23/run-update 
b/builders/dola/server-23/run-update
index fff9934..2977128 100755
--- a/builders/dola/server-23/run-update
+++ b/builders/dola/server-23/run-update
@@ -3,8 +3,42 @@
 # 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
 
-eclean-pkg -C
+       to_install=(--autounmask-write --autounmask-continue $(shuf -n3 
/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
+                       mkdir -p "${dest%/*}"
+                       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
+       eclean-pkg
+fi

diff --git a/builders/dola/server-23/world b/builders/dola/server-23/world
index 3555899..b88cdce 100644
--- a/builders/dola/server-23/world
+++ b/builders/dola/server-23/world
@@ -1,5 +1,6 @@
 app-containers/docker
 app-editors/nano
+app-portage/eix
 app-portage/gentoolkit
 net-misc/chrony
 net-misc/dhcpcd

Reply via email to