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 input and output rpm trigger support #626

Closed
wants to merge 6 commits into from

Conversation

@makushimu
Copy link
Contributor

makushimu commented Jan 28, 2014

I needed to be able to use rpm triggers and I noticed that fpm didn't support them... I just added the support with rpm-specific options.

It would be nice to be able to support "generic" for package systems that support them (I'm thinking at .deb specifically), but I didn't have time to play with this.

@@ -118,6 +118,19 @@ class FPM::Package::RPM < FPM::Package
"version. Default is to be specific. This option allows the same " \
"version of a package but any iteration is permitted"

[:un,:in,:postun].each do |trigger_type|

This comment has been minimized.

Copy link
@jordansissel

jordansissel Jan 28, 2014

Owner

Thoughts on naming this flag something more readable? "--rpm-trigger-un" seems... hard to comprehend for folks unfamiliar with rpm's terminology and features. Like --after-install (instead of "postinst" or whatever).

If you don't think it makes sense to pick a different name, that's fine, too :)

rpm_trigger = []
option "--trigger-#{trigger_type}", "[OPT]PACKAGE: FILEPATH", "Adds a %trigger#{trigger_type} OPT -- PACKAGE section to the " \
"package with the script located in FILEPATH" do |trigger|
match = trigger.match(/^(\[.*\]|)(.*): (.*)$/)

This comment has been minimized.

Copy link
@jordansissel

jordansissel Jan 28, 2014

Owner

It seems there's a special syntax you're looking for here, can you document that in the help text of this flag?

@makushimu

This comment has been minimized.

Copy link
Contributor Author

makushimu commented Jan 28, 2014

I updated to change the names to something more meaningful and added more help info. Might be a bit long now, though.

Also, I added a last type of trigger that I forgot earlier.

@jordansissel

This comment has been minimized.

Copy link
Owner

jordansissel commented Mar 7, 2014

I'd like to ssee maybe triggers generalized but I'm pretty sure rpm and deb implement them totally differently and they're the only packaging systems that have it that fpm supports

rpm_trigger = []
option "--trigger-#{trigger_type}", "'[OPT]PACKAGE: FILEPATH'", "Adds a rpm trigger script located in FILEPATH, " \
"having 'OPT' options and linking to 'PACKAGE'. PACKAGE can be a comma seperated list of packages. " \
"See: http://rpm5.org/docs/api/triggers.html" do |trigger|

This comment has been minimized.

Copy link
@jordansissel

jordansissel Mar 7, 2014

Owner

I don't recommend linking to rpm5.org. The rpm that fpm supports is rpm4 and both projects are not managed by the same folks (rpm5 is a fork of rpm4, not a successor, as I understand it). I'll see if I can find a link to redhat's rpm triggers docs

This comment has been minimized.

:after_target_uninstall => "postun"
}
triggermap.each do |name, rpmtype|
(attributes["rpm_trigger_#{name}".to_sym] or []).each do |trigger| -%>

This comment has been minimized.

Copy link
@jordansissel

jordansissel Mar 7, 2014

Owner

can we use named arguments instead of making 'trigger' an array? something like |arg1, arg2, arg3| ?

@makushimu makushimu closed this Mar 7, 2014
@makushimu makushimu reopened this Mar 7, 2014
@makushimu

This comment has been minimized.

Copy link
Contributor Author

makushimu commented Mar 7, 2014

Sorry, a bit late and was reading from a mobile device and clicked on the wrong button...
So, for the docs, the rpm.org link is good.
And removing the array is ok. I'll do the fixes later today.

@jordansissel jordansissel added the O(2) label Oct 25, 2014
@@ -270,7 +299,17 @@ def input(path)
# Also taking into account the value of tags[preinprog] etc, something like:
# #!#{tags[:preinprog]}
# #{tags[prein]}
# TODO(sissel): put 'trigger scripts' stuff into attributes

val = tags[:triggerindex].zip(tags[:triggername],tags[:triggerflags],tags[:triggerversion]).group_by{ |x| x[0]}

This comment has been minimized.

Copy link
@jordansissel

jordansissel Oct 25, 2014

Owner

This code is a bit complex and difficult to read. I'll probably merge anyway and we can improve this later.

This comment has been minimized.

Copy link
@xelwarto

xelwarto Nov 6, 2014

Contributor

The addition of this code has rendered general RPM input non-functional ...

val = tags[:triggerindex].zip(tags[:triggername],tags[:triggerflags],tags[:triggerversion]).group_by{ |x| x[0]}

This line raises the following error when attempting to input a localized RPM:

undefined method `zip' for nil:NilClass
@jordansissel jordansissel force-pushed the jordansissel:master branch from 7280243 to 4452a23 Oct 25, 2014
prof-milki pushed a commit to prof-milki/xpm that referenced this pull request Dec 18, 2014
This adds several rpm-specific flags:

--before-install
--after-install
--before-uninstall
--after-target-uninstall

Fixes jordansissel#626 (merged by hand)
prof-milki pushed a commit to prof-milki/xpm that referenced this pull request Dec 27, 2014
This adds several rpm-specific flags:

--before-install
--after-install
--before-uninstall
--after-target-uninstall

Fixes jordansissel#626 (merged by hand)
jordansissel added a commit that referenced this pull request Apr 24, 2015
This adds several rpm-specific flags:

--before-install
--after-install
--before-uninstall
--after-target-uninstall

Fixes #626 (merged by hand)
jordansissel added a commit that referenced this pull request Jun 20, 2016
This adds several rpm-specific flags:

--before-install
--after-install
--before-uninstall
--after-target-uninstall

Fixes #626 (merged by hand)
@rbjorklin

This comment has been minimized.

Copy link

rbjorklin commented Jun 26, 2017

@makushimu could you provide an example on how to use this?

EDIT: Nevermind, figured it out. For future reference --rpm-trigger-after-install "[]package-name: ./script.sh"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.