From ee8b3b228aab41b76bb290af6a7afcc2b13445a7 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 6 May 2015 15:46:25 -0400 Subject: qi (quick install) cleaning --- setup/qi_libs.rb | 30 ++--- setup/qi_libs_base.rb | 314 -------------------------------------------------- setup/rbuild_libs.rb | 2 +- setup/sisu_version.rb | 2 +- 4 files changed, 18 insertions(+), 330 deletions(-) delete mode 100644 setup/qi_libs_base.rb (limited to 'setup') diff --git a/setup/qi_libs.rb b/setup/qi_libs.rb index 6dc2fcfa..5f325302 100644 --- a/setup/qi_libs.rb +++ b/setup/qi_libs.rb @@ -1,6 +1,5 @@ -require_relative 'qi_libs_base' +require_relative 'sisu_version' module Project_details - require_relative 'sisu_version' include SiSUversion def self.name 'SiSU' @@ -228,6 +227,9 @@ module Version_info else nil end end + def self.version_number(vi) + vi[:version] + end def self.version_number_use(vi) (git_version_extract.nil?) \ ? (vi[:version]) @@ -267,6 +269,9 @@ module Version_info match(hsh[:version])[1] hsh end + def self.version_number + Version_info::Current.setting_stable[:version_number] + end def self.content_stable Version_info.contents(setting_stable) end @@ -281,7 +286,7 @@ module Version_info } end def self.setting_stable - settings(SiSU_version_next_stable) + settings(SiSU_version) end def self.content_stable(rel) Version_info.contents(setting_stable,rel) @@ -384,10 +389,8 @@ proceed? } def self.changelog_header(vi) vn=version_number(vi) <<-WOK -** #{vn}.orig.tar.xz (#{vi[:date]}:#{vi[:date_stamp].gsub(/20\d\dw/,'')}) -http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/sisu_#{vn} -http://www.jus.uio.no/sisu/pkg/src/sisu_#{vn}.orig.tar.xz - sisu_#{vn}.orig.tar.xz +* sisu_#{vn}.orig.tar.xz (#{vi[:date]}:#{vi[:date_stamp].gsub(/20\d\dw/,'')}) + http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/sisu_#{vn} WOK end def self.changelog_header_release(filename,ch,vi) @@ -401,8 +404,8 @@ proceed? } if File.writable?(fn) changelog_arr_current = IO.readlines(fn) changelog_arr_next=changelog_arr_current.each.map do |line| - if line =~/^\*\* [0-9]+\.[0-9]+\.[0-9]+(?:_pre_rel)?\.orig\.tar\.xz \(Open commit window: [0-9]{4}-[0-9]{2}-[0-9]{2}; Pre-Release\)\)$/ - "** #{vi[:version]}.orig.tar.xz " \ + if line =~/^\*\s+sisu_[0-9]+\.[0-9]+\.[0-9]+(?:_pre_rel)?\.orig\.tar\.xz \(Open commit window: [0-9]{4}-[0-9]{2}-[0-9]{2}; Pre-Release\)\)$/ + "** sisu_#{vi[:version]}.orig.tar.xz " \ + "(#{vi[:date]}:#{vi[:date_stamp].gsub(/20\d\dw/,'')})\n" else line end @@ -434,10 +437,8 @@ proceed? } def self.changelog_header_pre_release(vi) vn=version_number(vi) <<-WOK -** #{vn}.orig.tar.xz (Open commit window: #{vi[:date]}; Pre-Release)) -http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/sisu_#{vn} -http://www.jus.uio.no/sisu/pkg/src/sisu_#{vn}.orig.tar.xz - sisu_#{vn}.orig.tar.xz +* #{vn}.orig.tar.xz (Open commit window: #{vi[:date]}; Pre-Release)) + http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/sisu_#{vn} WOK end def self.changelog_header_pre_release_write(filename,ch) @@ -481,7 +482,7 @@ proceed? } end def self.tag_upstream system(%{ - git tag -a sisu_#{SiSU_version_next_stable} -m"SiSU #{SiSU_version_next_stable}" + git tag -a sisu_#{SiSU_version} -m"SiSU #{SiSU_version}" }) end def self.changelog_header_commit(rel=:release) @@ -672,3 +673,4 @@ module Package WOK end end +__END__ diff --git a/setup/qi_libs_base.rb b/setup/qi_libs_base.rb deleted file mode 100644 index 63a26548..00000000 --- a/setup/qi_libs_base.rb +++ /dev/null @@ -1,314 +0,0 @@ -module Project_details - def self.name - 'SiSU' - end - def self.thor - "ruby-thor files for the installation/setup of #{name}" - end - def self.platform_notice - "[#{name} is for Linux/Unix Platforms]" - end - def self.env - RbConfig::CONFIG - end - def self.host - env['host'] - end - def self.dir - def self.proj - Project_details.name.downcase - end - def self.arch - env['archdir'] - end - def self.sitearch - env['sitearchdir'] - end - def self.bin - env['bindir'] - end - def self.lib - env['sitelibdir'] - end - def self.data - env['datadir'] - end - def self.share - "#{env['datadir']}/sisu" - end - def self.conf - env['sysconfdir'] - end - def self.man - env['mandir'] - end - def self.vim - "#{env['datadir']}/sisu/vim" - end - def self.out - "#{env['localstatedir']}/#{proj}" - end - def self.rubylib - env['LIBRUBYARG_SHARED'] - end - def self.pwd - Dir.pwd #ENV['PWD'] - end - self - end - def self.version - stamp={} - v="#{dir.pwd}/data/sisu/version.yml" - if File.exist?(v) - stamp=YAML::load(File::open(v)) - stamp[:version] - else '' - end - end - def self.system_info - ##{Project_details.platform_notice} - puts <<-WOK - Host - host: #{Project_details.host} - arch: #{Project_details.dir.arch} - sitearch: #{Project_details.dir.sitearch} - Directories for installation - bin: #{Project_details.dir.bin} - lib (site-ruby): #{Project_details.dir.lib}/#{Project_details.dir.proj}/v* - conf [etc]: #{Project_details.dir.conf}/#{Project_details.dir.proj} - data (odf, shared images): #{Project_details.dir.share} - vim (vim syntax, highlighting, ftplugin): #{Project_details.dir.data}/sisu/vim - data (README, version_manifest): #{Project_details.dir.data}/doc/#{Project_details.dir.proj} - man (manual pages): #{Project_details.dir.man} - output: #{Project_details.dir.out} - processing: #{Project_details.dir.out}/processing - www: #{Project_details.dir.out}/www - rubylib: #{Project_details.dir.rubylib} - - WOK - end -end -module Utils - def self.answer?(ask) - resp='redo' - print ask + " ['yes', 'no' or 'quit']: " - resp=File.new('/dev/tty').gets.strip #resp=gets.strip - if resp == 'yes' then true - elsif resp == 'no' then false - elsif resp =~/^quit|exit$/ then exit - else puts "[please type: 'yes', 'no' or 'quit']" - answer?(ask) - end - end - def self.default_notice # local help not implemented description incorrect - ans= %{#{Project_details.thor} - Information on alternative actions is available using: - [if ruby-thor is installed:] - "#{$called_as} help") - Default action selected - "install #{Project_details.name}" proceed? } - resp=answer?(ans) - exit unless resp - end - def self.chmod_file(place) - if place =~/\/bin/; File.chmod(0755,place) - else File.chmod(0644,place) - end - end - def self.chmod_util(place) - if place =~/\/bin/; chmod(0755,place) - else chmod(0644,place) - end - end - def self.system_date - `date "+%Y-%m-%d"`.strip - end - def self.system_date_stamp - `date "+%Yw%W/%u"`.strip - end - def self.program_found?(prog) - found=`which #{prog}` #`whereis #{make}` - (found =~/bin\/#{prog}\b/) ? :true : :false - end -end -module Version_info - def self.contents(vi) - <<-WOK ---- -:project: #{vi[:project]} -:version: #{vi[:version]} -:date_stamp: #{vi[:date_stamp]} -:date: "#{vi[:date]}" - WOK - end - module Current - def self.yml_file_path(version) - 'data/sisu/version.yml' - end - def self.settings(file) - v="#{Dir.pwd}/#{file}" - if File.exist?(v) - YAML::load(File::open(v)) - else '' - end - end - def self.file_stable - yml_file_path(SiSU_version_dir_stable) - end - def self.setting_stable - settings(file_stable) - end - def self.content_stable - Version_info.contents(setting_stable) - end - end - module Next - def self.settings(v) - { - project: "#{Project_details.name}", - version: "#{v}", - date: "#{Utils.system_date}", - date_stamp: "#{Utils.system_date_stamp}", - } - end - def self.setting_stable - settings(SiSU_version_next_stable) - end - def self.content_stable - Version_info.contents(setting_stable) - end - end - module Update - def self.version_info_update_commit(filename,vi_hash_current,vi_content_current,vi_hash_next,vi_content_next) - ans=%{update #{Project_details.name.downcase} version info replacing: - #{vi_hash_current.sort} -with: - #{vi_hash_next.sort} - -#{vi_content_current} becoming: -#{vi_content_next} -proceed? } - resp=Utils.answer?(ans) - if resp - fn="#{Dir.pwd}/#{filename}" - if File.writable?("#{Dir.pwd}/.") - file_version=File.new(fn,'w+') - file_version << vi_content_next - file_version.close - else - puts %{*WARN* is the file or directory writable? could not create #{filename}} - end - end - end - def self.update_stable - version_info_update_commit( - Version_info::Current.file_stable, - Version_info::Current.setting_stable, - Version_info::Current.content_stable, - Version_info::Next.setting_stable, - Version_info::Next.content_stable - ) - end - def self.changelog_header(vi) - <<-WOK -** #{vi[:version]}.orig.tar.xz (#{vi[:date]}:#{vi[:date_stamp].gsub(/20\d\dw/,'')}) -http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/sisu_#{vi[:version]} -http://www.jus.uio.no/sisu/pkg/src/sisu_#{vi[:version]}.orig.tar.xz - sisu_#{vi[:version]}.orig.tar.xz - WOK - end - def self.changelog_header_stable - changelog_header(Version_info::Current.setting_stable) - end - end - self -end -module Package - def self.sequence - puts <<-WOK - --update-version # update package version - --tag # git tags upstream version - --merge # git merge upstream tag into debian/sid - --dch # dch create and edit - --dch-commit # dch commit - --build # git-buildpackage - --git_push # git push changes - --dput # dput package - --reprepro_update # reprepro update - --reprepro_push # reprepro rsync changes - WOK - end - def self.tag_upstream_and_merge_into_debian_sid - system(%{ - git tag -a sisu_#{SiSU_VERSION} -m"SiSU #{SiSU_VERSION}" && - git checkout debian/sid && - git merge sisu_#{SiSU_VERSION} - }) - - end - def self.tag_upstream - system(%{ - git tag -a sisu_#{SiSU_VERSION} -m"SiSU #{SiSU_VERSION}" - }) - end - def self.merge_into_debian_sid - system(%{ - git checkout debian/sid && - git merge sisu_#{SiSU_VERSION} - }) - end - def self.debian_changelog_create - if File.directory?('./debian') - system(%{ - git-dch -R -N #{SiSU_VERSION}-1 --full - }) - else puts 'not in git branch: debian/sid ?' - end - end - def self.debian_changelog_commit - system(%{ - git commit -a -m"debian/changelog (#{SiSU_VERSION}-1)" - }) - end - def self.debian_package_build - system(%{ - git-buildpackage --git-upstream-tag=sisu_%(version)s --git-debian-tag=debian/sisu_%(version)s --git-tag --git-keyid=#{Dev::GPGpubKey} - }) - end - def self.debian_package_dput - #system(%{ - # dput -s sisu_#{SiSU_VERSION}-1_amd64.changes - #}) - system(%{ - dput sisu_#{SiSU_VERSION}-1_amd64.changes - }) - end - def self.debian_package_push - system(%{ - git push --all && - git push --tags - }) - end - def self.reqprepro_update - dir_repo=Pathname.new( - "#{Dir.home}/grotto/repo/deb.repo/debian/rep" - ) - dir_build=Pathname.new( - "#{Dir.home}/grotto/repo/git.repo/code/builds/sisu_#{SiSU_VERSION}-1_amd64.changes" - ) - system(%{ - cd #{dir_repo.dirname} && - reprepro -Vb . include unstable #{dir_build} - cd - - }) - end - def self.reprepro_push - dir_repo=Pathname.new( - "#{Dir.home}/grotto/repo/deb.repo/debian/rep" - ) - system(%{ - cd #{dir_repo} && - rsync -av --delete-after {dists,pool} sisudoc:/srv/www/sisu/archive/. && - rsync -av --delete-after {dists,pool} ralpha@uio:./sisu/archive/. - }) - end -end diff --git a/setup/rbuild_libs.rb b/setup/rbuild_libs.rb index f685074e..75ba2847 100644 --- a/setup/rbuild_libs.rb +++ b/setup/rbuild_libs.rb @@ -252,7 +252,7 @@ module Version_info } end def self.setting_stable - settings(SiSU_version_next_stable) + settings(SiSU_version) end def self.content_stable Version_info.contents(setting_stable) diff --git a/setup/sisu_version.rb b/setup/sisu_version.rb index ca1e45fe..8dc0f2d6 100644 --- a/setup/sisu_version.rb +++ b/setup/sisu_version.rb @@ -1,6 +1,6 @@ #% constants module SiSUversion - SiSU_version_next_stable = '7.0.1' + SiSU_version = '7.0.1' end module Dev GPGpubKey = '1BB4B289' -- cgit v1.2.3