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.17k stars 1.07k forks source link

--iteration fails if iteration value contains '-' #1312

Open jparrish opened 7 years ago

jparrish commented 7 years ago

Execution of

fpm -s dir -t rpm --name foo -a all -v 1 --iteration 0-2 foo

fails with error:

Process failed: rpmbuild failed (exit code 1). Full command was:["rpmbuild", "-bb", "--target", "noarch", "--define", "buildroot /var/folders/cp/1nwr2xf511v_t2fnlk2t0c200000gw/T/package-rpm-build-1e8667a141f0e19693f65f880282c71958d93e351b94f52a811ac9c05171/BUILD", "--define", "_topdir /var/folders/cp/1nwr2xf511v_t2fnlk2t0c200000gw/T/package-rpm-build-1e8667a141f0e19693f65f880282c71958d93e351b94f52a811ac9c05171", "--define", "_sourcedir /var/folders/cp/1nwr2xf511v_t2fnlk2t0c200000gw/T/package-rpm-build-1e8667a141f0e19693f65f880282c71958d93e351b94f52a811ac9c05171", "--define", "_rpmdir /var/folders/cp/1nwr2xf511v_t2fnlk2t0c200000gw/T/package-rpm-build-1e8667a141f0e19693f65f880282c71958d93e351b94f52a811ac9c05171/RPMS", "--define", "_tmppath /var/folders/cp/1nwr2xf511v_t2fnlk2t0c200000gw/T", "/var/folders/cp/1nwr2xf511v_t2fnlk2t0c200000gw/T/package-rpm-build-1e8667a141f0e19693f65f880282c71958d93e351b94f52a811ac9c05171/SPECS/foo.spec"] {:level=>:error}

The work around is to replace the '-' in the iteration with some other character, e.g. '_'. The issue does not manifest when building .deb packages.

jordansissel commented 7 years ago

Ah, good catch.

rpmbuild says this:

error: line 38: Illegal char '-' (0x2d) in: Release: 1-2

We can make the automatic correction for this like we do with other parts of package metadata. Thank you for filing!

yuokada commented 7 years ago

@jparrish I find a another workaround. Replace --iteration 0-2 with --iteration 0 --dist-tag 2.

jparrish commented 7 years ago

Thank you, @jordansissel and @yuokada for your attention and insight.

jordansissel commented 7 years ago

@yuokada Nice find! Thank you for sharing :)

jordansissel commented 7 years ago

I tried this just to see what happens in rpmbuild --

It appears that the following two fpm usages are identical:

Both produce an rpm with a Release tag of "0.2":

% rpm -qip example-1.0-0.2.x86_64.rpm | grep Release
Release     : 0.2
copy commented 5 years ago

This also comes up when converting a debian package to an rpm package, in particular when the version is taken from git describe --tags: The version field has a form of 1.1-32-d7b4667, where fpm chooses 32-d7b4667 as the Release value.