[Fedora-packaging] Upgrade scriptlet

Ville Skyttä ville.skytta at iki.fi
Tue Apr 19 21:40:23 UTC 2011


On 04/17/2011 03:28 PM, Michael Schwendt wrote:

> What needs a fix then? The existing documentation (and any %postun
> scriptlets that do $1 -eq 1 to check for an upgrade) or RPM?

I think at least the former needs a fix, because even if rpm was changed
there would still be versions of it around in active distros that have
the current behavior.  And I'm not sure if the obvious change to rpm
which would make it count what it passes as $1 based on name+arch
instead of just name would be a clear improvement, it would suffer from
similar problems.

BTW it's not only %postun that's affected, all of them that receive the
number of packages this way as an argument are.  For example %post: if
you install foo.i386 and foo.x86_64 (separately or in the same
transaction, doesn't matter) and no foo is previously installed,
whichever of them is installed first sees $1 set to 1 in %post, the
second sees it set to 2.

One guideline could be to try avoid using $1 at all, and instead try to
use some other means to find out what needs to happen.  But that might
not always be too easy.

> And which %postun is executed first? i686 or x86_64?

I'd hope that's a question that doesn't need answering - if one needs to
ask it, one is probably doing something wrong and needs to do the
scriptlets differently.  Note "hope", I don't know if it's possible to
always avoid thinking about it but then again I don't have an example at
hand that would actually require thinking about it.

> Doesn't that break arch-specific scripts like the following?
> https://fedoraproject.org/wiki/Packaging:ScriptletSnippets#GIO_modules

Quite probably - I didn't look into it in that much detail, but quickly
reading your analysis it makes sense to me.


More information about the packaging mailing list