Commit 3fd0fb60ebad8d58fbeb7beaa4d8243aa94e563e

Thomas de Grivel 2023-02-25T23:30:44

rbpkg_ci

diff --git a/bin/rbpkg_ci b/bin/rbpkg_ci
index 412efa4..3b5d785 100755
--- a/bin/rbpkg_ci
+++ b/bin/rbpkg_ci
@@ -24,6 +24,7 @@ when "-qq"
 end
 
 Rbpkg.init("rbpkg_ci", verbose_level, Rbpkg.ci_log_dir, Rbpkg.ci_status_dir)
+Rbpkg.ci_init
 
 def usage()
   STDERR.puts "Usage: #{File.basename($0)} REPO BRANCH COMMIT"
@@ -31,9 +32,10 @@ def usage()
 end
 
 def rbpkg_ci
+  clean = false
   case $ARGS[0]
   when "--clean"
-    cmd! "rm -rf #{sh_quote(ci_dir)}"
+    clean = true
     shift
   when "-h"
     usage
@@ -47,7 +49,12 @@ def rbpkg_ci
   branch = $ARGS[0] ? shift : nil
   commit = $ARGS[0] ? shift : nil
   usage unless $ARGS == []
-  Rbpkg.ci_init
+  if clean
+    cmd = "rm -rf #{sh_quote(Rbpkg.ci_dir)}"
+    verbose(1, cmd)
+    raise "command failed: #{cmd.inspect}" unless system(cmd)
+    Rbpkg.ci_init
+  end
   Rbpkg::Repos.repo(repo).ci(branch, commit)
 end
 
diff --git a/bin/rbpkg_ci_mux b/bin/rbpkg_ci_mux
index 628ab65..0813da8 100755
--- a/bin/rbpkg_ci_mux
+++ b/bin/rbpkg_ci_mux
@@ -24,6 +24,7 @@ when "-qq"
 end
 
 Rbpkg.init("rbpkg_ci_mux", verbose_level, Rbpkg.ci_log_dir, Rbpkg.ci_status_dir)
+Rbpkg.ci_init
 
 def usage()
   STDERR.puts "Usage: #{File.basename($0)} REPO BRANCH COMMIT REMOTE ..."
@@ -52,7 +53,10 @@ def rbpkg_ci_mux
   threads = []
   hosts = $ARGS
   if clean
-    cmd! "rm -rf #{sh_quote(ci_dir)}"
+    cmd = "rm -rf #{sh_quote(Rbpkg.ci_dir)}"
+    verbose(1, cmd)
+    raise "command failed: #{cmd.inspect}" unless system(cmd)
+    Rbpkg.ci_init
     hosts.each do |host|
       cmd! "ssh #{sh_quote(host)} rbpkg_ci --clean"
     end