Commit a2dfc05f0e7d6259416a591e4bf32014a128a1f0

Thomas de Grivel 2023-02-20T16:27:44

usage

diff --git a/bin/rbpkg b/bin/rbpkg
index b69f8bc..8152086 100755
--- a/bin/rbpkg
+++ b/bin/rbpkg
@@ -9,11 +9,32 @@ $log = File.open(log_path, "w")
 #verbose 2, "Logging to #{log_path}"
 
 def usage()
-  STDERR.puts """Usage: #{File.basename($0)} COMMAND PKG ...
+  STDERR.puts """Usage: #{File.basename($0)} COMMAND REPO ...
 
 Source directory commands :
  clone            shortcut for git clone
  clean-sources    remove source directory
+ fetch           -shortcut for git fetch
+ pull            -shortcut for git pull
+ checkout TREE   -shortcut for git checkout
+
+Build commands :
+ autogen         -post checkout command usually named autogen
+ configure       -configure build for this system
+ clean-configure -remove configure-done tag file
+ build           -run parallel build
+ clean-build     -remove object files
+ test            -run tests
+
+Package commands : 
+ fake            -install into fake installation directory
+ clean-fake      -remove fake installation directory
+ package         -build package file for the checked out version
+ install         -install package
+ uninstall       -uninstall package
+
+Misc commands :
+ info            -show info about a repo
 """
   exit 1
 end
diff --git a/lib/rbpkg.rb b/lib/rbpkg.rb
index 57d8419..80a54ee 100644
--- a/lib/rbpkg.rb
+++ b/lib/rbpkg.rb
@@ -62,7 +62,7 @@ module Rbpkg
   end
 
   def self.log_path(name)
-    "#{log_dir}/#{name}_#{$$}_#{date}.log"
+    "#{log_dir}/#{name}_#{date}_#{$$}.log"
   end
 
   def self.src_dir
@@ -72,7 +72,7 @@ end
 
 def cmd(string)
   verbose(1, string)
-  IO.popen(string, "r") do |pipe|
+  IO.popen("#{string} 2>&1", "r") do |pipe|
     while line = pipe.gets()
       $log.puts line
       puts line
@@ -91,10 +91,14 @@ def sh_quote (str)
 end
       
 def verbose(level, msg)
-  case level
-  when 1
-    puts "\33[0;34m#{msg}\33[0m\n"
-  when 2
-    puts "\33[0;35m#{msg}\33[0m\n"
-  end
+  colored = case level
+            when 1
+              "\33[0;34m#{msg}\33[0m\n"
+            when 2
+              "\33[0;35m#{msg}\33[0m\n"
+            else
+              raise "unknown verbose level: #{level}"
+            end
+  $log.puts colored
+  puts colored
 end