diff --git a/lib/rbpkg.rb b/lib/rbpkg.rb
index 86ade04..00b0da4 100644
--- a/lib/rbpkg.rb
+++ b/lib/rbpkg.rb
@@ -300,9 +300,14 @@ module Rbpkg
end
def self.upgrade_self
+ verbose 3, "Rbpkg.upgrade_self"
cmd! "cd #{sh_quote(dir)} && git pull"
load "#{dir}/lib/rbpkg.rb"
end
+
+ def self.verbose_level
+ @@verbose_level
+ end
end
def cmd(string)
@@ -310,7 +315,7 @@ def cmd(string)
IO.popen("#{string} 2>&1", "r") do |pipe|
while line = pipe.gets()
$log.puts line
- puts line
+ puts line if Rbpkg.verbose_level > 1
end
pipe.close
$?.success?
@@ -337,11 +342,12 @@ def verbose(level, msg)
colored = case level
when 1
"\33[0;34m#{msg}\33[0m\n"
- when 2
+ when 3
"\33[0;35m#{msg}\33[0m\n"
else
- raise "unknown verbose level: #{level}"
+ raise "unknown verbose level: #{level.inspect}"
end
$log.puts colored
- puts colored
+ puts colored if level <= Rbpkg.verbose_level
+
end
diff --git a/lib/rbpkg/repo.rb b/lib/rbpkg/repo.rb
index 5b15482..1753b4f 100644
--- a/lib/rbpkg/repo.rb
+++ b/lib/rbpkg/repo.rb
@@ -6,6 +6,7 @@ class Rbpkg::Repo
@@branch_default = "master"
def autogen()
+ verbose 3, "repo(#{name}).autogen"
if File.executable?("#{src_dir}/autogen")
cmd! "cd #{sh_quote(src_dir)} && ./autogen"
elsif File.exists?("#{src_dir}/autogen.sh")
@@ -18,6 +19,7 @@ class Rbpkg::Repo
end
def build
+ verbose 3, "repo(#{name}).build"
if ! tag_present?("build-done")
configure()
if File.file?("#{src_dir}/Makefile")
@@ -30,11 +32,13 @@ class Rbpkg::Repo
end
def checkout(branch)
+ verbose 3, "repo(#{name}).checkout"
sh_branch=sh_quote(branch)
cmd! "cd #{sh_quote(src_dir!)} && git fetch #{sh_quote(remote)} #{sh_branch} && git checkout #{sh_branch} && git submodule update"
end
def clean_all
+ verbose 3, "repo(#{name}).clean_all"
clean_fake
clean_build
clean_configure
@@ -42,6 +46,7 @@ class Rbpkg::Repo
end
def clean_build
+ verbose 3, "repo(#{name}).clean_build"
if File.file?("#{src_dir}/Makefile")
cmd! "cd #{sh_quote(src_dir)} && make clean"
end
@@ -52,16 +57,19 @@ class Rbpkg::Repo
end
def clean_configure
+ verbose 3, "repo(#{name}).clean_configure"
tag_remove("configure-done")
end
def clean_fake
+ verbose 3, "repo(#{name}).clean_fake"
if File.directory?(fake_dir)
cmd! "rm -rf #{sh_quote(fake_dir)}"
end
end
def clean_package
+ verbose 3, "repo(#{name}).clean_package"
if File.file?(package_checksum)
cmd! "rm #{sh_quote(package_checksum)}"
end
@@ -80,6 +88,7 @@ class Rbpkg::Repo
end
def clean_sources
+ verbose 3, "repo(#{name}).clean_sources"
tag_remove("build-done") if tag_present?("build-done")
tag_remove("configure-done") if tag_present?("configure-done")
if File.directory?(src_dir)
@@ -91,6 +100,7 @@ class Rbpkg::Repo
end
def configure
+ verbose 3, "repo(#{name}).configure"
if ! File.directory?(src_dir)
git_clone()
end
@@ -117,6 +127,7 @@ class Rbpkg::Repo
end
def fake
+ verbose 3, "repo(#{name}).fake"
build()
if File.directory?(fake_dir)
cmd! "rm -rf #{sh_quote(fake_dir)}"
@@ -134,10 +145,12 @@ class Rbpkg::Repo
end
def fetch
+ verbose 3, "repo(#{name}).fetch"
cmd! "cd #{sh_quote(src_dir!)} && git fetch"
end
def git_clone
+ verbose 3, "repo(#{name}).git_clone"
if File.directory?(src_dir)
false
else
@@ -188,6 +201,7 @@ class Rbpkg::Repo
end
def install
+ verbose 3, "repo(#{name}).install"
return if system_package?
return if installed?
install_dependencies
@@ -209,6 +223,7 @@ class Rbpkg::Repo
end
def install_dependencies
+ verbose 3, "repo(#{name}).install_dependencies"
if dependencies
Rbpkg.install(dependencies)
end
@@ -247,6 +262,7 @@ class Rbpkg::Repo
end
def package
+ verbose 3, "repo(#{name}).package"
return if File.file?(package_tar_bz2) &&
File.file?(package_tar_gz) &&
File.file?(package_tar_xz)
@@ -305,6 +321,7 @@ class Rbpkg::Repo
end
def pull
+ verbose 3, "repo(#{name}).pull"
cmd! "cd #{sh_quote(src_dir!)} && git pull && git submodule update"
end
@@ -344,12 +361,14 @@ class Rbpkg::Repo
end
def tag_set(tag)
+ verbose 3, "repo(#{name}).tag_set(#{tag})"
raise "tag already set" if tag_present?(tag)
FileUtils.mkdir_p tag_dir unless File.directory?(tag_dir)
File.write(tag_path(tag), "#{Rbpkg.date}\n")
end
def test
+ verbose 3, "repo(#{name}).test"
build()
if File.file?("#{src_dir}/Makefile")
cmd! "cd #{sh_quote(src_dir)} && make #{sh_quote(test_make_rule)}"
@@ -361,6 +380,7 @@ class Rbpkg::Repo
end
def uninstall
+ verbose 3, "repo(#{name}).uninstall"
if installed?
File.open(installed, "r") do |input|
while line = input.gets
@@ -381,6 +401,7 @@ class Rbpkg::Repo
end
def upgrade
+ verbose 3, "repo(#{name}).upgrade"
pull
return if installed_version == version
package