From: "Roberto A. Foglietta" <roberto.foglietta@gmail.com>
To: isar-users@googlegroups.com
Subject: Re: [PATCH v2] scripts/ci_build.sh installs required commands
Date: Sun, 25 Dec 2022 16:38:24 +0100 [thread overview]
Message-ID: <CAJGKYO6deFPhYUYZzC0xiur_uvG6UReqOs6j6ch_XAKKiGPr6Q@mail.gmail.com> (raw)
In-Reply-To: <CAJGKYO7t3-zQGYsZSLysEpoto_11s6O2Vr3tALcW6E50CdP5ng@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 898 bytes --]
ALL THE PATCHES UNITED IN THE FOLLOWING
Subject: [PATCH] scripts/ci_build.sh installs dependencies and uses mktemp
CI build requires some commands in order to operate properly and some of these
are checked to be in the executable path but nothing more. This fix the issue
installing them at the beginning of the script.
Previous user or concurrent users may use scripts/ci_build.sh and in
particular root user creates a temporary directory that is not removable by
common users. Using a combination of mktemp and trap on EXIT will solve
all of these problems.
This patch unites the following patches:
- scripts/ci_build.sh installs required commands
- scripts/ci_build.sh virtualenv uses mktemp to avoid conflicts
plus a last minute very important typo correction in the code.
The patch has been sent by elastic mail and went in moderation as
usual, and here in attachment. Best regards, R-
[-- Attachment #2: 0001-scripts-ci_build.sh-installs-dependencies-and-uses-m.patch --]
[-- Type: text/x-patch, Size: 2065 bytes --]
From cdc6bbbf0a2697d22479bf5eb9bf5f87b4304df2 Mon Sep 17 00:00:00 2001
From: "Roberto A. Foglietta" <roberto.foglietta@gmail.com>
Date: Sat, 24 Dec 2022 11:01:08 +0100
Subject: [PATCH] scripts/ci_build.sh installs dependencies and uses mktemp
CI build requires some commands in order to operate properly and some of these
are checked to be in the executable path but nothing more. This fix the issue
installing them at the beginning of the script.
Previous user or concurrent users may use scripts/ci_build.sh and in
particular root user creates a temporary directory that is not removable by
common users. Using a combination of mktemp and trap on EXIT will solve
all of these problems.
This patch unites the following patches:
- scripts/ci_build.sh installs required commands
- scripts/ci_build.sh virtualenv uses mktemp to avoid conflicts
plus a last minute very important typo correction in the code.
Signed-off-by: Roberto A. Foglietta <roberto.foglietta@gmail.com>
---
scripts/ci_build.sh | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/scripts/ci_build.sh b/scripts/ci_build.sh
index fa7208c..41fac8a 100755
--- a/scripts/ci_build.sh
+++ b/scripts/ci_build.sh
@@ -14,13 +14,22 @@ export PATH=$PATH:/sbin
# Go to Isar root
cd "$(dirname "$0")/.."
+for i in virtualenv umoci skopeo reprepro quilt zstd; do
+ if ! command -v $i > /dev/null; then
+ if [ "$updated" != "1" ]; then
+ sudo apt-get update
+ fi
+ sudo apt install -y $i
+ updated=1
+ fi
+done
+
# install avocado in virtualenv in case it is not there already
if ! command -v avocado > /dev/null; then
- sudo apt-get update -qq
- sudo apt-get install -y virtualenv
- rm -rf /tmp/avocado_venv
- virtualenv --python python3 /tmp/avocado_venv
- source /tmp/avocado_venv/bin/activate
+ tmpdir=$(mktemp -p "$TMPDIR" -d avocado_venv.XXXX)
+ trap "rm -rf $tmpdir" EXIT
+ virtualenv --python python3 $tmpdir
+ source $tmpdir/bin/activate
pip install avocado-framework==96.0
fi
--
2.34.1
prev parent reply other threads:[~2022-12-25 15:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-24 10:07 Roberto A. Foglietta
2022-12-24 15:47 ` Roberto A. Foglietta
2022-12-25 11:28 ` Roberto A. Foglietta
2022-12-25 15:38 ` Roberto A. Foglietta [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAJGKYO6deFPhYUYZzC0xiur_uvG6UReqOs6j6ch_XAKKiGPr6Q@mail.gmail.com \
--to=roberto.foglietta@gmail.com \
--cc=isar-users@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox