[buildbot] buildworker,buildmaster: Use venv for Pip
LEDE Commits
lede-commits at lists.infradead.org
Thu Sep 26 04:20:08 PDT 2024
ynezz pushed a commit to buildbot.git, branch main:
https://git.openwrt.org/189ff26ca991ec680a7b841a563ec6f4a5544dfd
commit 189ff26ca991ec680a7b841a563ec6f4a5544dfd
Author: Paul Spooren <mail at aparcar.org>
AuthorDate: Thu Sep 26 11:21:00 2024 +0200
buildworker,buildmaster: Use venv for Pip
Debian 12 complains if using Pip without a virtualenv since it could
break the system.
Signed-off-by: Paul Spooren <mail at aparcar.org>
---
docker/buildmaster/Dockerfile | 8 ++++++--
docker/buildmaster/files/start.sh | 6 +++---
docker/buildworker/Dockerfile | 3 +++
docker/buildworker/files/start.sh | 4 ++--
4 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/docker/buildmaster/Dockerfile b/docker/buildmaster/Dockerfile
index d8f7f79..ccaf4a9 100644
--- a/docker/buildmaster/Dockerfile
+++ b/docker/buildmaster/Dockerfile
@@ -46,12 +46,15 @@ RUN \
locales \
pv \
pwgen \
+ python3-venv \
python3-pip \
signify-openbsd \
wget && \
apt-get clean && \
localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
+RUN python3 -m venv /opt/venv
+ENV PATH="/opt/venv/bin:$PATH"
RUN pip3 install -U pip
RUN \
pip3 install \
@@ -63,15 +66,16 @@ RUN \
"buildbot-worker==$BUILDBOT_VERSION" \
pyOpenSSL \
service_identity
+
RUN \
sed -i \
's/Welcome to buildbot/Welcome to OpenWrt buildbot/' \
- /usr/local/lib/python*/dist-packages/buildbot_www/static/scripts.js
+ /opt/venv/lib/python*/site-packages/buildbot_www/static/scripts.js
RUN \
sed -i \
"s;\"col-sm-12\"><ul><li ng-repeat;\"col-sm-12\"><ul><li>OpenWrt version: <a href=\"https://git.openwrt.org/$OPENWRT_VERSION\">$OPENWRT_VERSION</a></li><li ng-repeat;" \
- /usr/local/lib/python*/dist-packages/buildbot_www/static/scripts.js
+ /opt/venv/lib/python*/site-packages/buildbot_www/static/scripts.js
ENV LANG=en_US.utf8
diff --git a/docker/buildmaster/files/start.sh b/docker/buildmaster/files/start.sh
index 1058e51..5fb0626 100644
--- a/docker/buildmaster/files/start.sh
+++ b/docker/buildmaster/files/start.sh
@@ -2,7 +2,7 @@
case "${1:-start}" in
reconfig)
- exec /usr/local/bin/buildbot reconfig /master
+ exec /opt/venv/bin/buildbot reconfig /master
;;
start)
case "${BUILDMASTER_PHASE:-1}" in
@@ -15,12 +15,12 @@ case "${1:-start}" in
;;
esac
- /usr/local/bin/buildbot create-master --config=/phase${BUILDMASTER_PHASE:-1}/master.cfg /master
+ /opt/venv/bin/buildbot create-master --config=/phase${BUILDMASTER_PHASE:-1}/master.cfg /master
unset BUILDMASTER_PHASE
rm -f /master/twistd.pid
- exec /usr/local/bin/buildbot start --nodaemon /master
+ exec /opt/venv/bin/buildbot start --nodaemon /master
;;
/*)
exec "$@"
diff --git a/docker/buildworker/Dockerfile b/docker/buildworker/Dockerfile
index e8d077b..e6d7594 100644
--- a/docker/buildworker/Dockerfile
+++ b/docker/buildworker/Dockerfile
@@ -31,6 +31,7 @@ RUN \
pwgen \
python \
python3 \
+ python3-venv \
python3-pip \
qemu-utils \
rsync \
@@ -43,6 +44,8 @@ RUN \
apt-get clean && \
localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8
+RUN python3 -m venv /opt/venv
+ENV PATH="/opt/venv/bin:$PATH"
RUN pip3 install -U pip
RUN pip3 install \
"buildbot-worker==$BUILDBOT_VERSION" \
diff --git a/docker/buildworker/files/start.sh b/docker/buildworker/files/start.sh
index 81e2671..ef419d2 100644
--- a/docker/buildworker/files/start.sh
+++ b/docker/buildworker/files/start.sh
@@ -14,7 +14,7 @@ rm -f /builder/buildbot.tac
use_tls=""
[ "$BUILDWORKER_TLS" = 1 ] && use_tls="--use-tls"
-/usr/local/bin/buildbot-worker create-worker --force --umask="0o22" $use_tls /builder \
+/opt/venv/bin/buildbot-worker create-worker --force --umask="0o22" $use_tls /builder \
"$BUILDWORKER_MASTER" "$BUILDWORKER_NAME" "$BUILDWORKER_PASSWORD"
if [ "$BUILDWORKER_TLS" = 1 ]; then
@@ -30,4 +30,4 @@ echo "$BUILDWORKER_DESCRIPTION" > /builder/info/host
unset BUILDWORKER_ADMIN BUILDWORKER_DESCRIPTION BUILDWORKER_MASTER BUILDWORKER_NAME BUILDWORKER_PASSWORD
rm -f /builder/twistd.pid
-exec /usr/local/bin/buildbot-worker start --nodaemon /builder
+exec /opt/venv/bin/buildbot-worker start --nodaemon /builder
More information about the lede-commits
mailing list