deb_spec.rb (fpm-1.13.1) | : | deb_spec.rb (fpm-1.14.0) | ||
---|---|---|---|---|
skipping to change at line 372 | skipping to change at line 372 | |||
File.chmod(0755, File.join(staging_path, f)) # cp_r may mess-up with att ributes | File.chmod(0755, File.join(staging_path, f)) # cp_r may mess-up with att ributes | |||
end | end | |||
subject.name = "name" | subject.name = "name" | |||
subject.version = "0.0.1" | subject.version = "0.0.1" | |||
subject.maintainer = "Jordan Sissel <jls@semicomplete.com>" | subject.maintainer = "Jordan Sissel <jls@semicomplete.com>" | |||
subject.description = "Test package\nExtended description." | subject.description = "Test package\nExtended description." | |||
subject.attributes[:deb_user] = "root" | subject.attributes[:deb_user] = "root" | |||
subject.attributes[:deb_group] = "root" | subject.attributes[:deb_group] = "root" | |||
subject.category = "comm" | subject.category = "comm" | |||
subject.dependencies << "lsb-base" | ||||
subject.instance_variable_set(:@staging_path, staging_path) | subject.instance_variable_set(:@staging_path, staging_path) | |||
subject.output(target) | subject.output(target) | |||
end | end | |||
after do | after do | |||
FileUtils.rm_r staging_path if File.exist? staging_path | FileUtils.rm_r staging_path if File.exist? staging_path | |||
end # after | end # after | |||
skipping to change at line 399 | skipping to change at line 400 | |||
"script-in-etc-init.d-not-registered-via-update-rc.d" | "script-in-etc-init.d-not-registered-via-update-rc.d" | |||
] | ] | |||
it "should return no errors" do | it "should return no errors" do | |||
lintian_output = `lintian #{target} --suppress-tags '#{lintian_errors_to _ignore.join(",")}'` | lintian_output = `lintian #{target} --suppress-tags '#{lintian_errors_to _ignore.join(",")}'` | |||
expect($CHILD_STATUS).to eq(0), lintian_output | expect($CHILD_STATUS).to eq(0), lintian_output | |||
end | end | |||
end | end | |||
end | end | |||
describe "#output with Provides values" do | ||||
let(:original) { FPM::Package::Deb.new } | ||||
before do | ||||
# output a package, use it as the input, set the subject to that input | ||||
# package. This helps ensure that we can write and read packages | ||||
# properly. | ||||
original.name = "name" | ||||
original.version = "123" | ||||
end | ||||
after do | ||||
original.cleanup | ||||
end # after | ||||
invalid = [ | ||||
"this is not valid", | ||||
"hello = world", | ||||
"hello ()", | ||||
"hello (>)", | ||||
"hello (1234)", | ||||
"foo (<< 1.0.0-54)" | ||||
] | ||||
valid = [ | ||||
"libc", | ||||
"libc (= 6)", | ||||
"bar (= 1:1.0)", | ||||
"bar (= 1:1.0-1)", | ||||
"foo (= 1.0.0-54)" | ||||
] | ||||
invalid.each do |i| | ||||
it "should reject '#{i}'" do | ||||
original.provides << i | ||||
insist { original.output(target) }.raises FPM::InvalidPackageConfigurati | ||||
on | ||||
end | ||||
end | ||||
valid.each do |i| | ||||
it "should accept '#{i}'" do | ||||
original.provides << i | ||||
original.output(target) | ||||
end | ||||
end | ||||
end | ||||
describe "#reproducible" do | describe "#reproducible" do | |||
let(:package) { | let(:package) { | |||
# Turn on reproducible build behavior by setting SOURCE_DATE_EPOCH like u ser would | # Turn on reproducible build behavior by setting SOURCE_DATE_EPOCH like u ser would | |||
val = FPM::Package::Deb.new | val = FPM::Package::Deb.new | |||
val.attributes[:source_date_epoch] = '1' # one second into Jan 1 1970 UT C... '0' not supported by zlib binding :-( | val.attributes[:source_date_epoch] = '1' # one second into Jan 1 1970 UT C... '0' not supported by zlib binding :-( | |||
val | val | |||
} | } | |||
before :each do | before :each do | |||
package.name = "name" | package.name = "name" | |||
File.unlink(target + '.orig') if File.exist?(target + '.orig') | File.unlink(target + '.orig') if File.exist?(target + '.orig') | |||
end | end | |||
after :each do | after :each do | |||
package.cleanup | package.cleanup | |||
File.unlink(target + '.orig') if File.exist?(target + '.orig') | File.unlink(target + '.orig') if File.exist?(target + '.orig') | |||
end # after | end # after | |||
it "it should output bit-for-bit identical packages" do | it "it should output bit-for-bit identical packages" do | |||
lamecmds = [] | cmds = [] | |||
lamecmds << "ar" if not ar_cmd_deterministic? | cmds << "ar" if not ar_cmd_deterministic? | |||
lamecmds << "tar" if not tar_cmd_supports_sort_names_and_set_mtime? | cmds << "tar" if not tar_cmd_supports_sort_names_and_set_mtime? | |||
if not lamecmds.empty? | if not cmds.empty? | |||
skip("fpm searched for variants of #{lamecmds.join(", ")} that support(s | skip("fpm searched for variants of [#{cmds.join(", ")}] that support(s) | |||
) deterministic archives, but found none, so can't test reproducibility.") | deterministic archives, but found none, so can't test reproducibility.") | |||
return | return | |||
end | end | |||
package.output(target) | package.output(target) | |||
# FIXME: 2nd and later runs create changelog.Debian.gz?!, so throw away ou tput of 1st run | # FIXME: 2nd and later runs create changelog.Debian.gz?!, so throw away ou tput of 1st run | |||
FileUtils.rm(target) | FileUtils.rm(target) | |||
package.output(target) | package.output(target) | |||
FileUtils.mv(target, target + '.orig') | FileUtils.mv(target, target + '.orig') | |||
# Output a second time with a different timestamp; tar format time resolut ion is 1 second | # Output a second time with a different timestamp; tar format time resolut ion is 1 second | |||
sleep(1) | sleep(1) | |||
skipping to change at line 472 | skipping to change at line 523 | |||
File.unlink(target) if File.exist?(target) | File.unlink(target) if File.exist?(target) | |||
end | end | |||
before do | before do | |||
deb = FPM::Package::Deb.new | deb = FPM::Package::Deb.new | |||
deb.name = "name" | deb.name = "name" | |||
deb.attributes[:deb_compression] = flag | deb.attributes[:deb_compression] = flag | |||
deb.output(target) | deb.output(target) | |||
end | end | |||
it "should use #{suffix} for data and control files" do | control_suffix = case flag | |||
when 'bzip2' | ||||
'gz' | ||||
else | ||||
suffix | ||||
end | ||||
it "should use #{suffix} for data file and #{control_suffix} for control | ||||
file" do | ||||
list = `ar t #{target}`.split("\n") | list = `ar t #{target}`.split("\n") | |||
insist { list }.include?("control.tar.#{suffix}") | insist { list }.include?("control.tar.#{control_suffix}") | |||
insist { list }.include?("data.tar.#{suffix}") | insist { list }.include?("data.tar.#{suffix}") | |||
end | end | |||
# For issue #1840, PR #1841 | ||||
# fpm should generate deb packages that do not cause lintian to crash | ||||
it "should not cause lintian to crash" do | ||||
skip("Missing lintian program") unless have_lintian | ||||
# Have lintian run with only one check. The goal here is to check if | ||||
# lintian crashes or not. This 'symlinks' check would normaly check | ||||
# for broken symlinks. Since this package has no files, this check | ||||
# should always succeed. It would fail if fpm generated any invalid | ||||
# packages, such as ones with a bzip2-compressed control.tar file (#18 | ||||
40) | ||||
insist { system("lintian", "-C", "symlinks", target) } == true | ||||
end | ||||
end | end | |||
end | end | |||
end | end | |||
end # describe FPM::Package::Deb | end # describe FPM::Package::Deb | |||
End of changes. 6 change blocks. | ||||
8 lines changed or deleted | 82 lines changed or added |