From da5e7ffe9b6b76f965d3ec01b4bef0c99b7f1955 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 2 Dec 2013 23:30:51 -0500 Subject: v4 v5: rake create build & install sisu gemspec; bin/sisugem (add .gitignore) * rake gemcbi #(create build install sisu gem) * rake gemspecscreate && \ rake gembuild && \ sudo rake geminstall * rake gemspecscreate && \ gem build sisu5.gemspec && \ sudo gem install --no-rdoc --no-ri \ sisu-5.1.0.gem * bin/sisu updated (modified to take account of gems) * bin/sisugem added * .gitignore sisu-*.gem sisu*.gemspec consider inclusion (& tracking) of rake created sisu4.gemspec sisu5.gemspec (as this makes their availability more obvious) * once gem is installed: "sisu _5.1.0_ -vM" (to see version, commands otherwise as usual) if paths are such that sisu is not available "sisugem _5.1.0_ -vM" should work (as it is installed by gemspec, but not other sisu installers) --- rbuild | 293 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 279 insertions(+), 14 deletions(-) (limited to 'rbuild') diff --git a/rbuild b/rbuild index 084d3ad7..f2cc6638 100644 --- a/rbuild +++ b/rbuild @@ -147,15 +147,17 @@ def chmod_util(place) end end #%% using a directory and its mapping -def setup_find_create(dir_get,dir_put) #primary, +def setup_find_create(dir_get,dir_put,exclude_files=['']) #primary, Find.find("#{@p.dir.pwd}/#{dir_get}") do |f| stub=f.scan(/#{@p.dir.pwd}\/#{dir_get}\/(\S+)/).join place="#{dir_put}/#{stub}" action=case when File.file?(f) - cp(f,place) - chmod_file(place) - "-> #{dir_put}/" + unless f =~/#{exclude_files.inspect}/ + cp(f,place) + chmod_file(place) + "-> #{dir_put}/" + end when File.directory?(f) FileUtils.mkpath(place) unless FileTest.directory?(place) "./#{dir_get}/" @@ -202,6 +204,212 @@ def system_info WOK end +def sisu_version_info + def version_file + def v4 + 'data/sisu/v4/v/version.yml' + #"#{Dir.pwd}/data/sisu/v4/v/version.yml" + end + def v5 + 'data/sisu/v5/v/version.yml' + end + self + end + def v4 + v="#{Dir.pwd}/#{version_file.v4}" + if File.exist?(v) + YAML::load(File::open(v)) + else '' + end + end + def v5 + v="#{Dir.pwd}/#{version_file.v5}" + if File.exist?(v) + YAML::load(File::open(v)) + else '' + end + end + def current + puts v4 + puts v5 + end + def system_date + `date "+%Y-%m-%d"`.strip + end + def system_date_stamp + `date "+%Yw%W/%u"`.strip + end + def set + def v4 + { + project: 'SiSU', + version: '4.2.13', + date: "#{system_date}", + date_stamp: "#{system_date_stamp}", + } + end + def v5 + { + project: 'SiSU', + version: '5.0.26', + date: "#{system_date}", + date_stamp: "#{system_date_stamp}", + } + end + def version_info_commit(filename,versioninfo,newversioninfo,existingversioninfo,version_file_is) + ans=%{update sisu version info replacing: + #{existingversioninfo.sort} +with: + #{newversioninfo.sort} + +#{version_file_is} becoming: +#{versioninfo} +proceed? } + resp=answer?(ans) + exit unless resp + fn="#{Dir.pwd}/#{filename}" + if File.writable?("#{Dir.pwd}/.") + file_version=File.new(fn,'w+') + file_version << versioninfo + file_version.close + else + puts %{*WARN* is the file or directory writable? could not create #{filename}} + end + end + def commit_v4 + versioninfo= <<-WOK +--- +:version: #{sisu_version_info.v4[:version]} +:date_stamp: #{sisu_version_info.v4[:date_stamp]} +:date: "#{sisu_version_info.v4[:date]}" +:project: #{sisu_version_info.v4[:project]} + WOK + puts version_file.v4 + version_info_commit(version_file.v4,versioninfo,set.v4,sisu_version_info.v4,version_file.v4) + end + def commit_v5 + versioninfo= <<-WOK +--- +:version: #{sisu_version_info.v5[:version]} +:date_stamp: #{sisu_version_info.v5[:date_stamp]} +:date: "#{sisu_version_info.v5[:date]}" +:project: #{sisu_version_info.v5[:project]} + WOK + puts version_file.v5 + version_info_commit(version_file.v5,versioninfo,set.v5,sisu_version_info.v5,version_file.v5) + end + def date_info + end + def changelog_header + def v4 + <<-WOK +%% #{sisu_version_info.v4[:version]}.orig.tar.xz (#{sisu_version_info.v4[:date]}:#{sisu_version_info.v4[:date_stamp]}) +http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_#{sisu_version_info.v4[:version]} +http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_#{sisu_version_info.v4[:version]}-1 +http://www.jus.uio.no/sisu/pkg/src/sisu_#{sisu_version_info.v4[:version]}.orig.tar.xz + sisu_#{sisu_version_info.v4[:version]}.orig.tar.xz + sisu_#{sisu_version_info.v4[:version]}-1.dsc + WOK + end + def v5 + <<-WOK +%% #{sisu_version_info.v5[:version]}.orig.tar.xz (#{sisu_version_info.v5[:date]}:#{sisu_version_info.v5[:date_stamp]}) +http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_#{sisu_version_info.v5[:version]} +http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_#{sisu_version_info.v5[:version]}-1 +http://www.jus.uio.no/sisu/pkg/src/sisu_#{sisu_version_info.v5[:version]}.orig.tar.xz + sisu_#{sisu_version_info.v5[:version]}.orig.tar.xz + sisu_#{sisu_version_info.v5[:version]}-1.dsc + WOK + end + self + end + self + end + self +end +def version_update_manual + puts 'date: ' + `date "+%Y-%m-%d"` + puts 'date_stamp: ' + `date "+%Yw%W/%u"` +end +def gemspecs + def sisu4 + <<-WOK +Gem::Specification.new do |s| + s.name = '#{sisu_version_info.v4[:project].downcase}' + s.version = '#{sisu_version_info.v4[:version]}' + s.date = '#{sisu_version_info.v4[:date]}' + s.summary = '#{sisu_version_info.v4[:project]}' + s.description = 'SiSU gem' + s.authors = ["Ralph Amissah"] + s.email = 'ralph.amissah@gmail.com' + s.files = Dir['lib/sisu/v4/*.rb'] + + Dir['lib/sisu/v5/*.rb'] + + Dir['data/sisu/v4/v/version.yml'] + + Dir['data/sisu/v5/v/version.yml'] + + Dir['bin/sisugem'] + + Dir['bin/sisu'] + s.license = 'GPL3' + s.executables << 'sisugem' << 'sisu' +end + WOK + end + def sisu5 + <<-WOK +Gem::Specification.new do |s| + s.name = '#{sisu_version_info.v5[:project].downcase}' + s.version = '#{sisu_version_info.v5[:version]}' + s.date = '#{sisu_version_info.v5[:date]}' + s.summary = '#{sisu_version_info.v5[:project]}' + s.description = 'SiSU gem' + s.authors = ["Ralph Amissah"] + s.email = 'ralph.amissah@gmail.com' + s.files = Dir['lib/sisu/v4/*.rb'] + + Dir['lib/sisu/v5/*.rb'] + + Dir['data/sisu/v4/v/version.yml'] + + Dir['data/sisu/v5/v/version.yml'] + + Dir['bin/sisugem'] + + Dir['bin/sisu'] + s.license = 'GPL3' + s.executables << 'sisugem' << 'sisu' +end + WOK + end + def gemspec_create(filename,gemspec) + fn="#{Dir.pwd}/#{filename}" + if File.writable?("#{Dir.pwd}/.") + file_sisu_gemspec=File.new(fn,'w+') + file_sisu_gemspec << gemspec + file_sisu_gemspec.close + else + puts %{*WARN* is the file or directory writable? could not create #{filename}} + end + end + def sisu4_gemspec_create + filename='sisu4.gemspec' + gemspec_create(filename,sisu4) + end + def sisu5_gemspec_create + filename='sisu5.gemspec' + gemspec_create(filename,sisu5) + end + def sisu4_build + system(%{ gem build sisu4.gemspec }) + end + def sisu5_build + system(%{ gem build sisu5.gemspec }) + end + def sisu4_install + system(%{ + sudo gem install --no-rdoc --no-ri --verbose sisu-#{sisu_version_info.v4[:version]}.gem + }) + end + def sisu5_install + system(%{ + sudo gem install --no-rdoc --no-ri --verbose sisu-#{sisu_version_info.v5[:version]}.gem + }) + end + self +end def project_help puts < [:default_notice,:setup_base] #task :default => [:help,:notice,:project] desc "Setup/Install #{@p.name} and try generate a file" @@ -248,6 +456,24 @@ desc "Setup/Install #{@p.name}: bin, lib and conf (no data)" task :setup_base=> [:setup_bin,:setup_lib,:setup_conf,:setup_share,:setup_man,:setup_vim] desc "Setup/Install #{@p.name} bin, lib and conf (no data and no attempt to do postinstall setup)" task :base=> [:setup_base] +desc "check package version" +task :sisuversion => [:sisu_version] +desc "set package version" +task :sisuversionset => [:sisu_version_set] +desc "check gempsec info" +task :gemspec => [:gemspec_info] +desc "create gempsec" +task :gemspecscreate => [:gemspecs_create] +desc "build gem" +task :gembuild => [:gem_build] +desc "install gem" +task :geminstall => [:gem_install] +desc "build and install gem" +task :gembuildinstall => [:gem_build,:gem_install] +desc "create, build and install sisu gem" +task :gemcbi => [:gemspecs_create,:gem_build,:gem_install] +desc "check changelog headers" +task :changelogheaders => [:changelog_headers] if File.directory?('bin') #bin desc "Setup #{@p.name} bin only, synonym :bin" task :bin => [:setup_bin] @@ -297,10 +523,6 @@ if File.directory?('conf') #conf desc "Remove #{@p.name} conf only" #remove conf task :remove_conf => [:remove_conf] end -#if File.directory?('data') #data -# desc "Remove #{@p.name} data only" #remove data -# task :remove_data => [:remove_data] -#end desc "Re-setup #{@p.name}, synonym :reinstall" #resetup reinstall task :resetup => [:remove, :setup] task :reinstall => [:remove, :setup] @@ -345,8 +567,6 @@ task :help => [:project_help,:system_info,:tasks] #desc "Setup/Install #{@p.name} (uses filelist)" task :install => [:default_notice,:project] task :install_bin => [:setup_bin] -desc '[make rant independent install file]' -task :create_rant_independent_task_file => [:rant_independence] #%% setup/install tasks task :rant_independence do #notice resp='' @@ -381,7 +601,8 @@ task :default2 do #secondary setup_find_cp_r('man',@p.dir.man) if File.directory?('man') end task :setup_bin do #bin - setup_find_create('bin',@p.dir.bin) if File.directory?('bin') + exclude_files=['sisugem'] + setup_find_create('bin',@p.dir.bin,exclude_files) if File.directory?('bin') end task :setup_lib do #lib setup_find_create('lib',@p.dir.lib) if File.directory?('lib') @@ -401,6 +622,50 @@ task :setup_man do #man end task :setup_vim do #man setup_find_create('data/vim',@p.dir.vim) if File.directory?('data/vim') #man pages +end +task :gemspec_info do #man + version_update_manual + gemspecs.sisu4 + gemspecs.sisu5 +end +task :gemspecs_create do #man + gemspecs.sisu4_gemspec_create + gemspecs.sisu5_gemspec_create +end +task :gem_build do #man + gemspecs.sisu4_build + gemspecs.sisu5_build +end +task :gem_install do #man + gemspecs.sisu4_install + gemspecs.sisu5_install +end +task :changelog_headers do #man + puts '---' + puts sisu_version_info.set.changelog_header.v4 + puts '---' + puts sisu_version_info.set.changelog_header.v5 +end +task :sisu_version do #man + puts sisu_version_info.set.v4 + puts sisu_version_info.set.v5 + puts sisu_version_info.current + #version.current.each do |x| + # puts x + #end + puts sisu_version_info.v4[:project] + puts sisu_version_info.v4[:version] + puts sisu_version_info.v4[:date] + puts sisu_version_info.v4[:date_stamp] + puts '---' + puts sisu_version_info.v5[:project] + puts sisu_version_info.v5[:version] + puts sisu_version_info.v5[:date] + puts sisu_version_info.v5[:date_stamp] +end +task :sisu_version_set do #man + sisu_version_info.set.commit_v4 + sisu_version_info.set.commit_v5 end #%% post install #%% clobber/remove tasks -- cgit v1.2.3