Patchwork [6/7] package_rpm: fix strip_multilib function

login
register
mail settings
Submitter Dongxiao Xu
Date Aug. 3, 2011, 3:19 p.m.
Message ID <a59303a5b3249096635224817a6b20c828277132.1312384552.git.dongxiao.xu@intel.com>
Download mbox | patch
Permalink /patch/9121/
State New, archived
Headers show

Comments

Dongxiao Xu - Aug. 3, 2011, 3:19 p.m.
The previous logic could only strip MLPREFIX from the first element in
an array, take an example, strip_multilib the [lib32-a lib32-b lib32-c]
will result in [a lib32-b lib32-c]. This commit change it to strip all
elements' multilib prefix.

CC: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
---
 meta/classes/package_rpm.bbclass |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
Mark Hatle - Aug. 3, 2011, 3:38 p.m.
On 8/3/11 10:19 AM, Dongxiao Xu wrote:
> The previous logic could only strip MLPREFIX from the first element in
> an array, take an example, strip_multilib the [lib32-a lib32-b lib32-c]
> will result in [a lib32-b lib32-c]. This commit change it to strip all
> elements' multilib prefix.
> 
> CC: Mark Hatle <mark.hatle@windriver.com>
> Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
> ---
>  meta/classes/package_rpm.bbclass |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass
> index 9d0eeba..a29ce9d 100644
> --- a/meta/classes/package_rpm.bbclass
> +++ b/meta/classes/package_rpm.bbclass
> @@ -326,7 +326,7 @@ python write_specfile () {
>  		for ext in multilibs.split():
>  			eext = ext.split(':')
>  			if len(eext) > 1 and eext[0] == 'multilib' and name and name.find(eext[1] + '-') == 0:
> -				name = (eext[1] + '-').join(name.split(eext[1] + '-', 1)[1:])
> +				name = " ".join(name.split(eext[1] + '-')[1:])

This looks incorrect to me, with the " ".join, it's going to join multiple
elements with a whitespace between them.  The original code was written to work
on one item at a time within the list of multilibs.

How well has this been tested?  Since I don't have all of the context this very
well might be correct within the current scope of the multilib implementation.

>  		return name
>  
>  #		ml = bb.data.getVar("MLPREFIX", d, True)
> @@ -720,7 +720,7 @@ python do_package_rpm () {
>  	def strip_multilib(name, d):
>  		ml = bb.data.getVar("MLPREFIX", d, True)
>  		if ml and name and len(ml) != 0 and name.find(ml) == 0:
> -			return ml.join(name.split(ml, 1)[1:])
> +			return " ".join(name.split(ml)[1:])
>  		return name
>  
>  	workdir = bb.data.getVar('WORKDIR', d, True)
Dongxiao Xu - Aug. 4, 2011, 1:44 a.m.
Hi Mark,

> -----Original Message-----
> From: openembedded-core-bounces@lists.openembedded.org
> [mailto:openembedded-core-bounces@lists.openembedded.org] On Behalf Of
> Mark Hatle
> Sent: Wednesday, August 03, 2011 11:39 PM
> To: openembedded-core@lists.openembedded.org
> Subject: Re: [OE-core] [PATCH 6/7] package_rpm: fix strip_multilib function
> 
> On 8/3/11 10:19 AM, Dongxiao Xu wrote:
> > The previous logic could only strip MLPREFIX from the first element in
> > an array, take an example, strip_multilib the [lib32-a lib32-b
> > lib32-c] will result in [a lib32-b lib32-c]. This commit change it to
> > strip all elements' multilib prefix.
> >
> > CC: Mark Hatle <mark.hatle@windriver.com>
> > Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
> > ---
> >  meta/classes/package_rpm.bbclass |    4 ++--
> >  1 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/meta/classes/package_rpm.bbclass
> > b/meta/classes/package_rpm.bbclass
> > index 9d0eeba..a29ce9d 100644
> > --- a/meta/classes/package_rpm.bbclass
> > +++ b/meta/classes/package_rpm.bbclass
> > @@ -326,7 +326,7 @@ python write_specfile () {
> >  		for ext in multilibs.split():
> >  			eext = ext.split(':')
> >  			if len(eext) > 1 and eext[0] == 'multilib' and name and
> name.find(eext[1] + '-') == 0:
> > -				name = (eext[1] + '-').join(name.split(eext[1] + '-', 1)[1:])
> > +				name = " ".join(name.split(eext[1] + '-')[1:])
> 
> This looks incorrect to me, with the " ".join, it's going to join multiple elements
> with a whitespace between them.  The original code was written to work on
> one item at a time within the list of multilibs.
> 
> How well has this been tested?  Since I don't have all of the context this very
> well might be correct within the current scope of the multilib implementation.

The original usage for this strip_multilib() is in translate_vers() function, which strip the MLPREFIX one by one and then write the value back into variable "d".

As in the last patch (PATCH 7/7), we move strip_multilib() out of translate_vers() to fix the package rename issue we met in multilib. 

Therefore for our new usage, we need it to remove MLPREFIX for all elements in a list at one time, thus I changed its working style.

Thanks,
Dongxiao

> 
> >  		return name
> >
> >  #		ml = bb.data.getVar("MLPREFIX", d, True)
> > @@ -720,7 +720,7 @@ python do_package_rpm () {
> >  	def strip_multilib(name, d):
> >  		ml = bb.data.getVar("MLPREFIX", d, True)
> >  		if ml and name and len(ml) != 0 and name.find(ml) == 0:
> > -			return ml.join(name.split(ml, 1)[1:])
> > +			return " ".join(name.split(ml)[1:])
> >  		return name
> >
> >  	workdir = bb.data.getVar('WORKDIR', d, True)
> 
> 
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core

Patch

diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass
index 9d0eeba..a29ce9d 100644
--- a/meta/classes/package_rpm.bbclass
+++ b/meta/classes/package_rpm.bbclass
@@ -326,7 +326,7 @@  python write_specfile () {
 		for ext in multilibs.split():
 			eext = ext.split(':')
 			if len(eext) > 1 and eext[0] == 'multilib' and name and name.find(eext[1] + '-') == 0:
-				name = (eext[1] + '-').join(name.split(eext[1] + '-', 1)[1:])
+				name = " ".join(name.split(eext[1] + '-')[1:])
 		return name
 
 #		ml = bb.data.getVar("MLPREFIX", d, True)
@@ -720,7 +720,7 @@  python do_package_rpm () {
 	def strip_multilib(name, d):
 		ml = bb.data.getVar("MLPREFIX", d, True)
 		if ml and name and len(ml) != 0 and name.find(ml) == 0:
-			return ml.join(name.split(ml, 1)[1:])
+			return " ".join(name.split(ml)[1:])
 		return name
 
 	workdir = bb.data.getVar('WORKDIR', d, True)