[Libguestfs] [libnbd PATCH 1/3] ci: Consolidate refresh scripts

Martin Kletzander mkletzan at redhat.com
Tue Jul 27 14:32:24 UTC 2021


And make it cleaner.

Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
---
 ci/cirrus/refresh     | 22 ----------------------
 ci/containers/refresh | 22 ----------------------
 ci/refresh            | 27 +++++++++++++++++++++++++++
 3 files changed, 27 insertions(+), 44 deletions(-)
 delete mode 100755 ci/cirrus/refresh
 delete mode 100755 ci/containers/refresh
 create mode 100755 ci/refresh

diff --git a/ci/cirrus/refresh b/ci/cirrus/refresh
deleted file mode 100755
index 459cd80d0934..000000000000
--- a/ci/cirrus/refresh
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/sh
-
-if test -z "$1"
-then
-    echo "syntax: $0 PATH-TO-LCITOOL"
-    exit 1
-fi
-
-LCITOOL=$1
-
-if ! test -x "$LCITOOL"
-then
-    echo "$LCITOOL is not executable"
-    exit 1
-fi
-
-HOSTS=$($LCITOOL hosts | grep -E 'freebsd|macos')
-
-for host in $HOSTS
-do
-    $LCITOOL variables "$host" libnbd >"$host.vars"
-done
diff --git a/ci/containers/refresh b/ci/containers/refresh
deleted file mode 100755
index 7ce5332b940a..000000000000
--- a/ci/containers/refresh
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/sh
-
-if test -z "$1"
-then
-    echo "syntax: $0 PATH-TO-LCITOOL"
-    exit 1
-fi
-
-LCITOOL=$1
-
-if ! test -x "$LCITOOL"
-then
-    echo "$LCITOOL is not executable"
-    exit 1
-fi
-
-HOSTS=$($LCITOOL hosts | grep -Ev 'freebsd|macos')
-
-for host in $HOSTS
-do
-    $LCITOOL dockerfile $host libnbd > $host.Dockerfile
-done
diff --git a/ci/refresh b/ci/refresh
new file mode 100755
index 000000000000..dee8b0bc9713
--- /dev/null
+++ b/ci/refresh
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+if test -z "$1"
+then
+    echo "syntax: $0 PATH-TO-LCITOOL"
+    exit 1
+fi
+
+LCITOOL=$1
+
+if ! test -x "$LCITOOL"
+then
+    echo "$LCITOOL is not executable"
+    exit 1
+fi
+
+ci_path=$(dirname "$0")
+
+for target in $($LCITOOL targets)
+do
+    if echo "$target" | grep -q -e 'freebsd' -e 'macos'
+    then
+        $LCITOOL variables "$target" libnbd >"$ci_path/cirrus/$target.vars"
+    else
+        $LCITOOL dockerfile "$target" libnbd >"$ci_path/containers/$target.Dockerfile"
+    fi
+done
-- 
2.32.0




More information about the Libguestfs mailing list