-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rpm: generate changelog if none is provided
`rpmlint` considers a lack of a changelog an error. this is a similar behaviour to the DEB packager, where a generic default changelog is generated unless one is provided explicitly.
- Loading branch information
Showing
3 changed files
with
58 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -484,6 +484,45 @@ def subject.render_template; @rpmspec = template("rpm.erb").result(binding); end | |
File.unlink(@target) | ||
end | ||
end # dist | ||
|
||
context "changelog" do | ||
it "should generate a changelog in the release" do | ||
subject.name = "example" | ||
subject.attributes[:rpm_dist] = 'rhel' | ||
subject.version = "1.2.3" | ||
subject.maintainer = "Spec Test <[email protected]>" | ||
@target = Stud::Temporary.pathname | ||
|
||
# Write RPM | ||
subject.output(@target) | ||
|
||
@rpm = ::RPM::File.new(@target) | ||
insist { @rpm.tags[:changelogname] } == [ "Spec Test <[email protected]> - 1.2.3-1.rhel" ] | ||
insist { @rpm.tags[:changelogtext] } == [ "- Package created with FPM" ] | ||
|
||
File.unlink(@target) | ||
end | ||
|
||
it "should have the changelog in the release" do | ||
subject.name = "example" | ||
subject.attributes[:rpm_changelog] = <<CHANGELOG | ||
* Tue May 31 2016 Example Maintainers <[email protected]> - 1.0-1 | ||
- First example package | ||
CHANGELOG | ||
subject.version = "1.0" | ||
@target = Stud::Temporary.pathname | ||
|
||
# Write RPM | ||
subject.output(@target) | ||
|
||
@rpm = ::RPM::File.new(@target) | ||
insist { @rpm.tags[:changelogtime] } == [ 1464696000 ] | ||
insist { @rpm.tags[:changelogname] } == [ "Example Maintainers <[email protected]> - 1.0-1" ] | ||
insist { @rpm.tags[:changelogtext] } == [ "- First example package" ] | ||
|
||
File.unlink(@target) | ||
end | ||
end # changelog | ||
end # #output | ||
|
||
describe "prefix attribute" do | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -260,4 +260,4 @@ fi | |
<% end -%> | ||
|
||
%changelog | ||
<%= attributes[:rpm_changelog] %> | ||
<%= changelog %> |