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

Commits on Jan 22, 2024

  1. Pass arg1 to file trigger scripts

    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
    dmnks committed Jan 22, 2024
    Configuration menu
    Copy the full SHA
    12d9d9f View commit details
    Browse the repository at this point in the history
  2. Compactify the file trigger test

    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 committed Jan 22, 2024
    Configuration menu
    Copy the full SHA
    7c9920c View commit details
    Browse the repository at this point in the history