* [PATCH 0/2] RPM/upgrade fixes
@ 2011-11-09 12:05 Paul Eggleton
2011-11-09 12:05 ` [PATCH 1/2] classes/package_rpm: disable uninstall scripts for upgrades Paul Eggleton
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Paul Eggleton @ 2011-11-09 12:05 UTC (permalink / raw)
To: openembedded-core
This is the fix for the problem Anders reported on the Yocto mailing
list (now filed as Yocto bug #1760). I've checked through usage of
postrm/prerm in oe-core and meta-oe and it looks OK to me, but it
would help for others to double-check it.
I considered whether or not it would be worth bumping PR on every
recipe that uses prerm/postrm, however this is a *lot* of recipes.
Also included is another fix for a minor issue I discovered when
uninstalling busybox.
The following changes since commit 25fae81538a92e15eab3fc169ebce44505f67839:
python: skip setup.py 'import check' when cross-compiling (2011-11-08 21:44:23 +0000)
are available in the git repository at:
git://git.openembedded.org/openembedded-core-contrib paule/rmscripts
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=paule/rmscripts
Paul Eggleton (2):
classes/package_rpm: disable uninstall scripts for upgrades
busybox: add grep to temporary links during uninstall
meta/classes/package_rpm.bbclass | 18 ++++++++++++++++--
meta/recipes-core/busybox/busybox.inc | 1 +
meta/recipes-core/busybox/busybox_1.18.5.bb | 2 +-
3 files changed, 18 insertions(+), 3 deletions(-)
--
1.7.5.4
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH 1/2] classes/package_rpm: disable uninstall scripts for upgrades 2011-11-09 12:05 [PATCH 0/2] RPM/upgrade fixes Paul Eggleton @ 2011-11-09 12:05 ` Paul Eggleton 2011-11-09 18:55 ` Mark Hatle 2023-11-02 10:20 ` vadym.yatsenko 2011-11-09 12:05 ` [PATCH 2/2] busybox: add grep to temporary links during uninstall Paul Eggleton 2011-11-10 12:25 ` [PATCH 0/2] RPM/upgrade fixes Richard Purdie 2 siblings, 2 replies; 8+ messages in thread From: Paul Eggleton @ 2011-11-09 12:05 UTC (permalink / raw) To: openembedded-core Our current assumption (based on the behaviour of opkg) when writing recipes is that prerm and postrm do not get called during an upgrade. When using rpm however, these are mapped to the rpm "preun" and "postun" events which occur after postinst for upgrades, and when these contain removal type operations (such as update-alternatives --remove) this causes problems. This patch wraps each preun and postun script for rpm in a check that determines whether or not the script is being called during an upgrade, and skips the entire script if it is, which mimics the behaviour of opkg under the same conditions. Fixes [YOCTO #1760] Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> --- meta/classes/package_rpm.bbclass | 18 ++++++++++++++++-- 1 files changed, 16 insertions(+), 2 deletions(-) diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass index df5a2db..2679e9f 100644 --- a/meta/classes/package_rpm.bbclass +++ b/meta/classes/package_rpm.bbclass @@ -471,6 +471,16 @@ python write_specfile () { else: target.append(path + "/" + file) + # Prevent the prerm/postrm scripts from being run during an upgrade + def wrap_uninstall(scriptvar): + scr = scriptvar.strip() + if scr.startswith("#!"): + pos = scr.find("\n") + 1 + else: + pos = 0 + scr = scr[:pos] + 'if [ "$1" = "0" ] ; then\n' + scr[pos:] + '\nfi' + return scr + packages = bb.data.getVar('PACKAGES', d, True) if not packages or packages == '': bb.debug(1, "No packages; nothing to do") @@ -671,8 +681,10 @@ python write_specfile () { spec_scriptlets_bottom.append('%%post -n %s' % splitname) elif script == 'prerm': spec_scriptlets_bottom.append('%%preun -n %s' % splitname) + scriptvar = wrap_uninstall(scriptvar) elif script == 'postrm': spec_scriptlets_bottom.append('%%postun -n %s' % splitname) + scriptvar = wrap_uninstall(scriptvar) spec_scriptlets_bottom.append(scriptvar) spec_scriptlets_bottom.append('') @@ -758,11 +770,13 @@ python write_specfile () { spec_scriptlets_top.append('') if srcprerm: spec_scriptlets_top.append('%preun') - spec_scriptlets_top.append(srcprerm) + scriptvar = wrap_uninstall(srcprerm) + spec_scriptlets_top.append(scriptvar) spec_scriptlets_top.append('') if srcpostrm: spec_scriptlets_top.append('%postun') - spec_scriptlets_top.append(srcpostrm) + scriptvar = wrap_uninstall(srcpostrm) + spec_scriptlets_top.append(scriptvar) spec_scriptlets_top.append('') # Write the SPEC file -- 1.7.5.4 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] classes/package_rpm: disable uninstall scripts for upgrades 2011-11-09 12:05 ` [PATCH 1/2] classes/package_rpm: disable uninstall scripts for upgrades Paul Eggleton @ 2011-11-09 18:55 ` Mark Hatle 2023-11-02 10:20 ` vadym.yatsenko 1 sibling, 0 replies; 8+ messages in thread From: Mark Hatle @ 2011-11-09 18:55 UTC (permalink / raw) To: openembedded-core On 11/9/11 6:05 AM, Paul Eggleton wrote: > Our current assumption (based on the behaviour of opkg) when writing > recipes is that prerm and postrm do not get called during an upgrade. > When using rpm however, these are mapped to the rpm "preun" and "postun" > events which occur after postinst for upgrades, and when these contain > removal type operations (such as update-alternatives --remove) this > causes problems. > > This patch wraps each preun and postun script for rpm in a check that > determines whether or not the script is being called during an upgrade, > and skips the entire script if it is, which mimics the behaviour of opkg > under the same conditions. > > Fixes [YOCTO #1760] > > Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Looks like the right solution to me. (Paul and I previously discussed how to correct this.) Signed-off-by: Mark Hatle <mark.hatle@windriver.com> > --- > meta/classes/package_rpm.bbclass | 18 ++++++++++++++++-- > 1 files changed, 16 insertions(+), 2 deletions(-) > > diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass > index df5a2db..2679e9f 100644 > --- a/meta/classes/package_rpm.bbclass > +++ b/meta/classes/package_rpm.bbclass > @@ -471,6 +471,16 @@ python write_specfile () { > else: > target.append(path + "/" + file) > > + # Prevent the prerm/postrm scripts from being run during an upgrade > + def wrap_uninstall(scriptvar): > + scr = scriptvar.strip() > + if scr.startswith("#!"): > + pos = scr.find("\n") + 1 > + else: > + pos = 0 > + scr = scr[:pos] + 'if [ "$1" = "0" ] ; then\n' + scr[pos:] + '\nfi' > + return scr > + > packages = bb.data.getVar('PACKAGES', d, True) > if not packages or packages == '': > bb.debug(1, "No packages; nothing to do") > @@ -671,8 +681,10 @@ python write_specfile () { > spec_scriptlets_bottom.append('%%post -n %s' % splitname) > elif script == 'prerm': > spec_scriptlets_bottom.append('%%preun -n %s' % splitname) > + scriptvar = wrap_uninstall(scriptvar) > elif script == 'postrm': > spec_scriptlets_bottom.append('%%postun -n %s' % splitname) > + scriptvar = wrap_uninstall(scriptvar) > spec_scriptlets_bottom.append(scriptvar) > spec_scriptlets_bottom.append('') > > @@ -758,11 +770,13 @@ python write_specfile () { > spec_scriptlets_top.append('') > if srcprerm: > spec_scriptlets_top.append('%preun') > - spec_scriptlets_top.append(srcprerm) > + scriptvar = wrap_uninstall(srcprerm) > + spec_scriptlets_top.append(scriptvar) > spec_scriptlets_top.append('') > if srcpostrm: > spec_scriptlets_top.append('%postun') > - spec_scriptlets_top.append(srcpostrm) > + scriptvar = wrap_uninstall(srcpostrm) > + spec_scriptlets_top.append(scriptvar) > spec_scriptlets_top.append('') > > # Write the SPEC file ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] classes/package_rpm: disable uninstall scripts for upgrades 2011-11-09 12:05 ` [PATCH 1/2] classes/package_rpm: disable uninstall scripts for upgrades Paul Eggleton 2011-11-09 18:55 ` Mark Hatle @ 2023-11-02 10:20 ` vadym.yatsenko 1 sibling, 0 replies; 8+ messages in thread From: vadym.yatsenko @ 2023-11-02 10:20 UTC (permalink / raw) To: openembedded-core [-- Attachment #1: Type: text/plain, Size: 661 bytes --] I understand that this patch is pretty old. But, we having issues because of it. According to the description it is intended to fix some problems for RPM systems. We are using DEB packages and this patch is preventing to update rc.d scripts if new version of the package has updates in it. Particularly, the new script is intended to be run with a different boot priority: 'start' directive to update-rc.d. The problem is that during upgrade an old symlinks to rc* directories are not removed because of this condition added by wrap_uninstall(). And as a result update-rc.d is failing to update init scripts in rc* folders. Because old are existing. [-- Attachment #2: Type: text/html, Size: 693 bytes --] ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/2] busybox: add grep to temporary links during uninstall 2011-11-09 12:05 [PATCH 0/2] RPM/upgrade fixes Paul Eggleton 2011-11-09 12:05 ` [PATCH 1/2] classes/package_rpm: disable uninstall scripts for upgrades Paul Eggleton @ 2011-11-09 12:05 ` Paul Eggleton 2011-11-09 19:28 ` Paul Menzel 2011-11-10 12:25 ` [PATCH 0/2] RPM/upgrade fixes Richard Purdie 2 siblings, 1 reply; 8+ messages in thread From: Paul Eggleton @ 2011-11-09 12:05 UTC (permalink / raw) To: openembedded-core In the busybox package prerm we set up some temporary links and modify PATH so that certain utilities are provided for the purpose of running update-alternatives; if grep is not among these then you get errors when removing busybox, so add a temporary link for grep as well. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> --- meta/recipes-core/busybox/busybox.inc | 1 + meta/recipes-core/busybox/busybox_1.18.5.bb | 2 +- 2 files changed, 2 insertions(+), 1 deletions(-) diff --git a/meta/recipes-core/busybox/busybox.inc b/meta/recipes-core/busybox/busybox.inc index acd635b..f8fee51 100644 --- a/meta/recipes-core/busybox/busybox.inc +++ b/meta/recipes-core/busybox/busybox.inc @@ -270,6 +270,7 @@ pkg_prerm_${PN} () { ln -s /bin/busybox $tmpdir/rm ln -s /bin/busybox $tmpdir/sed ln -s /bin/busybox $tmpdir/sort + ln -s /bin/busybox $tmpdir/grep export PATH=$PATH:$tmpdir while read link diff --git a/meta/recipes-core/busybox/busybox_1.18.5.bb b/meta/recipes-core/busybox/busybox_1.18.5.bb index bdafb31..17d583e 100644 --- a/meta/recipes-core/busybox/busybox_1.18.5.bb +++ b/meta/recipes-core/busybox/busybox_1.18.5.bb @@ -1,5 +1,5 @@ require busybox.inc -PR = "r1" +PR = "r2" SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \ file://udhcpscript.patch \ -- 1.7.5.4 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] busybox: add grep to temporary links during uninstall 2011-11-09 12:05 ` [PATCH 2/2] busybox: add grep to temporary links during uninstall Paul Eggleton @ 2011-11-09 19:28 ` Paul Menzel 2011-11-10 10:07 ` Paul Eggleton 0 siblings, 1 reply; 8+ messages in thread From: Paul Menzel @ 2011-11-09 19:28 UTC (permalink / raw) To: openembedded-core [-- Attachment #1: Type: text/plain, Size: 1063 bytes --] Am Mittwoch, den 09.11.2011, 12:05 +0000 schrieb Paul Eggleton: > In the busybox package prerm we set up some temporary links and modify > PATH so that certain utilities are provided for the purpose of running > update-alternatives; if grep is not among these then you get errors when > removing busybox, so add a temporary link for grep as well. > > Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> > --- > meta/recipes-core/busybox/busybox.inc | 1 + > meta/recipes-core/busybox/busybox_1.18.5.bb | 2 +- > 2 files changed, 2 insertions(+), 1 deletions(-) > > diff --git a/meta/recipes-core/busybox/busybox.inc b/meta/recipes-core/busybox/busybox.inc > index acd635b..f8fee51 100644 > --- a/meta/recipes-core/busybox/busybox.inc > +++ b/meta/recipes-core/busybox/busybox.inc > @@ -270,6 +270,7 @@ pkg_prerm_${PN} () { > ln -s /bin/busybox $tmpdir/rm > ln -s /bin/busybox $tmpdir/sed > ln -s /bin/busybox $tmpdir/sort > + ln -s /bin/busybox $tmpdir/grep Should it be sorted? […] Thanks, Paul [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 205 bytes --] ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] busybox: add grep to temporary links during uninstall 2011-11-09 19:28 ` Paul Menzel @ 2011-11-10 10:07 ` Paul Eggleton 0 siblings, 0 replies; 8+ messages in thread From: Paul Eggleton @ 2011-11-10 10:07 UTC (permalink / raw) To: Patches and discussions about the oe-core layer On Wednesday 09 November 2011 20:28:07 Paul Menzel wrote: > Should it be sorted? Possibly, but that ought to be done in a separate patch. Cheers, Paul -- Paul Eggleton Intel Open Source Technology Centre ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/2] RPM/upgrade fixes 2011-11-09 12:05 [PATCH 0/2] RPM/upgrade fixes Paul Eggleton 2011-11-09 12:05 ` [PATCH 1/2] classes/package_rpm: disable uninstall scripts for upgrades Paul Eggleton 2011-11-09 12:05 ` [PATCH 2/2] busybox: add grep to temporary links during uninstall Paul Eggleton @ 2011-11-10 12:25 ` Richard Purdie 2 siblings, 0 replies; 8+ messages in thread From: Richard Purdie @ 2011-11-10 12:25 UTC (permalink / raw) To: Patches and discussions about the oe-core layer On Wed, 2011-11-09 at 12:05 +0000, Paul Eggleton wrote: > This is the fix for the problem Anders reported on the Yocto mailing > list (now filed as Yocto bug #1760). I've checked through usage of > postrm/prerm in oe-core and meta-oe and it looks OK to me, but it > would help for others to double-check it. > > I considered whether or not it would be worth bumping PR on every > recipe that uses prerm/postrm, however this is a *lot* of recipes. > > Also included is another fix for a minor issue I discovered when > uninstalling busybox. > > The following changes since commit 25fae81538a92e15eab3fc169ebce44505f67839: > > python: skip setup.py 'import check' when cross-compiling (2011-11-08 21:44:23 +0000) > > are available in the git repository at: > git://git.openembedded.org/openembedded-core-contrib paule/rmscripts > http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=paule/rmscripts > > Paul Eggleton (2): > classes/package_rpm: disable uninstall scripts for upgrades > busybox: add grep to temporary links during uninstall Merged to master, thanks. Richard ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-11-02 10:20 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-11-09 12:05 [PATCH 0/2] RPM/upgrade fixes Paul Eggleton 2011-11-09 12:05 ` [PATCH 1/2] classes/package_rpm: disable uninstall scripts for upgrades Paul Eggleton 2011-11-09 18:55 ` Mark Hatle 2023-11-02 10:20 ` vadym.yatsenko 2011-11-09 12:05 ` [PATCH 2/2] busybox: add grep to temporary links during uninstall Paul Eggleton 2011-11-09 19:28 ` Paul Menzel 2011-11-10 10:07 ` Paul Eggleton 2011-11-10 12:25 ` [PATCH 0/2] RPM/upgrade fixes Richard Purdie
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox