mirror of
https://github.com/jordansissel/fpm
synced 2024-12-22 00:34:15 +01:00
541550a74d
This fixes #1788. This also reverts #280. For #280, at the time, this change to ignore versions was correct. Two years after #280, Debian began allowing `Provides` field to have versions. This change also fixes bug in gem-to-deb conversion where previously an incorrect Provides syntax would be generated (but thanks to #280, removed), so this bug was only noticed after #280 was undone! Computers are hard sometimes. Added tests for gem-to-deb conversion specifically for the Provides field. Tested manually with Docker on Ubuntu 14.04 and 18.04 and results meet expectations. The history here is follows: * In 2012, fpm was patched to remove version specifiers in Provides field because Debian didn't support it. * In 2014, Debian dpkg[1] added support for versions in Provides field * Somewhere between 2015-2018, Debian and Ubuntu included this new version of dpkg. * Debian packaging policy docs (v4.4.0) was updated to allow versions in the Provides field. Expected impacts: * Older versions of dpkg/etc should _ignore_ the presence of a version specifier. Testing on Ubuntu 14.04 confirmed this. * Newer versions of dpkg/etc should respect the presence of a version specifier. Testing on Ubuntu 18.04 confirmed this. [1] https://launchpad.net/debian/+source/dpkg/1.17.11
37 lines
1.0 KiB
Ruby
37 lines
1.0 KiB
Ruby
require "spec_setup"
|
|
require "fpm/command" # local
|
|
require "fpm/package/deb" # local
|
|
require "fpm/package/gem" # local
|
|
require "stud/temporary"
|
|
|
|
describe "-s gem -t deb" do
|
|
# dpkg-deb lets us query deb package files.
|
|
# Comes with debian and ubuntu systems.
|
|
have_dpkg_deb = program_exists?("dpkg-deb")
|
|
if !have_dpkg_deb
|
|
Cabin::Channel.get("rspec") \
|
|
.warn("Skipping some deb tests because 'dpkg-deb' isn't in your PATH")
|
|
end
|
|
|
|
let(:fpm) { FPM::Command.new("fpm") }
|
|
|
|
let(:target) { Stud::Temporary.pathname + ".deb" }
|
|
|
|
after do
|
|
File.unlink(target) if File.exist?(target)
|
|
end
|
|
|
|
before do
|
|
insist { fpm.run(["-s", "gem", "-t", "deb", "-p", target, "rails"]) } == 0
|
|
end
|
|
|
|
it "should have a correctly formatted Provides field" do
|
|
deb = FPM::Package::Deb.new
|
|
deb.input(target)
|
|
|
|
# Converting gem->deb should format the deb Provides field as "rubygem-rails (= version)"
|
|
insist { deb.provides.first } =~ /^rubygem-rails \(= \d+\.\d+\.\d+\)$/
|
|
end
|
|
|
|
end # describe "-s gem -t deb"
|