Commit 4d1ded065267e3669170632e03fa584858e8689d

Thomas de Grivel 2023-02-25T23:56:35

rbpkg_ci

diff --git a/bin/rbpkg_ci b/bin/rbpkg_ci
index 3b5d785..9bb1ee5 100755
--- a/bin/rbpkg_ci
+++ b/bin/rbpkg_ci
@@ -32,9 +32,15 @@ def usage()
 end
 
 def rbpkg_ci
-  clean = false
   case $ARGS[0]
   when "--clean"
+    cmd = "rm -rf #{sh_quote(Rbpkg.ci_dir)}"
+    verbose(1, cmd)
+    raise "command failed: #{cmd.inspect}" unless system(cmd)
+    Rbpkg.ci_init
+    shift
+    exit if $ARGS == []
+  end
     clean = true
     shift
   when "-h"
@@ -49,12 +55,6 @@ def rbpkg_ci
   branch = $ARGS[0] ? shift : nil
   commit = $ARGS[0] ? shift : nil
   usage unless $ARGS == []
-  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 0813da8..ebb80f6 100755
--- a/bin/rbpkg_ci_mux
+++ b/bin/rbpkg_ci_mux
@@ -33,6 +33,7 @@ end
 
 def rbpkg_ci_mux
   clean = false
+  upgrade = false
   while case $ARGS[0]
         when "--clean"
           clean = true
@@ -44,6 +45,7 @@ def rbpkg_ci_mux
         when "--upgrade"
           Rbpkg.upgrade_self
           shift
+          upgrade = true
         end
     true
   end
@@ -58,9 +60,14 @@ def rbpkg_ci_mux
     raise "command failed: #{cmd.inspect}" unless system(cmd)
     Rbpkg.ci_init
     hosts.each do |host|
-      cmd! "ssh #{sh_quote(host)} rbpkg_ci --clean"
+      cmd! "ssh #{sh_quote(host)} rbpkg/bin/rbpkg_ci --clean"
     end
   end      
+  if upgrade
+    hosts.each do |host|
+      cmd! "ssh #{sh_quote(host)} rbpkg/bin/rbpkg upgrade"
+    end
+  end
   hosts.each do |host|
     Thread.report_on_exception = false
     threads << Thread.new do
diff --git a/lib/rbpkg.rb b/lib/rbpkg.rb
index dce21c2..041e605 100644
--- a/lib/rbpkg.rb
+++ b/lib/rbpkg.rb
@@ -45,7 +45,7 @@ module Rbpkg
      ci_log_dir,
      ci_status_dir
     ].each do |d|
-      cmd! "mkdir -p #{sh_quote(d)}"
+      FileUtils.mkdir_p(d)
     end
   end