jordansissel / fpm

Effing package management! Build packages for multiple platforms (deb, rpm, etc) with great ease and sanity.
http://fpm.readthedocs.io/en/latest/
Other
11.09k stars 1.07k forks source link

Reject invalid Debian version values. #1971

Closed jordansissel closed 1 year ago

jordansissel commented 1 year ago

This fixes #1847 by adding an actionable error message when someone provides a version value that Debian's policy and tools will reject.

Includes test coverage :)

jordansissel commented 1 year ago
% bundle exec rspec spec/fpm/package/deb_spec.rb

Finished in 4.25 seconds (files took 0.61127 seconds to load)
70 examples, 0 failures

Specific new tests:

FPM::Package::Deb
  when validating the version field
    should reject as invalid, '_'
    should reject as invalid, '1_2'
    should reject as invalid, 'abc def'
    should reject as invalid, '%'
    should reject as invalid, '1^a'
    should accept '1'
    should remove a leading 'v' from v1 and still accept it
    should accept '1.2'
    should remove a leading 'v' from v1.2 and still accept it
    should accept '1.2.3'
    should remove a leading 'v' from v1.2.3 and still accept it
    should accept '20200101'
    should remove a leading 'v' from v20200101 and still accept it
    should accept '1~beta'
    should remove a leading 'v' from v1~beta and still accept it
    should accept '1whatever'
    should remove a leading 'v' from v1whatever and still accept it

Finished in 0.01125 seconds (files took 0.61874 seconds to load)
17 examples, 0 failures
gliptak commented 1 year ago

1970