%post RPM scriptlets and dependencies

2015-12-10 Thread Florian Weimer
When a %post scriptlet runs, is it guaranteed that the Requires:
dependencies have been unpacked?  I understand that for cycle-breaking
purposes, it may not be true that the scriptlets for dependencies have
run.  But are the files already there?

(I'm interested in plain Requires, not Requires(post) etc.)

Has the behavior changed since RPM 4.8?

Thanks,
Florian
--
devel mailing list
devel@lists.fedoraproject.org
http://lists.fedoraproject.org/admin/lists/devel@lists.fedoraproject.org


Re: %post RPM scriptlets and dependencies

2015-12-10 Thread Florian Weimer
On 12/10/2015 12:53 PM, Rex Dieter wrote:
> Florian Weimer wrote:
> 
>> When a %post scriptlet runs, is it guaranteed that the Requires:
>> dependencies have been unpacked?  I understand that for cycle-breaking
>> purposes, it may not be true that the scriptlets for dependencies have
>> run.  But are the files already there?
> 
> I think the answer in general is no, you cannot be guaranteed that Requires: 
> get installed before %post runs.

Note that I'm not asking about the “installed” part, I just need the
files to be in place.

Is this an RPM limitation because it does not distinguish between the
unpacked and installed case?  (dpkg does, so this situation is totally
deterministic there: for a regular dependency, when the postinst runs,
you can rely on your dependencies having been unpacked, but *their*
postinst may not have been run yet and they might be in an unconfigured
state.)

Florian
--
devel mailing list
devel@lists.fedoraproject.org
http://lists.fedoraproject.org/admin/lists/devel@lists.fedoraproject.org


Re: %post RPM scriptlets and dependencies

2015-12-10 Thread Rex Dieter
Florian Weimer wrote:

> When a %post scriptlet runs, is it guaranteed that the Requires:
> dependencies have been unpacked?  I understand that for cycle-breaking
> purposes, it may not be true that the scriptlets for dependencies have
> run.  But are the files already there?

I think the answer in general is no, you cannot be guaranteed that Requires: 
get installed before %post runs.  That's one reason why Requires(post) 
exists.

-- Rex
--
devel mailing list
devel@lists.fedoraproject.org
http://lists.fedoraproject.org/admin/lists/devel@lists.fedoraproject.org


Re: %post RPM scriptlets and dependencies

2015-12-10 Thread Reindl Harald



Am 10.12.2015 um 12:53 schrieb Rex Dieter:

Florian Weimer wrote:


When a %post scriptlet runs, is it guaranteed that the Requires:
dependencies have been unpacked?  I understand that for cycle-breaking
purposes, it may not be true that the scriptlets for dependencies have
run.  But are the files already there?


I think the answer in general is no, you cannot be guaranteed that Requires:
get installed before %post runs.  That's one reason why Requires(post)
exists


sounds terrible

what's with the "Require" of a "Requires(post)" to guarantee that the 
"Requires(post)" *really* work sucessful? sounds fragile




signature.asc
Description: OpenPGP digital signature
--
devel mailing list
devel@lists.fedoraproject.org
http://lists.fedoraproject.org/admin/lists/devel@lists.fedoraproject.org

Re: %post RPM scriptlets and dependencies

2015-12-10 Thread Panu Matilainen

On 12/10/2015 11:41 AM, Florian Weimer wrote:

When a %post scriptlet runs, is it guaranteed that the Requires:
dependencies have been unpacked?  I understand that for cycle-breaking
purposes, it may not be true that the scriptlets for dependencies have
run.  But are the files already there?

(I'm interested in plain Requires, not Requires(post) etc.)


Requires and Requires(post) are equal in ordering except for 
loop-breaking purposes. When no loops are present, both guarantee the 
files are there. When dependency loops are involved rpm makes an 
educated guess to cut it but obviously there can be no absolute guarantee.



Has the behavior changed since RPM 4.8?


The basic rules above have stayed the same since rpm 4.0 days. 4.8 had a 
major ordering rewrite to better handle loops, since then some corner 
case bugs have been fixed, but no major rule changes. What does change 
constantly is the package set and the loops within it.


- Panu -
--
devel mailing list
devel@lists.fedoraproject.org
http://lists.fedoraproject.org/admin/lists/devel@lists.fedoraproject.org


Re: %post RPM scriptlets and dependencies

2015-12-10 Thread Neal Gompa
On Thu, Dec 10, 2015 at 7:52 AM, Michael Schroeder  wrote:

> On Thu, Dec 10, 2015 at 12:58:41PM +0100, Reindl Harald wrote:
> > Am 10.12.2015 um 12:53 schrieb Rex Dieter:
> > >Florian Weimer wrote:
> > >
> > >>When a %post scriptlet runs, is it guaranteed that the Requires:
> > >>dependencies have been unpacked?  I understand that for cycle-breaking
> > >>purposes, it may not be true that the scriptlets for dependencies have
> > >>run.  But are the files already there?
> > >
> > >I think the answer in general is no, you cannot be guaranteed that
> Requires:
> > >get installed before %post runs.  That's one reason why Requires(post)
> > >exists
> >
> > sounds terrible
> >
> > what's with the "Require" of a "Requires(post)" to guarantee that
> > the "Requires(post)" *really* work sucessful? sounds fragile
>
> Relax, the difference between Requires and Requires(post) is rather
> small. It only makes a difference when breaking dependency cycles,
> and in that case there's no correct solution anyway.
>
> I.e. if package A has "Requires: B" and package B has
> "Requires(post): A", there's really no correct order.
>
> "First A then B" is incorrect because "A Requires B" may mean that
> B must by 100% installed (with postinstall scriptlets) for A to work,
> thus A may still not work in B's post script.
>
> Cheers,
>   Michael.
>
> --
> Michael Schroeder   m...@suse.de
> SUSE LINUX GmbH,   GF Jeff Hawn, HRB 16746 AG Nuernberg
> main(_){while(_=~getchar())putchar(~_-1/(~(_|32)/13*2-11)*13);}
>
>
​As I recall, I believe there was a way in RPM at some point to declare a
dependency that *must* be unpacked and installed prior to ​starting to do
anything with a package, but I don't remember what is was. Debian has the
equivalent as "Pre-Depends", which essentially guarantees that it is
unpacked prior to starting the installation (and running associated
scriptlets). I think it was called "PreReq", but I vaguely remember hearing
at one point that this doesn't actually work anymore?



-- 
真実はいつも一つ!/ Always, there's only one truth!
--
devel mailing list
devel@lists.fedoraproject.org
http://lists.fedoraproject.org/admin/lists/devel@lists.fedoraproject.org

Re: %post RPM scriptlets and dependencies

2015-12-10 Thread Florian Weimer
On 12/10/2015 01:32 PM, Panu Matilainen wrote:
> On 12/10/2015 11:41 AM, Florian Weimer wrote:
>> When a %post scriptlet runs, is it guaranteed that the Requires:
>> dependencies have been unpacked?  I understand that for cycle-breaking
>> purposes, it may not be true that the scriptlets for dependencies have
>> run.  But are the files already there?
>>
>> (I'm interested in plain Requires, not Requires(post) etc.)
> 
> Requires and Requires(post) are equal in ordering except for
> loop-breaking purposes. When no loops are present, both guarantee the
> files are there. When dependency loops are involved rpm makes an
> educated guess to cut it but obviously there can be no absolute guarantee.

I dispute the “obviously” part, with regard to unpacked files. :)

But as I understand it, RPM does not distinguish between unpacking and
configuring as a far as dependencies are concerned.  This means that
when it comes to %post scriptlets, dependencies are far stronger than
with Debian's dpkg, and the cycle-breaking mechanisms are required more
often.

Florian
--
devel mailing list
devel@lists.fedoraproject.org
http://lists.fedoraproject.org/admin/lists/devel@lists.fedoraproject.org


Re: %post RPM scriptlets and dependencies

2015-12-10 Thread Panu Matilainen

On 12/10/2015 02:32 PM, Panu Matilainen wrote:

On 12/10/2015 11:41 AM, Florian Weimer wrote:

When a %post scriptlet runs, is it guaranteed that the Requires:
dependencies have been unpacked?  I understand that for cycle-breaking
purposes, it may not be true that the scriptlets for dependencies have
run.  But are the files already there?

(I'm interested in plain Requires, not Requires(post) etc.)


Requires and Requires(post) are equal in ordering except for
loop-breaking purposes. When no loops are present, both guarantee the
files are there. When dependency loops are involved rpm makes an
educated guess to cut it but obviously there can be no absolute guarantee.


To elaborate/generalize a bit: Requires and Requires(foo) are equal in 
ordering, except for loop-breaking purposes. In presence of loops rpm 
favors the (foo) variants, but Requires(pre) and Requires(post) etc are 
equal among themselves.


So if you have two packages Requires(pre/post/interp)'ing each-other 
then they're obviously equal and the loop-cutting is reduced to lottery 
again. Rpm does weigh package importance based on number of dependents 
but that only turns the lottery into an educated guess, which can be 
"incorrect".


- Panu -
--
devel mailing list
devel@lists.fedoraproject.org
http://lists.fedoraproject.org/admin/lists/devel@lists.fedoraproject.org


Re: %post RPM scriptlets and dependencies

2015-12-10 Thread Michael Schroeder
On Thu, Dec 10, 2015 at 12:58:41PM +0100, Reindl Harald wrote:
> Am 10.12.2015 um 12:53 schrieb Rex Dieter:
> >Florian Weimer wrote:
> >
> >>When a %post scriptlet runs, is it guaranteed that the Requires:
> >>dependencies have been unpacked?  I understand that for cycle-breaking
> >>purposes, it may not be true that the scriptlets for dependencies have
> >>run.  But are the files already there?
> >
> >I think the answer in general is no, you cannot be guaranteed that Requires:
> >get installed before %post runs.  That's one reason why Requires(post)
> >exists
> 
> sounds terrible
> 
> what's with the "Require" of a "Requires(post)" to guarantee that
> the "Requires(post)" *really* work sucessful? sounds fragile

Relax, the difference between Requires and Requires(post) is rather
small. It only makes a difference when breaking dependency cycles,
and in that case there's no correct solution anyway.

I.e. if package A has "Requires: B" and package B has
"Requires(post): A", there's really no correct order.

"First A then B" is incorrect because "A Requires B" may mean that
B must by 100% installed (with postinstall scriptlets) for A to work,
thus A may still not work in B's post script.

Cheers,
  Michael.

-- 
Michael Schroeder   m...@suse.de
SUSE LINUX GmbH,   GF Jeff Hawn, HRB 16746 AG Nuernberg
main(_){while(_=~getchar())putchar(~_-1/(~(_|32)/13*2-11)*13);}
--
devel mailing list
devel@lists.fedoraproject.org
http://lists.fedoraproject.org/admin/lists/devel@lists.fedoraproject.org


Re: %post RPM scriptlets and dependencies

2015-12-10 Thread Panu Matilainen

On 12/10/2015 02:57 PM, Neal Gompa wrote:

On Thu, Dec 10, 2015 at 7:52 AM, Michael Schroeder  wrote:


On Thu, Dec 10, 2015 at 12:58:41PM +0100, Reindl Harald wrote:

Am 10.12.2015 um 12:53 schrieb Rex Dieter:

Florian Weimer wrote:


When a %post scriptlet runs, is it guaranteed that the Requires:
dependencies have been unpacked?  I understand that for cycle-breaking
purposes, it may not be true that the scriptlets for dependencies have
run.  But are the files already there?


I think the answer in general is no, you cannot be guaranteed that

Requires:

get installed before %post runs.  That's one reason why Requires(post)
exists


sounds terrible

what's with the "Require" of a "Requires(post)" to guarantee that
the "Requires(post)" *really* work sucessful? sounds fragile


Relax, the difference between Requires and Requires(post) is rather
small. It only makes a difference when breaking dependency cycles,
and in that case there's no correct solution anyway.

I.e. if package A has "Requires: B" and package B has
"Requires(post): A", there's really no correct order.

"First A then B" is incorrect because "A Requires B" may mean that
B must by 100% installed (with postinstall scriptlets) for A to work,
thus A may still not work in B's post script.

Cheers,
   Michael.

--
Michael Schroeder   m...@suse.de
SUSE LINUX GmbH,   GF Jeff Hawn, HRB 16746 AG Nuernberg
main(_){while(_=~getchar())putchar(~_-1/(~(_|32)/13*2-11)*13);}



​As I recall, I believe there was a way in RPM at some point to declare a
dependency that *must* be unpacked and installed prior to ​starting to do
anything with a package, but I don't remember what is was. Debian has the
equivalent as "Pre-Depends", which essentially guarantees that it is
unpacked prior to starting the installation (and running associated
scriptlets). I think it was called "PreReq", but I vaguely remember hearing
at one point that this doesn't actually work anymore?


PreReq is/was only a less clearly defined version of 
Requires(pre/post/interp) etc, its not any "stronger" than the newer 
variants.


The only Right Thing to do on "balanced" dependency loops would be to 
error out, but rpm never did that. In many cases delayed script 
execution would help, but rpm doesn't support that.


- Panu -



--
devel mailing list
devel@lists.fedoraproject.org
http://lists.fedoraproject.org/admin/lists/devel@lists.fedoraproject.org

Re: %post RPM scriptlets and dependencies

2015-12-10 Thread Panu Matilainen

On 12/10/2015 03:12 PM, Florian Weimer wrote:

On 12/10/2015 01:32 PM, Panu Matilainen wrote:

On 12/10/2015 11:41 AM, Florian Weimer wrote:

When a %post scriptlet runs, is it guaranteed that the Requires:
dependencies have been unpacked?  I understand that for cycle-breaking
purposes, it may not be true that the scriptlets for dependencies have
run.  But are the files already there?

(I'm interested in plain Requires, not Requires(post) etc.)


Requires and Requires(post) are equal in ordering except for
loop-breaking purposes. When no loops are present, both guarantee the
files are there. When dependency loops are involved rpm makes an
educated guess to cut it but obviously there can be no absolute guarantee.


I dispute the “obviously” part, with regard to unpacked files. :)

But as I understand it, RPM does not distinguish between unpacking and
configuring as a far as dependencies are concerned.  This means that
when it comes to %post scriptlets, dependencies are far stronger than
with Debian's dpkg, and the cycle-breaking mechanisms are required more
often.


Correct, rpm does not distinguish between unpacked and configured. It 
doesn't make much difference since it does not support delayed script 
execution.


- Panu -
--
devel mailing list
devel@lists.fedoraproject.org
http://lists.fedoraproject.org/admin/lists/devel@lists.fedoraproject.org