Permalink
Browse files

Merge branch 'master' of github.com:akr/chkbuild

  • Loading branch information...
2 parents 82731c8 + 10ea3a9 commit e57ccfe5a4d452ea8cdf0b23dce7fc29501d1255 @akr akr committed May 5, 2012
Showing with 201 additions and 191 deletions.
  1. +1 −2 chkbuild.rb
  2. +31 −22 chkbuild/cvs.rb
  3. +19 −1 chkbuild/gcc.rb
  4. +30 −47 chkbuild/git.rb
  5. +21 −0 chkbuild/hook.rb
  6. +20 −2 chkbuild/ruby.rb
  7. +44 −37 chkbuild/svn.rb
  8. +23 −20 chkbuild/viewvc.rb
  9. +0 −35 chkbuild/xforge.rb
  10. +1 −2 sample/build-gdbm-ruby
  11. +1 −2 sample/build-svn
  12. +8 −4 sample/test-apr
  13. +2 −3 sample/test-co-ruby
  14. +0 −14 sample/test-savannah
View
@@ -29,13 +29,12 @@
require 'chkbuild/main'
require 'chkbuild/config'
require 'chkbuild/lock'
+require 'chkbuild/hook'
require 'chkbuild/cvs'
require 'chkbuild/svn'
require 'chkbuild/git'
require 'chkbuild/viewvc'
-require 'chkbuild/xforge'
require "util"
-require 'chkbuild/hook'
require 'chkbuild/target'
require 'chkbuild/build'
View
@@ -37,11 +37,6 @@ def cvs_internal(cvsroot, mod, branch, opts={})
opts = opts.dup
opts[:section] ||= 'cvs'
working_dir = opts.fetch(:working_dir, mod)
- if opts[:viewvc]||opts[:viewcvs]||opts[:cvsweb]
- viewvc = ChkBuild::ViewVC.new(opts[:viewvc]||opts[:viewcvs]||opts[:cvsweb], opts[:viewvc]==nil)
- else
- viewvc = nil
- end
if !File.exist? "#{ENV['HOME']}/.cvspass"
opts['ENV:CVS_PASSFILE'] = '/dev/null' # avoid warning
end
@@ -52,7 +47,7 @@ def cvs_internal(cvsroot, mod, branch, opts={})
self.run("cvs", "-f", "-z3", "update", "-kb", "-dP", opts2)
}
h2 = cvs_revisions
- cvs_print_revisions(cvsroot, mod, branch, h2, viewvc)
+ cvs_print_revisions(cvsroot, mod, branch, h2)
}
else
if branch
@@ -67,7 +62,7 @@ def cvs_internal(cvsroot, mod, branch, opts={})
}
Dir.chdir(working_dir) {
h2 = cvs_revisions
- cvs_print_revisions(cvsroot, mod, branch, h2, viewvc)
+ cvs_print_revisions(cvsroot, mod, branch, h2)
}
end
end
@@ -103,15 +98,8 @@ def cvs_uri(viewcvs, repository, filename, r1, r2)
uri.to_s
end
- def cvs_print_revisions(cvsroot, mod, branch, h2, viewvc=nil)
+ def cvs_print_revisions(cvsroot, mod, branch, h2)
puts "CHECKOUT cvs #{cvsroot} #{mod} #{branch || ''}"
- if viewvc
- if viewvc.old
- puts "VIEWER ViewCVS #{viewvc.uri}"
- else
- puts "VIEWER ViewVC #{viewvc.uri}"
- end
- end
h2.keys.sort.each {|k|
f = k.flatten.join('/')
cvsroot2, repository2, r2 = h2[k] || [nil, nil, 'none']
@@ -147,10 +135,10 @@ def output_cvs_change_lines(checkout_line, lines1, lines2, out)
mod = $2
branch = $3
branch = nil if branch.empty?
- viewvc = ChkBuild::ViewVC.find_viewvc_line(lines2) # xxx: branch
+ viewer = ChkBuild.find_file_changes_viewer('cvs', "#{cvsroot} #{mod}")
h1 = cvs_restore_file_info(lines1)
h2 = cvs_restore_file_info(lines2)
- cvs_print_changes(mod, h1, h2, viewvc, out)
+ cvs_print_changes(mod, h1, h2, viewer, out)
end
def cvs_restore_file_info(lines)
@@ -164,7 +152,7 @@ def cvs_restore_file_info(lines)
h
end
- def cvs_print_changes(mod, h1, h2, viewvc, out)
+ def cvs_print_changes(mod, h1, h2, viewer, out)
(h1.keys | h2.keys).sort.each {|f|
r1 = h1[f] || 'none'
r2 = h2[f] || 'none'
@@ -177,13 +165,13 @@ def cvs_print_changes(mod, h1, h2, viewvc, out)
line = "CHG"
end
line << " #{f}\t#{r1}->#{r2}"
- if viewvc
+ if viewer
if r1 == 'none'
- uri = viewvc.markup_uri(mod, f, r2)
+ uri = viewer.markup_uri(nil, f, r2)
elsif r2 == 'none'
- uri = viewvc.markup_uri(mod, f, r1)
+ uri = viewer.markup_uri(nil, f, r1)
else
- uri = viewvc.diff_uri(mod, f, r1, r2)
+ uri = viewer.diff_uri(nil, f, r1, r2)
end
line << "\t" << uri
end
@@ -192,3 +180,24 @@ def cvs_print_changes(mod, h1, h2, viewvc, out)
}
end
end
+
+
+# segment = *pchar
+# pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
+# unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
+# pct-encoded = "%" HEXDIG HEXDIG
+# sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
+# / "*" / "+" / "," / ";" / "="
+segment_regexp = '(?:[A-Za-z0-9\-._~!$&\'()*+,;=:@]|%[0-9A-Fa-f][0-9A-Fa-f])*'
+
+ChkBuild.define_file_changes_viewer('cvs',
+ %r{\A:pserver:anonymous@puszcza\.gnu\.org\.ua:/cvsroot/(#{segment_regexp}) (#{segment_regexp}(/#{segment_regexp})*)?\z}o) {
+ |match, reptype, pat, checkout_line|
+ # :pserver:anonymous@puszcza.gnu.org.ua:/cvsroot/gdbm gdbm
+ # http://puszcza.gnu.org.ua/viewvc/gdbm/
+
+ project = match[1]
+ mod = match[2]
+ ChkBuild::ViewVC.new("http://puszcza.gnu.org.ua/viewvc/#{project}/?diff_format=u", false, mod)
+}
+
View
@@ -137,7 +137,6 @@ def (ChkBuild::GCC::CompleteOptions).call(target_opts)
ChkBuild::GCC.remove_symlink("gcc/mpfr")
ChkBuild::GCC.remove_symlink("gcc/mpc")
b.svn("svn://gcc.gnu.org/svn/gcc", gcc_branch, 'gcc',
- :viewvc=>"http://gcc.gnu.org/viewcvs",
:output_interval_timeout => '30min')
b.svn_info('gcc')
ChkBuild::GCC.download_lib(b, ChkBuild::GCC::URL_GMP, "gcc/gmp") if opts[:build_gmp]
@@ -192,3 +191,22 @@ def (ChkBuild::GCC::CompleteOptions).call(target_opts)
'gcc version ...'
}
+# segment = *pchar
+# pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
+# unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
+# pct-encoded = "%" HEXDIG HEXDIG
+# sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
+# / "*" / "+" / "," / ";" / "="
+segment_regexp = '(?:[A-Za-z0-9\-._~!$&\'()*+,;=:@]|%[0-9A-Fa-f][0-9A-Fa-f])*'
+
+ChkBuild.define_file_changes_viewer('svn',
+ %r{\Asvn://gcc\.gnu\.org/svn/gcc (#{segment_regexp}(/#{segment_regexp})*)?\z}o) {
+ |match, reptype, pat, checkout_line|
+ # svn://gcc.gnu.org/svn/gcc
+ # http://gcc.gnu.org/viewcvs
+
+ mod = match[1]
+ mod = nil if mod && mod.empty?
+ ChkBuild::ViewVC.new('http://gcc.gnu.org/viewcvs', false, mod)
+}
+
View
@@ -130,7 +130,6 @@ def git_internal(cloneurl, working_dir, opts={})
puts "LASTLOG #{line}"
}
puts "CHECKOUT git #{cloneurl} #{working_dir}"
- puts "VIEWER #{viewer[0]} #{viewer[1]}" if viewer
puts "LASTCOMMIT #{new_head}"
}
end
@@ -258,12 +257,6 @@ def call(hash)
end
end
- GIT_VIEWERS = {
- 'GitHub' => GitHub,
- 'GitWeb' => GitWeb,
- 'cgit' => Cgit,
- }
-
def git_print_logs(logs, urigen, out)
logs.each {|commit_hash, title_line|
if urigen
@@ -283,21 +276,7 @@ def output_git_change_lines(checkout_line, lines1, lines2, out)
end
cloneurl = $1
working_dir = $2
- viewer = nil
- viewer_line_pattern = /\AVIEWER\s+(#{Regexp.union GIT_VIEWERS.keys})\s+(\S+)/
- lines2.each {|line|
- if viewer_line_pattern =~ line
- viewer = [$1, $2]
- break
- end
- }
- if !viewer
- viewer = git_find_viewer(cloneurl)
- end
- if viewer
- urigen_class = GIT_VIEWERS[viewer[0]]
- urigen = urigen_class.new(viewer[1])
- end
+ urigen = ChkBuild.find_file_changes_viewer('git', cloneurl)
lastcommit1 = lines1.find {|line| /\ALASTCOMMIT / =~ line }
lastrev1 = $1 if lastcommit1 && /\ALASTCOMMIT ([0-9a-fA-F]+)/ =~ lastcommit1
@@ -314,30 +293,34 @@ def output_git_change_lines(checkout_line, lines1, lines2, out)
git_print_logs(logs, urigen, out)
}
end
+end
- # find a viewer for major source code hosting sites.
- def git_find_viewer(cloneurl)
- # segment = *pchar
- # pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
- # unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
- # pct-encoded = "%" HEXDIG HEXDIG
- # sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
- # / "*" / "+" / "," / ";" / "="
- segment_regexp = '(?:[A-Za-z0-9\-._~!$&\'()*+,;=:@]|%[0-9A-Fa-f][0-9A-Fa-f])*'
- if %r{\Agit://github\.com/(#{segment_regexp})/(#{segment_regexp})\.git\z}o =~ cloneurl
- user = $1
- project = $1
- return ['GitHub', "https://github.com/#{user}/#{project}"]
- elsif %r{\Agit://git\.savannah\.gnu\.org/(#{segment_regexp})\.git\z}o =~ cloneurl
- project_basename = $1
- # git://git.savannah.gnu.org/autoconf.git
- # http://git.savannah.gnu.org/cgit/autoconf.git
- # http://git.savannah.gnu.org/gitweb/?p=autoconf.git
- return ['cgit', "http://git.savannah.gnu.org/cgit/#{project_basename}.git"]
- # project_basename = CGI.escape(CGI.unescape($1)) # segment to query component
- # return ['GitWeb', "http://git.savannah.gnu.org/gitweb/?p=#{project_basename}.git"]
- end
- nil
- end
+# segment = *pchar
+# pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
+# unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
+# pct-encoded = "%" HEXDIG HEXDIG
+# sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
+# / "*" / "+" / "," / ";" / "="
+segment_regexp = '(?:[A-Za-z0-9\-._~!$&\'()*+,;=:@]|%[0-9A-Fa-f][0-9A-Fa-f])*'
-end
+ChkBuild.define_file_changes_viewer('git',
+ %r{\Agit://github\.com/(#{segment_regexp})/(#{segment_regexp})\.git\z}o) {
+ |match, reptype, pat, checkout_line|
+ user = match[1]
+ project = match[2]
+ ChkBuild::Build::GitHub.new("https://github.com/#{user}/#{project}")
+}
+
+ChkBuild.define_file_changes_viewer('git',
+ %r{\Agit://(?:git\.savannah\.gnu\.org|git\.sv\.gnu\.org)/(#{segment_regexp})\.git\z}o) {
+ |match, reptype, pat, checkout_line|
+ # git://git.savannah.gnu.org/autoconf.git
+ # http://git.savannah.gnu.org/cgit/autoconf.git
+ project_basename = match[1]
+ ChkBuild::Build::Cgit.new("http://git.savannah.gnu.org/cgit/#{project_basename}.git")
+
+ # # GitWeb:
+ # # http://git.savannah.gnu.org/gitweb/?p=autoconf.git
+ # project_basename = CGI.escape(CGI.unescape($1)) # segment to query component
+ # ChkBuild::Build::GitWeb.new("http://git.savannah.gnu.org/gitweb/?p=#{project_basename}.git")
+}
View
@@ -232,5 +232,26 @@ def ChkBuild.diff_preprocess_sort_pattern(target_name)
/\A#{Regexp.union(*@diff_preprocess_sort_patterns_hash[target_name])}/
end
end
+
+ @file_changes_viewer_hash = {}
+ def ChkBuild.define_file_changes_viewer(reptype, pat, &block)
+ @file_changes_viewer_hash[reptype] ||= []
+ @file_changes_viewer_hash[reptype] << [pat, block]
+ end
+ def ChkBuild.find_file_changes_viewer(reptype, reploc)
+ assoc = @file_changes_viewer_hash[reptype]
+ return nil if !assoc
+ assoc.each {|pat, block|
+ if pat.respond_to? :match
+ m = pat.match(reploc)
+ else
+ m = pat == reploc
+ end
+ if m
+ return block.call(m, reptype, pat, reploc)
+ end
+ }
+ nil
+ end
end
View
@@ -288,8 +288,7 @@ def (ChkBuild::Ruby::CompleteOptions).merge_dependencies(opts, dep_dirs)
srcdir = (checkout_dir+'ruby').relative_path_from(objdir)
Dir.chdir(checkout_dir)
- b.svn("http://svn.ruby-lang.org/repos/ruby", ruby_branch, 'ruby',
- :viewvc=>'http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?diff_format=u')
+ b.svn("http://svn.ruby-lang.org/repos/ruby", ruby_branch, 'ruby')
b.svn_info('ruby')
svn_info_section = b.logfile.get_section('svn-info/ruby')
ruby_svn_rev = svn_info_section[/Last Changed Rev: (\d+)/, 1].to_i
@@ -831,3 +830,22 @@ def (ChkBuild::Ruby::CompleteOptions).merge_dependencies(opts, dep_dirs)
"#{match[1]}<digest>"
}
+# segment = *pchar
+# pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
+# unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
+# pct-encoded = "%" HEXDIG HEXDIG
+# sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
+# / "*" / "+" / "," / ";" / "="
+segment_regexp = '(?:[A-Za-z0-9\-._~!$&\'()*+,;=:@]|%[0-9A-Fa-f][0-9A-Fa-f])*'
+
+ChkBuild.define_file_changes_viewer('svn',
+ %r{\Ahttp://svn\.ruby-lang\.org/repos/ruby (#{segment_regexp}(/#{segment_regexp})*)?\z}o) {
+ |match, reptype, pat, checkout_line|
+ # http://svn.ruby-lang.org/repos/ruby
+ # http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?diff_format=u
+
+ mod = match[1]
+ mod = nil if mod && mod.empty?
+ ChkBuild::ViewVC.new('http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?diff_format=u', false, mod)
+}
+
Oops, something went wrong.

0 comments on commit e57ccfe

Please sign in to comment.