Class: GitMaintain::RDMACoreBranch
- Defined in:
- lib/addons/RDMACore.rb
Constant Summary collapse
- REPO_NAME =
"rdma-core"
Constants inherited from Branch
Branch::ACTION_HELP, Branch::ACTION_LIST, Branch::NO_CHECKOUT_ACTIONS, Branch::NO_FETCH_ACTIONS
Instance Attribute Summary
Attributes inherited from Branch
#head, #local_branch, #remote_branch, #remote_ref, #stable_head, #verbose_name, #version
Instance Method Summary collapse
Methods inherited from Branch
check_opts, #checkout, #cp, execAction, #initialize, #is_targetted?, #list, load, #merge, #monitor, #monitor_stable, #push, #push_stable, #reset, set_opts, #steal
Constructor Details
This class inherits a constructor from GitMaintain::Branch
Instance Method Details
#release(opts) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/addons/RDMACore.rb', line 5 def release(opts) prev_ver=@repo.runGit("show HEAD:CMakeLists.txt | egrep \"[sS][eE][tT]\\\\(PACKAGE_VERSION\""). chomp().gsub(/[sS][eE][tT]\(PACKAGE_VERSION\s*"([0-9.]*)".*$/, '\1') ver_nums = prev_ver.split(".") new_ver = (ver_nums[0 .. -2] + [ver_nums[-1].to_i() + 1 ]).join(".") git_prev_ver = "v" + (ver_nums[-1] == "0" ? ver_nums[0 .. -2].join(".") : prev_ver) puts "Preparing release #{prev_ver} => #{new_ver}" rep = GitMaintain::checkLog(opts, @local_branch, git_prev_ver, "release") if rep != "y" then puts "Skipping release" return end # Prepare tag message tag_path=`mktemp`.chomp() puts tag_path tag_file = File.open(tag_path, "w+") tag_file.puts "rdma-core-#{new_ver}:" tag_file.puts "" tag_file.puts "Updates from version #{prev_ver}" tag_file.puts " * Backport fixes:" tag_file.puts `git log HEAD ^#{git_prev_ver} --format=' * %s'` tag_file.close() # Update version number in relevant files @repo.run("sed -i -e 's/\\(Version:[[:space:]]*\\)[0-9.]*/\\1#{new_ver}/g' redhat/rdma-core.spec suse/rdma-core.spec") @repo.run("sed -i -e 's/\\([sS][eE][tT](PACKAGE_VERSION[[:space:]]*\"\\)[0-9.]*\"/\\1#{new_ver}\"/g' CMakeLists.txt") @repo.run("cat <<EOF > debian/changelog.new rdma-core (#{new_ver}-1) unstable; urgency=low * New upstream release. -- $(git config user.name) <$(git config user.email)> $(date '+%a, %d %b %Y %T %z') $(cat debian/changelog) EOF mv debian/changelog.new debian/changelog") # Add and commit @repo.runGit("add redhat/rdma-core.spec suse/rdma-core.spec CMakeLists.txt debian/changelog") @repo.runGit("commit -m 'Bump to version #{new_ver}' --verbose --edit --signoff") if $? != 0 then raise("Failed to commit on branch #{local_branch}") end @repo.runGit("tag -a -s v#{new_ver} --edit -F #{tag_path}") if $? != 0 then raise("Failed to tag branch #{local_branch}") end `rm -f #{tag_path}` end |