Module: MSPRelease::Project::Debian
- Defined in:
- lib/msp_release/project/debian.rb
Defined Under Namespace
Classes: BuildResult
Constant Summary collapse
- DEFAULT_PATH =
"debian/msp/changelog"
Instance Method Summary collapse
- #build_command(options = {}) ⇒ Object
- #build_opts(options = {}) ⇒ Object
- #build_result(dir) ⇒ Object
- #changelog ⇒ Object
- #changelog_path ⇒ Object
- #name ⇒ Object
- #next_version_for_release(options = {}) ⇒ Object
- #prepare_for_build(branch_name, options = {}) ⇒ Object
- #project_specific_push(release_name) ⇒ Object
- #puts_changelog_info ⇒ Object
- #rename_dir_for_build(branch_name, distribution) ⇒ Object
- #source_package_name ⇒ Object
- #version ⇒ Object
- #write_version(new_version) ⇒ Object
Instance Method Details
#build_command(options = {}) ⇒ Object
155 156 157 158 159 160 161 |
# File 'lib/msp_release/project/debian.rb', line 155 def build_command(={}) if cmd = config[:deb_build_command] cmd else "dpkg-buildpackage" + (@sign ? '' : ' -us -uc') end end |
#build_opts(options = {}) ⇒ Object
151 152 153 |
# File 'lib/msp_release/project/debian.rb', line 151 def build_opts(={}) @sign = [:sign] end |
#build_result(dir) ⇒ Object
163 164 165 |
# File 'lib/msp_release/project/debian.rb', line 163 def build_result(dir) BuildResult.new(dir, self) end |
#changelog ⇒ Object
79 80 81 |
# File 'lib/msp_release/project/debian.rb', line 79 def changelog Debian.new(@dir, changelog_path) end |
#changelog_path ⇒ Object
63 64 65 |
# File 'lib/msp_release/project/debian.rb', line 63 def changelog_path @changelog_path || 'debian/changelog' end |
#name ⇒ Object
75 76 77 |
# File 'lib/msp_release/project/debian.rb', line 75 def name source_package_name end |
#next_version_for_release(options = {}) ⇒ Object
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/msp_release/project/debian.rb', line 83 def next_version_for_release( = {}) deb_version = changelog.version distribution = [:distribution] || changelog.distribution new_version = if deb_version.to_version != version LOG.warn "Warning: project version (#{version.to_s}) " + "did not match changelog version (#{deb_version.to_s}), project " + "version wins" changelog.reset_at(version) else deb_version.bump end LOG.debug "Adding new entry to changelog..." changelog.add(new_version, "New release", distribution) LOG.debug "Changelog now at #{new_version}" puts_changelog_info new_version end |
#prepare_for_build(branch_name, options = {}) ⇒ Object
118 119 120 121 122 123 124 125 |
# File 'lib/msp_release/project/debian.rb', line 118 def prepare_for_build(branch_name, ={}) branch_is_release_branch = !! /^release-.+$/.match(branch_name) distribution = [:distribution] || changelog.distribution rename_dir_for_build(branch_name, distribution) super if defined?(super) end |
#project_specific_push(release_name) ⇒ Object
111 112 113 114 115 116 |
# File 'lib/msp_release/project/debian.rb', line 111 def project_specific_push(release_name) # Create a release commit. = (release_name) exec "git add #{changelog.fname}" exec "git commit -m\"#{commit_message}\"" end |
#puts_changelog_info ⇒ Object
106 107 108 109 |
# File 'lib/msp_release/project/debian.rb', line 106 def puts_changelog_info LOG.debug "OK, please update the change log, then run 'vershunt push' to"\ " push your changes for building" end |
#rename_dir_for_build(branch_name, distribution) ⇒ Object
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
# File 'lib/msp_release/project/debian.rb', line 127 def rename_dir_for_build(branch_name, distribution) branch_is_release_branch = !! /^release-.+$/.match(branch_name) new_dir = Dir.chdir(@dir) do if branch_is_release_branch first_commit_hash, = find_first_release_commit if first_commit_hash.nil? raise CLI::Exit, "Could not find a release commit on #{pathspec}" end clean_checkout else dev_version = Debian::Versions::Development. new_from_working_directory(branch_name, latest_commit_hash) changelog.amend(dev_version, distribution) end name + "-" + changelog.version.to_s end FileUtils.mv(@dir, new_dir) @dir = new_dir end |
#source_package_name ⇒ Object
67 68 69 70 71 72 73 |
# File 'lib/msp_release/project/debian.rb', line 67 def source_package_name debian_dir = File.dirname(File.join(@dir, changelog_path)) control_file = File.join(debian_dir + '/control') source_line = MSPRelease::Exec.exec("grep Source: #{control_file}") match = /^Source: (.+)$/.match(source_line) match && match[1] end |
#version ⇒ Object
59 60 61 |
# File 'lib/msp_release/project/debian.rb', line 59 def version changelog.version.to_version end |
#write_version(new_version) ⇒ Object
50 51 52 53 54 55 56 57 |
# File 'lib/msp_release/project/debian.rb', line 50 def write_version(new_version) debian_version = Debian::Versions::Unreleased.new_from_version(new_version) changelog.add(debian_version, "New version") defined?(super) ? Array(super).push(changelog.fname) : [changelog.fname] end |