Re: Dependency problem when "post" runs command from the rpm
Jeff Johnson <[email protected]> Sun, 21 Sep 2008 17:56:07 -0400
| Newsgroups | gmane.linux.redhat.rpm.general |
|---|---|
| Message-ID | <[email protected]> |
--===============0858458194== Content-Type: multipart/alternative; boundary=Apple-Mail-32-1061315630 --Apple-Mail-32-1061315630 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit On Sep 21, 2008, at 1:31 PM, Toralf Lund wrote: > Jeff Johnson wrote: >> >> On Sep 15, 2008, at 11:24 PM, Michael A. Peters wrote: >> >>> Toralf Lund wrote: >>>> I've run into an installation order issue related to the "post" >>>> scriptlet in one of my packages. Basically, this scripts executes >>>> a (command-line only) program installed by the package, and this >>>> program pretty much needs everything required by the package. The >>>> problem is, if I install my package along with some of the >>>> required software, the requirements are often installed *after* >>>> the "main" package [ ... ] >>> >>> Perhaps my understanding is wrong - but I believe: >>> >> >> >> Um, yes, wrong. >> >>> [ .. ] >> >> The %pre and %post scripts are run immediately before/after a >> package is installed, >> not after all the packages are installed. > Exactly. This is what's causing me trouble; essentially, I have a > command that would be better to run at the end of the entire > transaction. But I think I understand why rpm doesn't work that way... There are %posttrans scriptlets that run at the end of the transaction. > >> >> This is also true for %preun/%postun when a package is erased, the >> scripts are run >> immediately before/after the erasure. >> >>> My understanding of this may not be 100% >>> >> >> What is most confusing is that rpm does install before erase. Which >> means that %post >> scriptlet is run before %preun is run, which is perhaps counter- >> intuitive, but is exactly >> what is needed if shared libraries are being upgraded on live >> systems. The new librrary >> must be installed before the old library is removed in ordeer to >> minimize the window >> where the library is not available. > Quite. >> >> [ ... ] >> >> And finally that brings the topic to context markers like >> Requires(post) etc. >> >> Context markers like Requires(post) are intended to break >> dependency loops while >> ordering. >> >> A package that "needs" some other package solely while running a >> %post scriptlet, >> not after being installed, can carry a Requires(post) hint to the >> ordering within rpm. > In my case the script and the package itself both need (more or > less) the same libs. Logically, they may be seen as independent sets > of dependencies, though, I think... >> >> The hint excludes dependency loops between install <=> erase >> packages. >> >> The other major affect of adding an explicit Requires(post) hint is >> that those >> dependencies are not registered in an rpmdb because they were >> needed solely >> for installing, not for using or erasing, a package. There's no >> need to keep track >> of the install context dependencies after the install has been done >> because >> the %post scriptlet is run only during install, never run after >> install. >> >> hth > Well. It doesn't help me too much with my original issue. But, like > I said elsewhere, I can't seem to reproduce the problem I thought I > had, so maybe it doesn't matter. I'm still confused, though. > > Question: Can I generally assume the packages are ordered according > to "Requires" these days, i.e. that if package A requires something > provided by package B, then B is installed before A (when A and B > are both part of the same transaction)? I'm fairly sure I couldn't > when I started using rpm, so I had to mess about with ""PreReq" > instead... Yes, except for dependency loops, where all dependencies involved in the loop are ignored for ordering purposes. Requires: == PreReq: for like 8 years now, but I'm sure you can find any answer you wish to hear regarding rpm PreReq: 73 de Jeff > --Apple-Mail-32-1061315630 Content-Type: text/html; charset=US-ASCII Content-Transfer-Encoding: quoted-printable <html><body style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; = -webkit-line-break: after-white-space; "><br><div><div>On Sep 21, 2008, = at 1:31 PM, Toralf Lund wrote:</div><br = class=3D"Apple-interchange-newline"><blockquote type=3D"cite"><div>Jeff = Johnson wrote:<br><blockquote type=3D"cite"><br></blockquote><blockquote = type=3D"cite">On Sep 15, 2008, at 11:24 PM, Michael A. Peters = wrote:<br></blockquote><blockquote = type=3D"cite"><br></blockquote><blockquote type=3D"cite"><blockquote = type=3D"cite">Toralf Lund = wrote:<br></blockquote></blockquote><blockquote type=3D"cite"><blockquote = type=3D"cite"><blockquote type=3D"cite">I've run into an installation = order issue related to the "post" scriptlet in one of my packages. = Basically, this scripts executes a (command-line only) program installed = by the package, and this program pretty much needs everything required = by the package. The problem is, if I install my package along with some = of the required software, the requirements are often installed *after* = the "main" package [ ... = ]<br></blockquote></blockquote></blockquote><blockquote = type=3D"cite"><blockquote = type=3D"cite"><br></blockquote></blockquote><blockquote = type=3D"cite"><blockquote type=3D"cite">Perhaps my understanding is = wrong - but I believe:<br></blockquote></blockquote><blockquote = type=3D"cite"><blockquote = type=3D"cite"><br></blockquote></blockquote><blockquote = type=3D"cite"><br></blockquote><blockquote = type=3D"cite"><br></blockquote><blockquote type=3D"cite">Um, yes, = wrong.<br></blockquote><blockquote = type=3D"cite"><br></blockquote><blockquote type=3D"cite"><blockquote = type=3D"cite">[ .. ]<br></blockquote></blockquote><blockquote = type=3D"cite"><br></blockquote><blockquote type=3D"cite">The %pre and = %post scripts are run immediately before/after a package is = installed,<br></blockquote><blockquote type=3D"cite">not after all the = packages are installed.<br></blockquote>Exactly. This is what's causing = me trouble; essentially, I have a command that would be better to run at = the end of the entire transaction. But I think I understand why rpm = doesn't work that way...</div></blockquote><div><br></div>There are = %posttrans scriptlets that run at the end of the = transaction.</div><div><br><blockquote type=3D"cite"><div><br><blockquote = type=3D"cite"><br></blockquote><blockquote type=3D"cite">This is also = true for %preun/%postun when a package is erased, the scripts are = run<br></blockquote><blockquote type=3D"cite">immediately before/after = the erasure.<br></blockquote><blockquote = type=3D"cite"><br></blockquote><blockquote type=3D"cite"><blockquote = type=3D"cite">My understanding of this may not be = 100%<br></blockquote></blockquote><blockquote type=3D"cite"><blockquote = type=3D"cite"><br></blockquote></blockquote><blockquote = type=3D"cite"><br></blockquote><blockquote type=3D"cite">What is most = confusing is that rpm does install before erase. Which means that = %post<br></blockquote><blockquote type=3D"cite">scriptlet is run before = %preun is run, which is perhaps counter-intuitive, but is = exactly<br></blockquote><blockquote type=3D"cite">what is needed if = shared libraries are being upgraded on live systems. The new = librrary<br></blockquote><blockquote type=3D"cite">must be installed = before the old library is removed in ordeer to minimize the = window<br></blockquote><blockquote type=3D"cite">where the library is = not available.<br></blockquote>Quite.<br><blockquote = type=3D"cite"><br></blockquote><blockquote type=3D"cite">[ ... = ]<br></blockquote><blockquote type=3D"cite"><br></blockquote><blockquote = type=3D"cite">And finally that brings the topic to context markers like = Requires(post) etc.<br></blockquote><blockquote = type=3D"cite"><br></blockquote><blockquote type=3D"cite">Context markers = like Requires(post) are intended to break dependency loops = while<br></blockquote><blockquote = type=3D"cite">ordering.<br></blockquote><blockquote = type=3D"cite"><br></blockquote><blockquote type=3D"cite">A package that = "needs" some other package solely while running a %post = scriptlet,<br></blockquote><blockquote type=3D"cite">not after being = installed, can carry a Requires(post) hint to the ordering within = rpm.<br></blockquote>In my case the script and the package itself both = need (more or less) the same libs. Logically, they may be seen as = independent sets of dependencies, though, I think...<br><blockquote = type=3D"cite"><br></blockquote><blockquote type=3D"cite">The hint = excludes dependency loops between install <=3D> erase = packages.<br></blockquote><blockquote = type=3D"cite"><br></blockquote><blockquote type=3D"cite">The other major = affect of adding an explicit Requires(post) hint is that = those<br></blockquote><blockquote type=3D"cite">dependencies are not = registered in an rpmdb because they were needed = solely<br></blockquote><blockquote type=3D"cite">for installing, not for = using or erasing, a package. There's no need to keep = track<br></blockquote><blockquote type=3D"cite">of the install context = dependencies after the install has been done = because<br></blockquote><blockquote type=3D"cite">the %post scriptlet is = run only during install, never run after = install.<br></blockquote><blockquote = type=3D"cite"><br></blockquote><blockquote = type=3D"cite">hth<br></blockquote>Well. It doesn't help me too much with = my original issue. But, like I said elsewhere, I can't seem to reproduce = the problem I thought I had, so maybe it doesn't matter. I'm still = confused, though.<br><br>Question: Can I generally assume the packages = are ordered according to "Requires" these days, i.e. that if package A = requires something provided by package B, then B is installed before A = (when A and B are both part of the same transaction)? I'm fairly sure I = couldn't when I started using rpm, so I had to mess about with ""PreReq" = instead...</div></blockquote><div><br></div>Yes, except for dependency = loops, where all dependencies involved</div><div>in the loop are ignored = for ordering purposes.</div><div><br></div><div>Requires: =3D=3D PreReq: = for like 8 years now, but I'm sure you can find</div><div>any answer you = wish to hear regarding rpm PreReq:</div><div><br></div><div>73 de = Jeff</div><div><blockquote type=3D"cite"><div><font = class=3D"Apple-style-span" color=3D"#000000"><font = class=3D"Apple-style-span" = color=3D"#144FAE"><br></font></font></div></blockquote></div></body></html= >= --Apple-Mail-32-1061315630-- --===============0858458194== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Rpm-list mailing list [email protected] https://www.redhat.com/mailman/listinfo/rpm-list --===============0858458194==--