From 38caf64938ef26c2c32c11fcb2c1e1263f81346d Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 20 Aug 2014 18:31:17 -0400 Subject: rbuild, gem build a selected tagged sisu version --- rbuild | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) (limited to 'rbuild') diff --git a/rbuild b/rbuild index ab2e040a..261c5256 100644 --- a/rbuild +++ b/rbuild @@ -333,6 +333,46 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_#{vi[:version]}.orig.tar.xz end self end +module GitExtractTaggedVersionBuild + def upstream + system(%{ git checkout upstream }) + end + def self.git_tagged_versions(vb=nil) + if vb.tag + v=if vb.tag =~/sisu_[0-9](?:\.[0-9]){0,2}$/ then vb.tag + elsif vb.tag =~/^[0-9](?:\.[0-9]){0,2}$/ then 'sisu_' + vb.tag + else 'sisu_' + end + system(%{ git tag -l | ag --nocolor '^#{v}' }) + end + end + def self.git_checkout_and_build_version(vb) + begin + ver=if vb.tag =~/sisu_[0-9]\.[0-9]+\.[0-9]+/ then vb.tag + elsif vb.tag =~/^[0-9]\.[0-9]+\.[0-9]+/ then 'sisu_' + vb.tag + else vb.branch + end + install_branch=case vb.branch + when /^(?:stable|unstable)$/ + "gem_create_build_install_#{vb.branch}" + when /^(?:all)/ + 'gem_create_build_install' + else + 'gem_create_build_install_stable' + end + commands =<<-WOK + git checkout #{ver} && + rake #{install_branch}; + WOK + puts commands + system(commands) + ensure + system(%{ + git checkout upstream + }) + end + end +end module Gemspecs def self.info(vi) puts <<-WOK @@ -691,6 +731,29 @@ desc 'Help' #desc "Setup/Install #{Project_details.name} (uses filelist)" task :install => [:default_notice,:project] task :install_bin => [:setup_bin_] +#desc "search for a version tag e.g. 'tag[5.6.0]'" + task :tag, [:tag] do |t, args| + args.with_defaults(:tag => Version_info::Next.setting_stable[:version]) + puts "Check for Version Tag: #{args.tag}" + print "Version Tag: " + GitExtractTaggedVersionBuild::git_tagged_versions(args) + end +#desc "build and install a specific git tagged version of sisu, e.g. 'build[5.6.0]'" + task :build, [:tag, :branch] => :done do |t, args| + args.with_defaults(:tag => '5.6.0', :branch => 'stable') + puts "Version Tag: #{args.tag}" + puts "Branch: #{args.branch}" + GitExtractTaggedVersionBuild::git_tagged_versions(args.tag) + ans= <<-WOK + Gem Install SiSU Version + WOK + resp=Utils.answer?(ans) + exit unless resp + GitExtractTaggedVersionBuild::git_checkout_and_build_version(args) + end + task :done do + puts 'done' + end #%% setup/install tasks task :rant_independence do #notice resp='' -- cgit v1.2.3