Hash :
414eebbf
Author :
Thomas de Grivel
Date :
2023-02-25T23:11:54
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
#!/usr/bin/env ruby
load "#{File.dirname(File.dirname(__FILE__))}/lib/rbpkg.rb"
$ARGS = ARGV
def shift
usage if $ARGS == []
arg = $ARGS[0]
$ARGS = $ARGS[1..] || []
arg
end
verbose_level = 2 # print command output
case $ARGS[0]
when "-v"
verbose_level = 3 # print all messages
shift
when "-q"
verbose_level = 1 # print commands
shift
when "-qq"
verbose_level = 0 # print nothing
shift
end
Rbpkg.init("rbpkg", verbose_level, Rbpkg.log_dir, Rbpkg.log_dir)
def usage()
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 :
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
clean-package remove package file
install install package
uninstall uninstall package
upgrade upgrade package
Misc commands :
clean-all clean all files
info show information
"""
exit 1
end
def rbpkg
case shift
when "-h"
usage
when "--help"
usage
when "clone"
Rbpkg.git_clone($ARGS)
when "clean-sources"
Rbpkg.clean_sources($ARGS)
when "fetch"
Rbpkg.fetch($ARGS)
when "pull"
Rbpkg.pull($ARGS)
when "checkout"
branch = shift()
Rbpkg.checkout(branch, $ARGS)
when "configure"
Rbpkg.configure($ARGS)
when "clean-configure"
Rbpkg.clean_configure($ARGS)
when "build"
Rbpkg.build($ARGS)
when "clean-build"
Rbpkg.clean_build($ARGS)
when "test"
Rbpkg.test($ARGS)
when "fake"
Rbpkg.fake($ARGS)
when "clean-fake"
Rbpkg.clean_fake($ARGS)
when "package"
Rbpkg.package($ARGS)
when "clean-package"
Rbpkg.clean_package($ARGS)
when "clean-package"
Rbpkg.clean_package($ARGS)
when "install"
Rbpkg.install($ARGS)
when "uninstall"
Rbpkg.uninstall($ARGS)
when "clean-all"
Rbpkg.clean_all($ARGS)
when "upgrade"
Rbpkg.upgrade($ARGS)
when "info"
Rbpkg.info($ARGS)
else
usage
end
end
begin
rbpkg
Rbpkg::Log.ok_all
rescue => error
verbose(-1, error.backtrace.reverse.join("\n"))
verbose(-1, "#{error.class.name}: #{error.message}")
exit 1
end