public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH v2] scripts/ci_build.sh installs required commands
@ 2022-12-24 10:07 Roberto A. Foglietta
  2022-12-24 15:47 ` Roberto A. Foglietta
  0 siblings, 1 reply; 4+ messages in thread
From: Roberto A. Foglietta @ 2022-12-24 10:07 UTC (permalink / raw)
  To: isar-users

[-- Attachment #1: Type: text/plain, Size: 330 bytes --]

Hi all,

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.

v2: typos fixed

patch sent by elastic mail and went in moderation as usual, here in attachment.

Best regards, R-

[-- Attachment #2: v2-0001-scripts-ci_build.sh-installs-required-commands.patch --]
[-- Type: text/x-patch, Size: 1396 bytes --]

From 46ae757d7f90ea817f3087f9e350253b1cfa1a69 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 v2] scripts/ci_build.sh installs required commands

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.

v2: typos fixed

Signed-off-by: Roberto A. Foglietta <roberto.foglietta@gmail.com>
---
 scripts/ci_build.sh | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/scripts/ci_build.sh b/scripts/ci_build.sh
index fa7208c..e897942 100755
--- a/scripts/ci_build.sh
+++ b/scripts/ci_build.sh
@@ -14,10 +14,18 @@ export PATH=$PATH:/sbin
 # Go to Isar root
 cd "$(dirname "$0")/.."
 
+for i in virtualenv umoci skopeo reprepro quilt; do
+	if ! command -v $i > /dev/null; then
+	    if [ "$updated" == "1" ]; then
+                sudo apt-get update -qq
+	    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
-- 
2.34.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] scripts/ci_build.sh installs required commands
  2022-12-24 10:07 [PATCH v2] scripts/ci_build.sh installs required commands Roberto A. Foglietta
@ 2022-12-24 15:47 ` Roberto A. Foglietta
  2022-12-25 11:28   ` Roberto A. Foglietta
  0 siblings, 1 reply; 4+ messages in thread
From: Roberto A. Foglietta @ 2022-12-24 15:47 UTC (permalink / raw)
  To: isar-users

[-- Attachment #1: Type: text/plain, Size: 529 bytes --]

[PATCH] scripts/ci_build.sh virtualenv uses mktemp to avoid conflicts

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 applies on the top of the current one:

 * scripts/ci_build.sh installs required commands

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-virtualenv-uses-mktemp-to-avoid-.patch --]
[-- Type: application/x-patch, Size: 1360 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] scripts/ci_build.sh installs required commands
  2022-12-24 15:47 ` Roberto A. Foglietta
@ 2022-12-25 11:28   ` Roberto A. Foglietta
  2022-12-25 15:38     ` Roberto A. Foglietta
  0 siblings, 1 reply; 4+ messages in thread
From: Roberto A. Foglietta @ 2022-12-25 11:28 UTC (permalink / raw)
  To: isar-users

[-- Attachment #1: Type: text/plain, Size: 717 bytes --]

On Sat, 24 Dec 2022 at 16:47, Roberto A. Foglietta
<roberto.foglietta@gmail.com> wrote:
>
> [PATCH] scripts/ci_build.sh virtualenv uses mktemp to avoid conflicts
>
> 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.

v2: bugfix in checking updated variable plus apt update verbose by now

>
> This patch applies on the top of the current one:
>
>  * scripts/ci_build.sh installs required commands
>
> The patch has been sent by elastic mail and went in moderation as
> usual, and here in attachment.
>
> Best regards, R-

[-- Attachment #2: v2-0001-scripts-ci_build.sh-installs-required-commands.patch --]
[-- Type: text/x-patch, Size: 1396 bytes --]

From 46ae757d7f90ea817f3087f9e350253b1cfa1a69 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 v2] scripts/ci_build.sh installs required commands

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.

v2: typos fixed

Signed-off-by: Roberto A. Foglietta <roberto.foglietta@gmail.com>
---
 scripts/ci_build.sh | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/scripts/ci_build.sh b/scripts/ci_build.sh
index fa7208c..e897942 100755
--- a/scripts/ci_build.sh
+++ b/scripts/ci_build.sh
@@ -14,10 +14,18 @@ export PATH=$PATH:/sbin
 # Go to Isar root
 cd "$(dirname "$0")/.."
 
+for i in virtualenv umoci skopeo reprepro quilt; do
+	if ! command -v $i > /dev/null; then
+	    if [ "$updated" == "1" ]; then
+                sudo apt-get update -qq
+	    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
-- 
2.34.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] scripts/ci_build.sh installs required commands
  2022-12-25 11:28   ` Roberto A. Foglietta
@ 2022-12-25 15:38     ` Roberto A. Foglietta
  0 siblings, 0 replies; 4+ messages in thread
From: Roberto A. Foglietta @ 2022-12-25 15:38 UTC (permalink / raw)
  To: isar-users

[-- 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-12-25 15:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-24 10:07 [PATCH v2] scripts/ci_build.sh installs required commands 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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox