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

Pass arg1 to file trigger scripts #2871

Merged
merged 2 commits into from Jan 23, 2024

Conversation

dmnks
Copy link
Contributor

@dmnks dmnks commented Jan 22, 2024

This adds the first argument to file trigger script calls, just like with regular triggers. The second argument will be added in a separate commit.

Related: #2755

Pass the number of instances of the source (i.e. triggered) package left
after the operation as the first argument ($1) to file trigger scripts,
similarly to regular triggers.

The %filetrigger{in,un,postun} variants execute at the same time as
their regular trigger counterparts so use the same logic to compute the
argument.

The %transfiletrigger{in,un} variants don't have any regular trigger
counterparts but are close relatives of the %posttrans and %preuntrans
scriptlets, respectively, so borrow the logic from those.

Don't count packages in runImmedFileTriggers() again, though, and just
reuse the psm->scriptArg value which is already computed in rpmpsmNew()
and used for the normal scriptlets such as %pre.  We could/should
probably do this in runImmedTriggers(), too, but leave that for later
(see issue rpm-software-management#2868).

Some tests already cover the file trigger arguments so adjust those, and
extend the "basic file triggers 2" test with the remaining scenarios to
bring it on par with the regular trigger tests.  This is easier than
extending "basic file trigger scripts" since we don't really need to
test the filenames returned on stdin here, just the arguments.

Also add a short note about the argument to the file trigger docs.

The second argument $2 (triggering package count) will be added in a
separate commit.

Related: rpm-software-management#2755
Add the triggered package name to the output and put the arguments
received and filename count on the same line to make the tests a bit
easier on the eye.  This basically replicates the format of the regular
trigger tests and will be handy when adding the second file trigger
argument in a later commit.

No functional change.
@dmnks dmnks added RFE transaction highlight Release highlight labels Jan 22, 2024
@pmatilai pmatilai merged commit bc5dd41 into rpm-software-management:master Jan 23, 2024
1 check passed
@pmatilai
Copy link
Member

I'm glad this ended up on your plate, I never found the patience to sort this out 😄

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

Successfully merging this pull request may close these issues.

None yet

2 participants