0

In the rpm.spec file that is used to guide the installation of an RPM, if the %post section is executed AFTER the package is installed (as stated here: http://www.rpm.org/max-rpm/s1-rpm-inside-scripts.html#S4-RPM-INSIDE-POST-SCRIPT), does that mean that, if multiple yum calls are triggered against a list of RPM packages, they might execute their %post section code in parallel?

If YUM doesn't support concurrent operations, then multiple yum calls won't illustrate this scenario. However, if we have multiple rpms declared in a single "Requires:" parameter within a top-level RPM's rpm.spec script, then, their %post section might run in parallel since YUM will receive a signal that the RPM installation is finished, resulting in operations that might conflict with each other intermittently.

Any ideas on how to solve/mitigate such problematic scenario?

the_marcelo_r
  • 1,847
  • 22
  • 35
  • 1
    What are you expecting to be doing in a `%post` scriptlet that might be affected by other packages `%post` scriptlets? In general this shouldn't be an issue since you shouldn't be doing anything that isn't solely connected to your package there. That being said I don't believe yum works that way and I don't believe this can happen (but I don't know that for sure). Multiple yum calls absolutely won't do it though, yum locks to prevent that. – Etan Reisner Jan 05 '15 at 13:48
  • Imagine that you have multiple rpms that should install AND configure web applications against a J2EE application server, the rpm.spec scripts will invoke jython scripts to perform configuration changes, what if something commits a change that impacts the deployment/synchronization/configuration of any other component? – the_marcelo_r Jan 05 '15 at 14:06
  • Can't imagine, sorry, no idea what that looks like/means. But if the tools/process involved in doing that is fragile enough to be easily blown up that's unfortunate. But like I said I don't believe this is possible. – Etan Reisner Jan 05 '15 at 14:19
  • How about this: Is there a way to run the %files section of rpm.spec, then run **something** similar to the %post section that can still work with the rpm payload (i.e., scripts that will be copied to the file system) WITHOUT sending any signals to YUM indicating that the rpm is installed? I wanted a guarantee that everything would be installed/executed without having a subsequent YUM process executing something else in parallel. I could probably achieve that with separate RPMs, one for the files and another one for the scripting (which could be placed in the %pre section), any other ideas??? – the_marcelo_r Jan 05 '15 at 15:05
  • 1
    rpmlib routines (including running %post) are run serially, not in parallel. The only parallelism is through the callback that pushes progress bars and updates the user display. – Jeff Johnson Jan 05 '15 at 15:29
  • 1
    If %post is executed AFTER the rpm is installed, then the code from the rpm.spec script becomes just a temporary .sh script that is executed in a separate shell session, how YUM/RPM would control any intersecting operations? Are you saying that these /tmp/xxx.sh scripts are still managed by the RPM process even after their packages were "installed"? – the_marcelo_r Jan 05 '15 at 15:50
  • Yes, running `%post` is *part* of the installation of the rpm. The rpm isn't done being installed until *after* `%post` happens. At least as far as I understand it. But trust @JeffJohnson on this. – Etan Reisner Jan 05 '15 at 16:15
  • Run yum with debug logging turned all the way up on a couple of RPMs with `%post` scripts and files lists and see when/how everything happens. That might help you some. – Etan Reisner Jan 05 '15 at 16:22

0 Answers0