FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Fedora Packaging

 
 
LinkBack Thread Tools
 
Old 04-16-2011, 09:11 AM
Thomas Moschny
 
Default Upgrade scriptlet

Hi,

when I want a script to be run during package upgrade, is it better to
call it in %postun if $1>=1, or to call it in
%post if $1>1? Is one of the two possibilities preferred?

Thanks,
Thomas


--
Thomas Moschny <thomas.moschny@gmail.com>
--
packaging mailing list
packaging@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/packaging
 
Old 04-17-2011, 07:12 AM
Michael Schwendt
 
Default Upgrade scriptlet

On Sat, 16 Apr 2011 11:11:28 +0200, TM wrote:

> Hi,
>
> when I want a script to be run during package upgrade, is it better to
> call it in %postun if $1>=1, or to call it in
> %post if $1>1? Is one of the two possibilities preferred?

It depends on what the script is supposed to do and whether files from the
old pkg are still around and may be needed by the script/program or may
confuse the script/program. When %postun is executed, any old pkg files
have been removed already.

$1>=1 for %postun would not be well-defined, btw.

https://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Syntax
https://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Scriptlet_Ordering

--
packaging mailing list
packaging@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/packaging
 
Old 04-17-2011, 08:46 AM
Ville Skyttä
 
Default Upgrade scriptlet

On 04/17/2011 10:12 AM, Michael Schwendt wrote:

> $1>=1 for %postun would not be well-defined, btw.

How so?

> https://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Syntax

By the way, there are two things that could be improved in that section:

1) Typo: s/package upgrade form/package upgrade from/

2) It notes that the arguments will vary with parallel installable
packages such as the kernel. It would be good to note that in addition
to kernel this occurs also when multiple arch versions of the same
package is installed which is a common scenario on x86_64 systems, which
means simply testing for $1 to find out if something is being upgraded
or installed initially or removed may be dangerous, depending on the
case. For example if you install foo.i686 first, then later foo.x86_64:
at the time foo.x86_64's %post runs, $1 will be 2 in it even if nothing
is actually being upgraded.
--
packaging mailing list
packaging@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/packaging
 
Old 04-17-2011, 09:25 AM
Michael Schwendt
 
Default Upgrade scriptlet

On Sun, 17 Apr 2011 11:46:31 +0300, VS wrote:

> > $1>=1 for %postun would not be well-defined, btw.
>
> How so?

That $1 is <=1 in %postun, and hence checking for >=1 includes
a non-existing condition.
--
packaging mailing list
packaging@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/packaging
 
Old 04-17-2011, 10:02 AM
Ville Skyttä
 
Default Upgrade scriptlet

On 04/17/2011 12:25 PM, Michael Schwendt wrote:
> On Sun, 17 Apr 2011 11:46:31 +0300, VS wrote:
>
>>> $1>=1 for %postun would not be well-defined, btw.
>>
>> How so?
>
> That $1 is <=1 in %postun, and hence checking for >=1 includes
> a non-existing condition.

$1 can be > 1 in %postun when there are parallel installations involved,
for example when upgrading installed foo-1.0.i686 and foo-1.0.x86_64
packages to foo-1.1.i686 and foo-1.1.x86_64.
--
packaging mailing list
packaging@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/packaging
 
Old 04-17-2011, 12:28 PM
Michael Schwendt
 
Default Upgrade scriptlet

On Sun, 17 Apr 2011 13:02:12 +0300, VS wrote:

> >>> $1>=1 for %postun would not be well-defined, btw.
> >>
> >> How so?
> >
> > That $1 is <=1 in %postun, and hence checking for >=1 includes
> > a non-existing condition.
>
> $1 can be > 1 in %postun when there are parallel installations involved,
> for example when upgrading installed foo-1.0.i686 and foo-1.0.x86_64
> packages to foo-1.1.i686 and foo-1.1.x86_64.

What needs a fix then? The existing documentation (and any %postun
scriptlets that do $1 -eq 1 to check for an upgrade) or RPM?
And which %postun is executed first? i686 or x86_64?

Similar question wrt earlier your %post multiarch example:

> For example if you install foo.i686 first, then later foo.x86_64:
> at the time foo.x86_64's %post runs, $1 will be 2 in it even if nothing
> is actually being upgraded.

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

| %postun
| gio-querymodules-%{__isa_bits} %{_libdir}/gio/modules &> /dev/null || :
|
| %post
| if [ $1 -eq 1 ] ; then
| # For upgrades, the cache will be regenerated by the new package's %postun
| gio-querymodules-%{__isa_bits} %{_libdir}/gio/modules || :
| fi

%post for the x86_64 would not refresh the cache, because $1 -eq 1 is false.
Is there a %postun call for the old pkg (i.e. the i686 pkg)? If so, that
%postun would refresh the wrong cache due to %_libdir.
Or is there no %postun call because the install is not an upgrade?
Then the cache would not be refreshed at all for the x86_64 install.
--
packaging mailing list
packaging@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/packaging
 
Old 04-17-2011, 02:09 PM
yersinia spiros
 
Default Upgrade scriptlet

Dunno if OT. This thread remember me of an old rpm RFE about to doing
the scriptlet arch specific. Is it Perhaps related ? I have forgetten
the details. Best regards

2011/4/17, Michael Schwendt <mschwendt@gmail.com>:
> On Sun, 17 Apr 2011 13:02:12 +0300, VS wrote:
>
>> >>> $1>=1 for %postun would not be well-defined, btw.
>> >>
>> >> How so?
>> >
>> > That $1 is <=1 in %postun, and hence checking for >=1 includes
>> > a non-existing condition.
>>
>> $1 can be > 1 in %postun when there are parallel installations involved,
>> for example when upgrading installed foo-1.0.i686 and foo-1.0.x86_64
>> packages to foo-1.1.i686 and foo-1.1.x86_64.
>
> What needs a fix then? The existing documentation (and any %postun
> scriptlets that do $1 -eq 1 to check for an upgrade) or RPM?
> And which %postun is executed first? i686 or x86_64?
>
> Similar question wrt earlier your %post multiarch example:
>
>> For example if you install foo.i686 first, then later foo.x86_64:
>> at the time foo.x86_64's %post runs, $1 will be 2 in it even if nothing
>> is actually being upgraded.
>
> Doesn't that break arch-specific scripts like the following?
> https://fedoraproject.org/wiki/Packaging:ScriptletSnippets#GIO_modules
>
> | %postun
> | gio-querymodules-%{__isa_bits} %{_libdir}/gio/modules &> /dev/null || :
> |
> | %post
> | if [ $1 -eq 1 ] ; then
> | # For upgrades, the cache will be regenerated by the new package's
> %postun
> | gio-querymodules-%{__isa_bits} %{_libdir}/gio/modules || :
> | fi
>
> %post for the x86_64 would not refresh the cache, because $1 -eq 1 is false.
> Is there a %postun call for the old pkg (i.e. the i686 pkg)? If so, that
> %postun would refresh the wrong cache due to %_libdir.
> Or is there no %postun call because the install is not an upgrade?
> Then the cache would not be refreshed at all for the x86_64 install.
> --
> packaging mailing list
> packaging@lists.fedoraproject.org
> https://admin.fedoraproject.org/mailman/listinfo/packaging
>

--
Inviato dal mio dispositivo mobile
--
packaging mailing list
packaging@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/packaging
 
Old 04-19-2011, 09:40 PM
Ville Skyttä
 
Default Upgrade scriptlet

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.
--
packaging mailing list
packaging@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/packaging
 
Old 04-19-2011, 09:50 PM
Ville Skyttä
 
Default Upgrade scriptlet

On 04/17/2011 10:12 AM, Michael Schwendt wrote:
> On Sat, 16 Apr 2011 11:11:28 +0200, TM wrote:
>
>> Hi,
>>
>> when I want a script to be run during package upgrade, is it better to
>> call it in %postun if $1>=1, or to call it in
>> %post if $1>1? Is one of the two possibilities preferred?
>
> It depends on what the script is supposed to do and whether files from the
> old pkg are still around and may be needed by the script/program or may
> confuse the script/program. When %postun is executed, any old pkg files
> have been removed already.

One important additional consideration is that when using %post, you can
control what happens in your new package. With %postun, it's the old
package's %postun that runs on upgrades, which could be a problem and
something that can be hard to work around in the new package. One
example of such a problem from this list yesterday:

http://lists.fedoraproject.org/pipermail/packaging/2011-April/007744.html
--
packaging mailing list
packaging@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/packaging
 
Old 04-30-2011, 03:21 PM
Toshio Kuratomi
 
Default Upgrade scriptlet

On Sun, Apr 17, 2011 at 11:46:31AM +0300, Ville Skyttä wrote:
> By the way, there are two things that could be improved in that section:
>
> 1) Typo: s/package upgrade form/package upgrade from/
>
> 2) It notes that the arguments will vary with parallel installable
> packages such as the kernel. It would be good to note that in addition
> to kernel this occurs also when multiple arch versions of the same
> package is installed which is a common scenario on x86_64 systems, which
> means simply testing for $1 to find out if something is being upgraded
> or installed initially or removed may be dangerous, depending on the
> case. For example if you install foo.i686 first, then later foo.x86_64:
> at the time foo.x86_64's %post runs, $1 will be 2 in it even if nothing
> is actually being upgraded.
>
Updated. See if it's satisfactory now.

https://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Syntax

-Toshio

--
packaging mailing list
packaging@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/packaging
 

Thread Tools




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

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org