Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   RPM Package Manager (http://www.linux-archive.org/rpm-package-manager/)
-   -   Dependency problem when "post" runs command from the rpm (http://www.linux-archive.org/rpm-package-manager/157812-dependency-problem-when-post-runs-command-rpm.html)

Toralf Lund 09-11-2008 09:15 AM

Dependency problem when "post" runs command from the rpm
 
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 - which
means the "post" script won't work because some of what the program
needs isn't installed yet.


So, this is when I use "Requires(post)", isn't it? But how do I set it
up? The Requires of the package is a very long list, and most of the
entries are added via the "AutoReqProv" mechanism, so duplicating the
info by hand for "Requires(post)" is rather hard. Is there an
alternative? Can I somehow say that everything in the main Requires list
is also required by "post"? Or alternatively, can I enable automatic
search for shared objects etc. for Requires(post) just like for Requires?


- Toralf






_______________________________________________
Rpm-list mailing list
Rpm-list@redhat.com
https://www.redhat.com/mailman/listinfo/rpm-list

Valery Reznic 09-11-2008 10:01 AM

Dependency problem when "post" runs command from the rpm
 
--- On Thu, 9/11/08, Toralf Lund <toralf@procaptura.com> wrote:

> From: Toralf Lund <toralf@procaptura.com>
> Subject: Dependency problem when "post" runs command from the rpm
> To: "RPM Mailing List" <rpm-list@redhat.com>
> Date: Thursday, September 11, 2008, 12:15 PM
> 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 - which
> means the "post" script won't work because
> some of what the program
> needs isn't installed yet.
>
> So, this is when I use "Requires(post)",
> isn't it? But how do I set it
to keep Requires and Requires(post) in sync
you

> up? The Requires of the package is a very long list, and
> most of the
> entries are added via the "AutoReqProv"
> mechanism, so duplicating the
> info by hand for "Requires(post)" is rather hard.
> Is there an
> alternative? Can I somehow say that everything in the main
> Requires list
> is also required by "post"? Or alternatively, can
> I enable automatic
> search for shared objects etc. for Requires(post) just like
> for Requires?
To keep Requires and Requires(post) in sync you can use rpmrebuild
(http://rpmrebuild.sf.net)
First you build your package as usual.
Then you use rpmrebuild to rebuild package. You'll need to write plugin for --change-spec-requires.
It's can be something like

sed -n -e 'p' -e 's/^Requires:/Requires(post):/p'

Valery

>
> - Toralf
>
>
>
>
>
>
> _______________________________________________
> Rpm-list mailing list
> Rpm-list@redhat.com
> https://www.redhat.com/mailman/listinfo/rpm-list




_______________________________________________
Rpm-list mailing list
Rpm-list@redhat.com
https://www.redhat.com/mailman/listinfo/rpm-list

Toralf Lund 09-12-2008 06:49 AM

Dependency problem when "post" runs command from the rpm
 
Valery Reznic wrote:


--- On Thu, 9/11/08, Toralf Lund <toralf@procaptura.com> wrote:



From: Toralf Lund <toralf@procaptura.com>
Subject: Dependency problem when "post" runs command from the rpm
To: "RPM Mailing List" <rpm-list@redhat.com>
Date: Thursday, September 11, 2008, 12:15 PM
I've run into an installation order issue related to the
"post" [ ... ]

So, this is when I use "Requires(post)",
isn't it? But how do I set it

up? The Requires of the package is a very long list, and
most of the
entries are added via the "AutoReqProv"
mechanism, so duplicating the
info by hand for "Requires(post)" is rather hard. [ ... ]




To keep Requires and Requires(post) in sync you can use rpmrebuild
(http://rpmrebuild.sf.net)
First you build your package as usual.
Then you use rpmrebuild to rebuild package. You'll need to write plugin for --change-spec-requires.
It's can be something like


Right. I never thought of that.

This does seems like a rather roundabout way of going about it, though,
and I was really hoping for some sort of support within rpmbuild itself.


Thanks anyway...

- Toralf

sed -n -e 'p' -e 's/^Requires:/Requires(post):/p'

Valery



- Toralf






_______________________________________________
Rpm-list mailing list
Rpm-list@redhat.com
https://www.redhat.com/mailman/listinfo/rpm-list







_______________________________________________
Rpm-list mailing list
Rpm-list@redhat.com
https://www.redhat.com/mailman/listinfo/rpm-list




--
Toralf Lund <toralf@procaptura.com> +47 66 85 51 22
ProCaptura AS +47 66 85 51 00 (switchboard)
http://www.procaptura.com/ +47 66 85 51 01 (fax)

_______________________________________________
Rpm-list mailing list
Rpm-list@redhat.com
https://www.redhat.com/mailman/listinfo/rpm-list

Toralf Lund 09-12-2008 01:33 PM

Dependency problem when "post" runs command from the rpm
 
Toralf Lund wrote:

Valery Reznic wrote:


[ ... ]



So, this is when I use "Requires(post)",
isn't it? But how do I set it up? The Requires of the package is
a very long list, and

most of the entries are added via the "AutoReqProv"
mechanism, so duplicating the info by hand for "Requires(post)" is
rather hard. [ ... ]




To keep Requires and Requires(post) in sync you can use rpmrebuild
(http://rpmrebuild.sf.net)
First you build your package as usual.
Then you use rpmrebuild to rebuild package. You'll need to write
plugin for --change-spec-requires.

It's can be something like


Right. I never thought of that.

This does seems like a rather roundabout way of going about it,
though, and I was really hoping for some sort of support within
rpmbuild itself.
But actually, I can't seem to reproduce the original problem now, i.e.
when I retry the installation, the packages are installed in the
"correct" order without Requires(pre). And many this is what I should
expect; rpm does try to order packages according to (normal) Requires
these days, doesn't it.


Yet I'm quite sure that it somehow decided to install the package using
certain libs after the ones providing them when I tested this earlier.


I'm confused ;-(

- Toralf

_______________________________________________
Rpm-list mailing list
Rpm-list@redhat.com
https://www.redhat.com/mailman/listinfo/rpm-list

Toralf Lund 09-12-2008 01:43 PM

Dependency problem when "post" runs command from the rpm
 
Toralf Lund wrote:

Toralf Lund wrote:

Valery Reznic wrote:


[ ... ]



So, this is when I use "Requires(post)",
isn't it? But how do I set it up? The Requires of the package
is a very long list, and

most of the entries are added via the "AutoReqProv"
mechanism, so duplicating the info by hand for "Requires(post)" is
rather hard. [ ... ]




To keep Requires and Requires(post) in sync you can use rpmrebuild
(http://rpmrebuild.sf.net)
First you build your package as usual.
Then you use rpmrebuild to rebuild package. You'll need to write
plugin for --change-spec-requires.

It's can be something like


Right. I never thought of that.

This does seems like a rather roundabout way of going about it,
though, and I was really hoping for some sort of support within
rpmbuild itself.
But actually, I can't seem to reproduce the original problem now, i.e.
when I retry the installation, the packages are installed in the
"correct" order without Requires(pre). And many this is what I should
expect; rpm does try to order packages according to (normal) Requires
these days, doesn't it.


Yet I'm quite sure that it somehow decided to install the package
using certain libs after the ones providing them when I tested this
earlier.


I'm confused ;-(
... confused enough to get the above bit the wrong way around. What I
meant to say, was that a package requiring some libs was somewhat
unexpectedly installed first of all even though rpms providing the libs
were specified on the same command line.


- Toralf

_______________________________________________
Rpm-list mailing list
Rpm-list@redhat.com
https://www.redhat.com/mailman/listinfo/rpm-list

"Michael A. Peters" 09-16-2008 03:24 AM

Dependency problem when "post" runs command from the rpm
 
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 - which
means the "post" script won't work because some of what the program
needs isn't installed yet.


So, this is when I use "Requires(post)", isn't it? But how do I set it
up? The Requires of the package is a very long list, and most of the
entries are added via the "AutoReqProv" mechanism, so duplicating the
info by hand for "Requires(post)" is rather hard. Is there an
alternative? Can I somehow say that everything in the main Requires list
is also required by "post"? Or alternatively, can I enable automatic
search for shared objects etc. for Requires(post) just like for Requires?


Perhaps my understanding is wrong - but I believe:

Requires(pre) is when something is required for a pre-install script.
Requires(post) is when something is required for a post-install script
but not necessarily for the package itself - IE you could remove the
dependency after the post script has run.


When installing a group of RPMs together, the post scripts are not run
until after all the packages are installed - so if foo requires bar and
the foo post script needs bar installed - just Requires: bar should
ensure that bar is actually installed before the foo post scriptlet runs.


My understanding of this may not be 100%

_______________________________________________
Rpm-list mailing list
Rpm-list@redhat.com
https://www.redhat.com/mailman/listinfo/rpm-list

Jeff Johnson 09-16-2008 03:12 PM

Dependency problem when "post" runs command from the rpm
 
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 - which means the "post" script won't work because some of
what the program needs isn't installed yet.
So, this is when I use "Requires(post)", isn't it? But how do I set
it up? The Requires of the package is a very long list, and most of
the entries are added via the "AutoReqProv" mechanism, so
duplicating the info by hand for "Requires(post)" is rather hard.
Is there an alternative? Can I somehow say that everything in the
main Requires list is also required by "post"? Or alternatively,
can I enable automatic search for shared objects etc. for
Requires(post) just like for Requires?


Perhaps my understanding is wrong - but I believe:




Um, yes, wrong.


Requires(pre) is when something is required for a pre-install script.
Requires(post) is when something is required for a post-install
script but not necessarily for the package itself - IE you could
remove the dependency after the post script has run.


When installing a group of RPMs together, the post scripts are not
run until after all the packages are installed - so if foo requires
bar and the foo post script needs bar installed - just Requires: bar
should ensure that bar is actually installed before the foo post
scriptlet runs.




The %pre and %post scripts are run immediately before/after a package
is installed,

not after all the packages are installed.

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.

Another confusion is the relationship on upgrade between the new
installed package and
the older erased package(s) (note that Obsoletes: can/will lead to
multiple packages to be
erased). rpm has never guaranteed any relation between installed <->
erased package
ordering other than "Erasing is after install." As originally
implemented, erasing was immediately
after install. Nothing wrong with that except that forces the erasure
to happen before
the next install is attempted, whgich is slower than delaying all
erasures until later,
as erasures can always be run in parallel (assuming that erasure
dependencies
are accurate and that erasures are well ordered, but even those
details usually

don't matter on upgrade).

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.


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

73 de jeff


_______________________________________________
Rpm-list mailing list
Rpm-list@redhat.com
https://www.redhat.com/mailman/listinfo/rpm-list


_______________________________________________
Rpm-list mailing list
Rpm-list@redhat.com
https://www.redhat.com/mailman/listinfo/rpm-list

Toralf Lund 09-21-2008 05:31 PM

Dependency problem when "post" runs command from the rpm
 
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...


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...


73 de jeff


_______________________________________________
Rpm-list mailing list
Rpm-list@redhat.com
https://www.redhat.com/mailman/listinfo/rpm-list


_______________________________________________
Rpm-list mailing list
Rpm-list@redhat.com
https://www.redhat.com/mailman/listinfo/rpm-list


_______________________________________________
Rpm-list mailing list
Rpm-list@redhat.com
https://www.redhat.com/mailman/listinfo/rpm-list

Jeff Johnson 09-21-2008 09:56 PM

Dependency problem when "post" runs command from the rpm
 
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 involvedin the loop are ignored for ordering purposes.
Requires: == PreReq: for like 8 years now, but I'm sure you can findany answer you wish to hear regarding rpm PreReq:
73 de Jeff
_______________________________________________
Rpm-list mailing list
Rpm-list@redhat.com
https://www.redhat.com/mailman/listinfo/rpm-list


All times are GMT. The time now is 06:49 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.