Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to configure the format used in FPM::Package::Deb.to_s? #210

Open
Rylon opened this issue Aug 7, 2019 · 2 comments · May be fixed by #215
Open

How to configure the format used in FPM::Package::Deb.to_s? #210

Rylon opened this issue Aug 7, 2019 · 2 comments · May be fixed by #215

Comments

@Rylon
Copy link

Rylon commented Aug 7, 2019

Hi,

I raised this on the FPM project too, but wondered if you had any insights related to doing this via a recipe:

jordansissel/fpm#1659

We want to make sure the Epoch gets included in the filename, we can see that FPM::Package::Deb.to_s is responsible for interpolating the filename, but it defaults to this:
"NAME_FULLVERSION_ARCH.EXTENSION"

We'd like to change it to match the Debian packaging spec:
"NAME_EPOCH:FULLVERSION_ARCH.EXTENSION".

Is it possible to set this properly via some mechanism?

For the time being we've monkey patched inside our recipe.rb:

# Monkey patches to override default format to contain the Epoch according to Debian Packaging Specs.
class FPM::Package::Deb < FPM::Package
  def to_s(format=nil)
    return super("NAME_EPOCH:FULLVERSION_ARCH.EXTENSION")
  end
end
bernd added a commit that referenced this issue Jul 13, 2022
Adjust the Package::Version class to handle an epoch that is set in the
version string and as recipe field.

An epoch in the version string has precedence over the recipe field for
backward compatibility.

If the epoch is set in both, the version string and the epoch field, we
throw an exception because we cannot select on value automatically.

Refs #210
bernd added a commit that referenced this issue Jul 13, 2022
Setting the field to a format string value changes the filename of the
created package. If unset, FPM chooses its default format.

See the following code section for available format strings:
https://github.com/jordansissel/fpm/blob/c40f6818f88a6dd3df7bc19b6007b03a716949f8/lib/fpm/package.rb#L355-L365

Fixes #210
@bernd bernd linked a pull request Jul 13, 2022 that will close this issue
@bernd
Copy link
Owner

bernd commented Jul 13, 2022

@Rylon Quite late, but better than never. 😄

I created PR #215 to add a package_name_format field to the recipe object to allow the modification of the file format.

@Rylon
Copy link
Author

Rylon commented Aug 30, 2022

Nice, thanks @bernd !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants