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 rpm_attributes[] to be able to specify per file attributes #120

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/fpm/cookery/package/package.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ def initialize(recipe, config = {})
# overwrite the values from package_setup().
@fpm.attributes.merge!(recipe.fpm_attributes)

# also merge fpm.attrs (for %attr flags, rpm specific)
@fpm.attrs.merge!(recipe.rpm_attributes)

# The input for the FPM package will be set here.
package_input

Expand Down
14 changes: 14 additions & 0 deletions lib/fpm/cookery/recipe.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def self.inherited(klass)
# class variable.
klass.instance_variable_set(:@fpm_attributes, self.fpm_attributes.dup)
klass.instance_variable_set(:@environment, self.environment.dup)
klass.instance_variable_set(:@rpm_attributes, self.rpm_attributes.dup)
end

def self.platforms(valid_platforms)
Expand Down Expand Up @@ -101,11 +102,23 @@ def fpm_attributes(args=nil)
@fpm_attributes
end

# record attributes[foo] = bar
# Supports both hash and argument assignment
# rpm_attributes[:attr1] = xxxx
# rpm_attributes :xxxx=>1, :yyyy=>2
def rpm_attributes(args=nil)
if args.is_a?(Hash)
@rpm_attributes.merge!(args)
end
@rpm_attributes
end

def environment
@environment
end
end
@fpm_attributes = {}
@rpm_attributes = {}
@environment = FPM::Cookery::Environment.new

def initialize(filename, config)
Expand All @@ -132,6 +145,7 @@ def builddir(path = nil) (@builddir || tmp_root('tmp-build'))/path end
def pkgdir(path = nil) (@pkgdir || workdir('pkg'))/path end
def cachedir(path = nil) (@cachedir || workdir('cache'))/path end
def fpm_attributes() self.class.fpm_attributes end
def rpm_attributes() self.class.rpm_attributes end
def environment() self.class.environment end

# Resolve dependencies from omnibus package.
Expand Down