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

Add "package_name_format" field to recipe #215

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

bernd
Copy link
Owner

@bernd bernd commented 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

Example recipe:

class FacterRubyGem < FPM::Cookery::RubyGemRecipe
  name    'facter'
  version '1.6.16'
  epoch 2

  package_name_format 'NAME_EPOCH:FULLVERSION_ARCH.EXTENSION'
end

bernd added 4 commits July 13, 2022 23:09
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
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
- Add "before_package_file_create"
- Add "after_package_file_create"
- Deprecate "before_package_create"
- Deprecate "after_package_create"

The new hooks take the package filename as first parameter.

With the introduction of the package_name_format recipe field, the
package filename cannot be computed with the FPM::Package object alone
anymore. We now pass in the filename directly so consumers don't have to
compute the filename anymore.

We could have passed in the recipe object or the package name format so
consumers could compute the filename based on that, but that would
require deeper knowledge of the FPM::Package object.
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 this pull request may close these issues.

How to configure the format used in FPM::Package::Deb.to_s?
1 participant