* [PATCH v2 0/2] meta: Fixes for update-alternatives.bbclass and gtk-icon-cache.bbclass
@ 2019-06-25 12:44 Robert Yang
2019-06-25 12:44 ` [PATCH v2 1/2] update-alternatives.bbclass: run update-alternatives firstly in postinst script Robert Yang
2019-06-25 12:44 ` [PATCH v2 2/2] gtk-icon-cache.bbclass: Depends on gtk+3 Robert Yang
0 siblings, 2 replies; 5+ messages in thread
From: Robert Yang @ 2019-06-25 12:44 UTC (permalink / raw)
To: openembedded-core
* V2
- The patch for update-alternatives.bbclass makes update-alternatives runs firstly
before other postinst scripts, since other postinst may run the tool which is
installed by the package itself (e.g., newaliases is installed as
newaliases.postfix, and update-alternatives will update it to newaliases). But this
broke busybox' on target install, since update-alternatives requires some
basic tools such as sed, there was a neat way in busybox' postinst to fix
this problem, the v2 makes busybox' postinst script run firstly before
update-alternatives.
Testinfo:
MACHINE = "qemux86"
PACKAGE_CLASSES = "package_ipk package_rpm" (or "package_rpm package_ipk")
TESTIMAGE_AUTO = "1"
$ bitbake core-image-sato core-image-minimal
The tests are OK.
* V1
- Initial version
// Robert
The following changes since commit 4bb3e8f98e2bbfcb20f1b32d2b7674d1a6cb47be:
local.conf.sample.extended: remove redundant RUNTIMETARGET assignment (2019-06-24 17:32:37 +0100)
are available in the git repository at:
git://git.openembedded.org/openembedded-core-contrib rbt/post
http://cgit.openembedded.org//log/?h=rbt/post
Robert Yang (2):
update-alternatives.bbclass: run update-alternatives firstly in
postinst script
gtk-icon-cache.bbclass: Depends on gtk+3
meta/classes/gtk-icon-cache.bbclass | 14 ++++++++++----
meta/classes/update-alternatives.bbclass | 13 +++++++++++--
2 files changed, 21 insertions(+), 6 deletions(-)
--
2.7.4
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH v2 1/2] update-alternatives.bbclass: run update-alternatives firstly in postinst script 2019-06-25 12:44 [PATCH v2 0/2] meta: Fixes for update-alternatives.bbclass and gtk-icon-cache.bbclass Robert Yang @ 2019-06-25 12:44 ` Robert Yang 2019-06-25 14:14 ` Richard Purdie 2019-06-25 12:44 ` [PATCH v2 2/2] gtk-icon-cache.bbclass: Depends on gtk+3 Robert Yang 1 sibling, 1 reply; 5+ messages in thread From: Robert Yang @ 2019-06-25 12:44 UTC (permalink / raw) To: openembedded-core Recipes like postfix run command newaliases in postinst, but newaliases is installed as newaliases.postfix, it needs run update-alternatives to update it to newaliases, so there was an error when installed postinst on target. Fixed: $ opkg install postfix Configuring postfix. ///var/lib/opkg/info/postfix.postinst: line 4: newaliases: command not found Run update-alternatives firstly will fix the problem. And handle busybox as an exception since it needs set basic tools such as sed command firstly, otherwise update-alternatives doesn't work. Signed-off-by: Robert Yang <liezhi.yang@windriver.com> --- meta/classes/update-alternatives.bbclass | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/meta/classes/update-alternatives.bbclass b/meta/classes/update-alternatives.bbclass index b702e77..9ab9298 100644 --- a/meta/classes/update-alternatives.bbclass +++ b/meta/classes/update-alternatives.bbclass @@ -265,6 +265,7 @@ python populate_packages_updatealternatives () { if not update_alternatives_enabled(d): return + bpn = d.getVar('BPN') # Do actual update alternatives processing for pkg in (d.getVar('PACKAGES') or "").split(): # Create post install/removal scripts @@ -284,8 +285,16 @@ python populate_packages_updatealternatives () { bb.note('adding update-alternatives calls to postinst/prerm for %s' % pkg) bb.note('%s' % alt_setup_links) - postinst = d.getVar('pkg_postinst_%s' % pkg) or '#!/bin/sh\n' - postinst += alt_setup_links + postinst = d.getVar('pkg_postinst_%s' % pkg) + if postinst: + # Busybox needs handle basic tools such as sed command + # firstly, otherwise, update-alternatives doesn't work. + if bpn == 'busybox': + postinst += alt_setup_links + else: + postinst = alt_setup_links + postinst + else: + postinst = '#!/bin/sh\n' + alt_setup_links d.setVar('pkg_postinst_%s' % pkg, postinst) bb.note('%s' % alt_remove_links) -- 2.7.4 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2 1/2] update-alternatives.bbclass: run update-alternatives firstly in postinst script 2019-06-25 12:44 ` [PATCH v2 1/2] update-alternatives.bbclass: run update-alternatives firstly in postinst script Robert Yang @ 2019-06-25 14:14 ` Richard Purdie 2019-06-26 7:16 ` Robert Yang 0 siblings, 1 reply; 5+ messages in thread From: Richard Purdie @ 2019-06-25 14:14 UTC (permalink / raw) To: Robert Yang, openembedded-core On Tue, 2019-06-25 at 20:44 +0800, Robert Yang wrote: > Recipes like postfix run command newaliases in postinst, but newaliases is > installed as newaliases.postfix, it needs run update-alternatives to update it > to newaliases, so there was an error when installed postinst on target. > > Fixed: > $ opkg install postfix > Configuring postfix. > ///var/lib/opkg/info/postfix.postinst: line 4: newaliases: command not found > > Run update-alternatives firstly will fix the problem. And handle busybox as an > exception since it needs set basic tools such as sed command firstly, otherwise > update-alternatives doesn't work. > > Signed-off-by: Robert Yang <liezhi.yang@windriver.com> > --- > meta/classes/update-alternatives.bbclass | 13 +++++++++++-- > 1 file changed, 11 insertions(+), 2 deletions(-) > > diff --git a/meta/classes/update-alternatives.bbclass b/meta/classes/update-alternatives.bbclass > index b702e77..9ab9298 100644 > --- a/meta/classes/update-alternatives.bbclass > +++ b/meta/classes/update-alternatives.bbclass > @@ -265,6 +265,7 @@ python populate_packages_updatealternatives () { > if not update_alternatives_enabled(d): > return > > + bpn = d.getVar('BPN') > # Do actual update alternatives processing > for pkg in (d.getVar('PACKAGES') or "").split(): > # Create post install/removal scripts > @@ -284,8 +285,16 @@ python populate_packages_updatealternatives () { > > bb.note('adding update-alternatives calls to postinst/prerm for %s' % pkg) > bb.note('%s' % alt_setup_links) > - postinst = d.getVar('pkg_postinst_%s' % pkg) or '#!/bin/sh\n' > - postinst += alt_setup_links > + postinst = d.getVar('pkg_postinst_%s' % pkg) > + if postinst: > + # Busybox needs handle basic tools such as sed command > + # firstly, otherwise, update-alternatives doesn't work. > + if bpn == 'busybox': > + postinst += alt_setup_links > + else: > + postinst = alt_setup_links + postinst > + else: > + postinst = '#!/bin/sh\n' + alt_setup_links > d.setVar('pkg_postinst_%s' % pkg, postinst) > > bb.note('%s' % alt_remove_links) We don't write classes like this. We could just keep piling special cases one on top of the other and it becomes a horrible unmaintainable mess. I therefore don't want to see recipes "special cased" like this in core code and we need to find another, better way to handle this. Cheers, Richard ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 1/2] update-alternatives.bbclass: run update-alternatives firstly in postinst script 2019-06-25 14:14 ` Richard Purdie @ 2019-06-26 7:16 ` Robert Yang 0 siblings, 0 replies; 5+ messages in thread From: Robert Yang @ 2019-06-26 7:16 UTC (permalink / raw) To: Richard Purdie, openembedded-core On 6/25/19 10:14 PM, Richard Purdie wrote: > On Tue, 2019-06-25 at 20:44 +0800, Robert Yang wrote: >> Recipes like postfix run command newaliases in postinst, but newaliases is >> installed as newaliases.postfix, it needs run update-alternatives to update it >> to newaliases, so there was an error when installed postinst on target. >> >> Fixed: >> $ opkg install postfix >> Configuring postfix. >> ///var/lib/opkg/info/postfix.postinst: line 4: newaliases: command not found >> >> Run update-alternatives firstly will fix the problem. And handle busybox as an >> exception since it needs set basic tools such as sed command firstly, otherwise >> update-alternatives doesn't work. >> >> Signed-off-by: Robert Yang <liezhi.yang@windriver.com> >> --- >> meta/classes/update-alternatives.bbclass | 13 +++++++++++-- >> 1 file changed, 11 insertions(+), 2 deletions(-) >> >> diff --git a/meta/classes/update-alternatives.bbclass b/meta/classes/update-alternatives.bbclass >> index b702e77..9ab9298 100644 >> --- a/meta/classes/update-alternatives.bbclass >> +++ b/meta/classes/update-alternatives.bbclass >> @@ -265,6 +265,7 @@ python populate_packages_updatealternatives () { >> if not update_alternatives_enabled(d): >> return >> >> + bpn = d.getVar('BPN') >> # Do actual update alternatives processing >> for pkg in (d.getVar('PACKAGES') or "").split(): >> # Create post install/removal scripts >> @@ -284,8 +285,16 @@ python populate_packages_updatealternatives () { >> >> bb.note('adding update-alternatives calls to postinst/prerm for %s' % pkg) >> bb.note('%s' % alt_setup_links) >> - postinst = d.getVar('pkg_postinst_%s' % pkg) or '#!/bin/sh\n' >> - postinst += alt_setup_links >> + postinst = d.getVar('pkg_postinst_%s' % pkg) >> + if postinst: >> + # Busybox needs handle basic tools such as sed command >> + # firstly, otherwise, update-alternatives doesn't work. >> + if bpn == 'busybox': >> + postinst += alt_setup_links >> + else: >> + postinst = alt_setup_links + postinst >> + else: >> + postinst = '#!/bin/sh\n' + alt_setup_links >> d.setVar('pkg_postinst_%s' % pkg, postinst) >> >> bb.note('%s' % alt_remove_links) > > We don't write classes like this. We could just keep piling special > cases one on top of the other and it becomes a horrible unmaintainable > mess. I therefore don't want to see recipes "special cased" like this > in core code and we need to find another, better way to handle this. Yes, make sense, I was also worried about. My first fix was in busybox.inc, but looks a little tricky (Add a populate_packages_updatealternatives_append() in busybox.inc) to make it work. Please see the V3. // Robert > > Cheers, > > Richard > > > > ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 2/2] gtk-icon-cache.bbclass: Depends on gtk+3 2019-06-25 12:44 [PATCH v2 0/2] meta: Fixes for update-alternatives.bbclass and gtk-icon-cache.bbclass Robert Yang 2019-06-25 12:44 ` [PATCH v2 1/2] update-alternatives.bbclass: run update-alternatives firstly in postinst script Robert Yang @ 2019-06-25 12:44 ` Robert Yang 1 sibling, 0 replies; 5+ messages in thread From: Robert Yang @ 2019-06-25 12:44 UTC (permalink / raw) To: openembedded-core The gtk-update-icon-cache is provided by gtk+3, gdk-pixbuf-query-loaders is provided by gdk-pixbuf, and gtk+3 depends on gdk-pixbuf, so depends on gtk+3 can fix the problems. Signed-off-by: Robert Yang <liezhi.yang@windriver.com> --- meta/classes/gtk-icon-cache.bbclass | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/meta/classes/gtk-icon-cache.bbclass b/meta/classes/gtk-icon-cache.bbclass index 66fe781..4e60fe6 100644 --- a/meta/classes/gtk-icon-cache.bbclass +++ b/meta/classes/gtk-icon-cache.bbclass @@ -4,6 +4,11 @@ DEPENDS +=" ${@['hicolor-icon-theme', '']['${BPN}' == 'hicolor-icon-theme']} gtk PACKAGE_WRITE_DEPS += "gtk+3-native gdk-pixbuf-native" +inherit distro_features_check +ANY_OF_DISTRO_FEATURES = "${GTK3DISTROFEATURES}" + +DEPENDS += "gtk+3" + gtk_icon_cache_postinst() { if [ "x$D" != "x" ]; then $INTERCEPT_DIR/postinst_intercept update_icon_cache ${PKG} \ @@ -45,10 +50,11 @@ python populate_packages_append () { if not os.path.exists(icon_dir): continue - bb.note("adding hicolor-icon-theme dependency to %s" % pkg) - rdepends = ' ' + d.getVar('MLPREFIX', False) + "hicolor-icon-theme" - d.appendVar('RDEPENDS_%s' % pkg, rdepends) - + for dep in ('hicolor-icon-theme', 'gtk+3'): + bb.note("Adding %s dependency to %s" % (dep, pkg)) + rdepends = ' ' + d.getVar('MLPREFIX', False) + dep + d.appendVar('RDEPENDS_%s' % pkg, rdepends) + bb.note("adding gtk-icon-cache postinst and postrm scripts to %s" % pkg) postinst = d.getVar('pkg_postinst_%s' % pkg) -- 2.7.4 ^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-06-26 7:15 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2019-06-25 12:44 [PATCH v2 0/2] meta: Fixes for update-alternatives.bbclass and gtk-icon-cache.bbclass Robert Yang 2019-06-25 12:44 ` [PATCH v2 1/2] update-alternatives.bbclass: run update-alternatives firstly in postinst script Robert Yang 2019-06-25 14:14 ` Richard Purdie 2019-06-26 7:16 ` Robert Yang 2019-06-25 12:44 ` [PATCH v2 2/2] gtk-icon-cache.bbclass: Depends on gtk+3 Robert Yang
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox