Patchwork [2/3] buildhistory.bbclass: Fix dependency files creation

login
register
mail settings
Submitter Laurentiu Palcu
Date March 5, 2014, 12:39 p.m.
Message ID <9b59e3360cdf97a4bcde6bf979aa30dc56a84be4.1394023121.git.laurentiu.palcu@intel.com>
Download mbox | patch
Permalink /patch/68057/
State Accepted
Commit 6029af2ec5f6a92b41c9e103625699e6ae2e6550
Headers show

Comments

Laurentiu Palcu - March 5, 2014, 12:39 p.m.
Call the new python routines.

[YOCTO #5904]

Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
---
 meta/classes/buildhistory.bbclass |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
Richard Purdie - March 6, 2014, 9:55 p.m.
On Wed, 2014-03-05 at 14:39 +0200, Laurentiu Palcu wrote:
> Call the new python routines.
> 
> [YOCTO #5904]
> 
> Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
> ---
>  meta/classes/buildhistory.bbclass |    9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
> index ef4135b..01b0082 100644
> --- a/meta/classes/buildhistory.bbclass
> +++ b/meta/classes/buildhistory.bbclass
> @@ -319,6 +319,12 @@ python buildhistory_list_installed() {
>  
>      with open(pkgs_list_file, 'w') as pkgs_list:
>          pkgs_list.write(list_installed_packages(d, 'file'))
> +
> +    pkgs_deps_file = os.path.join(d.getVar('WORKDIR', True),
> +                                  "bh_installed_pkgs_deps.txt")
> +
> +    with open(pkgs_deps_file, 'w') as pkgs_deps:
> +        pkgs_deps.write(list_installed_packages(d, 'deps'))
>  }
>  
> 
> @@ -338,7 +344,8 @@ buildhistory_get_installed() {
>  
>  	# Produce dependency graph
>  	# First, quote each name to handle characters that cause issues for dot
> -	rootfs_list_installed_depends | sed 's:\([^| ]*\):"\1":g' > $1/depends.tmp
> +	cat ${WORKDIR}/bh_installed_pkgs_deps.txt | sed 's:\([^| ]*\):"\1":g' > $1/depends.tmp && \
> +		rm ${WORKDIR}/bh_installed_pkgs_deps.txt
>  	# Change delimiter from pipe to -> and set style for recommend lines
>  	sed -i -e 's:|: -> :' -e 's:"\[REC\]":[style=dotted]:' -e 's:$:;:' $1/depends.tmp
>  	# Add header, sorted and de-duped contents and footer and then delete the temp file

With this patch, a bitbake core-image-minimal -c populate_sdk resulted
in:

ERROR: Error executing a python function in /media/build1/poky/meta/recipes-core/images/core-image-minimal.bb:

The stack trace of python calls that resulted in this exception/failure was:
File: 'buildhistory_list_installed', lineno: 18, function: <module>
     0014:    with open(pkgs_deps_file, 'w') as pkgs_deps:
     0015:        pkgs_deps.write(list_installed_packages(d, 'deps'))
     0016:
     0017:
 *** 0018:buildhistory_list_installed(d)
     0019:
File: 'buildhistory_list_installed', lineno: 9, function: buildhistory_list_installed
     0005:    pkgs_list_file = os.path.join(d.getVar('WORKDIR', True),
     0006:                                  "bh_installed_pkgs.txt")
     0007:
     0008:    with open(pkgs_list_file, 'w') as pkgs_list:
 *** 0009:        pkgs_list.write(list_installed_packages(d, 'file'))
     0010:
     0011:    pkgs_deps_file = os.path.join(d.getVar('WORKDIR', True),
     0012:                                  "bh_installed_pkgs_deps.txt")
     0013:
File: '/media/build1/poky/meta/lib/oe/rootfs.py', lineno: 721, function: list_installed_packages
     0717:    if img_type == "rpm":
     0718:        return RpmPM(d,
     0719:                     rootfs_dir,
     0720:                     d.getVar('TARGET_VENDOR', True)
 *** 0721:                     ).list_installed(format)
     0722:    elif img_type == "ipk":
     0723:        return OpkgPM(d,
     0724:                      rootfs_dir,
     0725:                      d.getVar("IPKGCONF_TARGET", True),
File: '/media/build1/poky/meta/lib/oe/package_manager.py', lineno: 854, function: list_installed
     0850:            pkg = line.split()[0]
     0851:            arch = line.split()[1]
     0852:            ver = line.split()[2]
     0853:            pkgorigin = line.split()[3]
 *** 0854:            new_pkg, new_arch = self._pkg_translate_smart_to_oe(pkg, arch)
     0855:
     0856:            if format == "arch":
     0857:                output.append('%s %s' % (new_pkg, new_arch))
     0858:            elif format == "file":
File: '/media/build1/poky/meta/lib/oe/package_manager.py', lineno: 476, function: _pkg_translate_smart_to_oe
     0472:
     0473:            if found == 1 and fixed_arch == fixed_cmp_arch:
     0474:                break
     0475:        #bb.note('%s, %s -> %s, %s' % (pkg, arch, new_pkg, new_arch))
 *** 0476:        return new_pkg, new_arch
     0477:
     0478:    def _search_pkg_name_in_feeds(self, pkg, feed_archs):
     0479:        for arch in feed_archs:
     0480:            arch = arch.replace('-', '_')
Exception: UnboundLocalError: local variable 'new_arch' referenced before assignment

ERROR: Function failed: buildhistory_list_installed
ERROR: Logfile of failure stored in: /media/build1/poky/build/tmp/work/qemux86-poky-linux/core-image-minimal/1.0-r0/temp/log.d
Laurentiu Palcu - March 7, 2014, 6:35 a.m.
On Thu, Mar 06, 2014 at 09:55:38PM +0000, Richard Purdie wrote:
> On Wed, 2014-03-05 at 14:39 +0200, Laurentiu Palcu wrote:
> > Call the new python routines.
> > 
> > [YOCTO #5904]
> > 
> > Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
> > ---
> >  meta/classes/buildhistory.bbclass |    9 ++++++++-
> >  1 file changed, 8 insertions(+), 1 deletion(-)
> > 
> > diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
> > index ef4135b..01b0082 100644
> > --- a/meta/classes/buildhistory.bbclass
> > +++ b/meta/classes/buildhistory.bbclass
> > @@ -319,6 +319,12 @@ python buildhistory_list_installed() {
> >  
> >      with open(pkgs_list_file, 'w') as pkgs_list:
> >          pkgs_list.write(list_installed_packages(d, 'file'))
> > +
> > +    pkgs_deps_file = os.path.join(d.getVar('WORKDIR', True),
> > +                                  "bh_installed_pkgs_deps.txt")
> > +
> > +    with open(pkgs_deps_file, 'w') as pkgs_deps:
> > +        pkgs_deps.write(list_installed_packages(d, 'deps'))
> >  }
> >  
> > 
> > @@ -338,7 +344,8 @@ buildhistory_get_installed() {
> >  
> >  	# Produce dependency graph
> >  	# First, quote each name to handle characters that cause issues for dot
> > -	rootfs_list_installed_depends | sed 's:\([^| ]*\):"\1":g' > $1/depends.tmp
> > +	cat ${WORKDIR}/bh_installed_pkgs_deps.txt | sed 's:\([^| ]*\):"\1":g' > $1/depends.tmp && \
> > +		rm ${WORKDIR}/bh_installed_pkgs_deps.txt
> >  	# Change delimiter from pipe to -> and set style for recommend lines
> >  	sed -i -e 's:|: -> :' -e 's:"\[REC\]":[style=dotted]:' -e 's:$:;:' $1/depends.tmp
> >  	# Add header, sorted and de-duped contents and footer and then delete the temp file
> 
> With this patch, a bitbake core-image-minimal -c populate_sdk resulted
No, not quite. The bug appears to be in
RpmPM._pkg_translate_smart_to_oe(), which none of my patches touched.

CCing Hongxu.

laurentiu

> in:
> 
> ERROR: Error executing a python function in /media/build1/poky/meta/recipes-core/images/core-image-minimal.bb:
> 
> The stack trace of python calls that resulted in this exception/failure was:
> File: 'buildhistory_list_installed', lineno: 18, function: <module>
>      0014:    with open(pkgs_deps_file, 'w') as pkgs_deps:
>      0015:        pkgs_deps.write(list_installed_packages(d, 'deps'))
>      0016:
>      0017:
>  *** 0018:buildhistory_list_installed(d)
>      0019:
> File: 'buildhistory_list_installed', lineno: 9, function: buildhistory_list_installed
>      0005:    pkgs_list_file = os.path.join(d.getVar('WORKDIR', True),
>      0006:                                  "bh_installed_pkgs.txt")
>      0007:
>      0008:    with open(pkgs_list_file, 'w') as pkgs_list:
>  *** 0009:        pkgs_list.write(list_installed_packages(d, 'file'))
>      0010:
>      0011:    pkgs_deps_file = os.path.join(d.getVar('WORKDIR', True),
>      0012:                                  "bh_installed_pkgs_deps.txt")
>      0013:
> File: '/media/build1/poky/meta/lib/oe/rootfs.py', lineno: 721, function: list_installed_packages
>      0717:    if img_type == "rpm":
>      0718:        return RpmPM(d,
>      0719:                     rootfs_dir,
>      0720:                     d.getVar('TARGET_VENDOR', True)
>  *** 0721:                     ).list_installed(format)
>      0722:    elif img_type == "ipk":
>      0723:        return OpkgPM(d,
>      0724:                      rootfs_dir,
>      0725:                      d.getVar("IPKGCONF_TARGET", True),
> File: '/media/build1/poky/meta/lib/oe/package_manager.py', lineno: 854, function: list_installed
>      0850:            pkg = line.split()[0]
>      0851:            arch = line.split()[1]
>      0852:            ver = line.split()[2]
>      0853:            pkgorigin = line.split()[3]
>  *** 0854:            new_pkg, new_arch = self._pkg_translate_smart_to_oe(pkg, arch)
>      0855:
>      0856:            if format == "arch":
>      0857:                output.append('%s %s' % (new_pkg, new_arch))
>      0858:            elif format == "file":
> File: '/media/build1/poky/meta/lib/oe/package_manager.py', lineno: 476, function: _pkg_translate_smart_to_oe
>      0472:
>      0473:            if found == 1 and fixed_arch == fixed_cmp_arch:
>      0474:                break
>      0475:        #bb.note('%s, %s -> %s, %s' % (pkg, arch, new_pkg, new_arch))
>  *** 0476:        return new_pkg, new_arch
>      0477:
>      0478:    def _search_pkg_name_in_feeds(self, pkg, feed_archs):
>      0479:        for arch in feed_archs:
>      0480:            arch = arch.replace('-', '_')
> Exception: UnboundLocalError: local variable 'new_arch' referenced before assignment
> 
> ERROR: Function failed: buildhistory_list_installed
> ERROR: Logfile of failure stored in: /media/build1/poky/build/tmp/work/qemux86-poky-linux/core-image-minimal/1.0-r0/temp/log.d
> 
>
Florin Sarbu - March 26, 2014, 9:15 a.m.
I get the same error on do_rootfs for a rpm based image:

Exception: UnboundLocalError: local variable 'new_arch' referenced before assignment

Florin
Laurentiu Palcu - March 26, 2014, 10:09 a.m.
On Wed, Mar 26, 2014 at 09:15:43AM +0000, Sarbu, Florin-Ionut (Florin) wrote:
> I get the same error on do_rootfs for a rpm based image:
> 
> Exception: UnboundLocalError: local variable 'new_arch' referenced before assignment
Does this happen on latest master? Do you have the 4 patches, starting with this one

http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=d91e35640d19471213122d36288315f071c37432

in your tree? Did you activate buildhistory? Can you provide more info
regarding the steps you followed to reproduce this?

laurentiu
> 
> Florin
> ________________________________________
> From: openembedded-core-bounces@lists.openembedded.org [openembedded-core-bounces@lists.openembedded.org] on behalf of Laurentiu Palcu [laurentiu.palcu@intel.com]
> Sent: Friday, March 07, 2014 8:35 AM
> To: Richard Purdie
> Cc: openembedded-core@lists.openembedded.org
> Subject: Re: [OE-core] [PATCH 2/3] buildhistory.bbclass: Fix dependency files creation
> 
> On Thu, Mar 06, 2014 at 09:55:38PM +0000, Richard Purdie wrote:
> > On Wed, 2014-03-05 at 14:39 +0200, Laurentiu Palcu wrote:
> > > Call the new python routines.
> > >
> > > [YOCTO #5904]
> > >
> > > Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
> > > ---
> > >  meta/classes/buildhistory.bbclass |    9 ++++++++-
> > >  1 file changed, 8 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
> > > index ef4135b..01b0082 100644
> > > --- a/meta/classes/buildhistory.bbclass
> > > +++ b/meta/classes/buildhistory.bbclass
> > > @@ -319,6 +319,12 @@ python buildhistory_list_installed() {
> > >
> > >      with open(pkgs_list_file, 'w') as pkgs_list:
> > >          pkgs_list.write(list_installed_packages(d, 'file'))
> > > +
> > > +    pkgs_deps_file = os.path.join(d.getVar('WORKDIR', True),
> > > +                                  "bh_installed_pkgs_deps.txt")
> > > +
> > > +    with open(pkgs_deps_file, 'w') as pkgs_deps:
> > > +        pkgs_deps.write(list_installed_packages(d, 'deps'))
> > >  }
> > >
> > >
> > > @@ -338,7 +344,8 @@ buildhistory_get_installed() {
> > >
> > >     # Produce dependency graph
> > >     # First, quote each name to handle characters that cause issues for dot
> > > -   rootfs_list_installed_depends | sed 's:\([^| ]*\):"\1":g' > $1/depends.tmp
> > > +   cat ${WORKDIR}/bh_installed_pkgs_deps.txt | sed 's:\([^| ]*\):"\1":g' > $1/depends.tmp && \
> > > +           rm ${WORKDIR}/bh_installed_pkgs_deps.txt
> > >     # Change delimiter from pipe to -> and set style for recommend lines
> > >     sed -i -e 's:|: -> :' -e 's:"\[REC\]":[style=dotted]:' -e 's:$:;:' $1/depends.tmp
> > >     # Add header, sorted and de-duped contents and footer and then delete the temp file
> >
> > With this patch, a bitbake core-image-minimal -c populate_sdk resulted
> No, not quite. The bug appears to be in
> RpmPM._pkg_translate_smart_to_oe(), which none of my patches touched.
> 
> CCing Hongxu.
> 
> laurentiu
> 
> > in:
> >
> > ERROR: Error executing a python function in /media/build1/poky/meta/recipes-core/images/core-image-minimal.bb:
> >
> > The stack trace of python calls that resulted in this exception/failure was:
> > File: 'buildhistory_list_installed', lineno: 18, function: <module>
> >      0014:    with open(pkgs_deps_file, 'w') as pkgs_deps:
> >      0015:        pkgs_deps.write(list_installed_packages(d, 'deps'))
> >      0016:
> >      0017:
> >  *** 0018:buildhistory_list_installed(d)
> >      0019:
> > File: 'buildhistory_list_installed', lineno: 9, function: buildhistory_list_installed
> >      0005:    pkgs_list_file = os.path.join(d.getVar('WORKDIR', True),
> >      0006:                                  "bh_installed_pkgs.txt")
> >      0007:
> >      0008:    with open(pkgs_list_file, 'w') as pkgs_list:
> >  *** 0009:        pkgs_list.write(list_installed_packages(d, 'file'))
> >      0010:
> >      0011:    pkgs_deps_file = os.path.join(d.getVar('WORKDIR', True),
> >      0012:                                  "bh_installed_pkgs_deps.txt")
> >      0013:
> > File: '/media/build1/poky/meta/lib/oe/rootfs.py', lineno: 721, function: list_installed_packages
> >      0717:    if img_type == "rpm":
> >      0718:        return RpmPM(d,
> >      0719:                     rootfs_dir,
> >      0720:                     d.getVar('TARGET_VENDOR', True)
> >  *** 0721:                     ).list_installed(format)
> >      0722:    elif img_type == "ipk":
> >      0723:        return OpkgPM(d,
> >      0724:                      rootfs_dir,
> >      0725:                      d.getVar("IPKGCONF_TARGET", True),
> > File: '/media/build1/poky/meta/lib/oe/package_manager.py', lineno: 854, function: list_installed
> >      0850:            pkg = line.split()[0]
> >      0851:            arch = line.split()[1]
> >      0852:            ver = line.split()[2]
> >      0853:            pkgorigin = line.split()[3]
> >  *** 0854:            new_pkg, new_arch = self._pkg_translate_smart_to_oe(pkg, arch)
> >      0855:
> >      0856:            if format == "arch":
> >      0857:                output.append('%s %s' % (new_pkg, new_arch))
> >      0858:            elif format == "file":
> > File: '/media/build1/poky/meta/lib/oe/package_manager.py', lineno: 476, function: _pkg_translate_smart_to_oe
> >      0472:
> >      0473:            if found == 1 and fixed_arch == fixed_cmp_arch:
> >      0474:                break
> >      0475:        #bb.note('%s, %s -> %s, %s' % (pkg, arch, new_pkg, new_arch))
> >  *** 0476:        return new_pkg, new_arch
> >      0477:
> >      0478:    def _search_pkg_name_in_feeds(self, pkg, feed_archs):
> >      0479:        for arch in feed_archs:
> >      0480:            arch = arch.replace('-', '_')
> > Exception: UnboundLocalError: local variable 'new_arch' referenced before assignment
> >
> > ERROR: Function failed: buildhistory_list_installed
> > ERROR: Logfile of failure stored in: /media/build1/poky/build/tmp/work/qemux86-poky-linux/core-image-minimal/1.0-r0/temp/log.d
> >
> >
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
Florin Sarbu - March 26, 2014, 11:45 a.m.
On 03/26/2014 12:09 PM, Laurentiu Palcu wrote:
> On Wed, Mar 26, 2014 at 09:15:43AM +0000, Sarbu, Florin-Ionut (Florin) wrote:
>> I get the same error on do_rootfs for a rpm based image:
>>
>> Exception: UnboundLocalError: local variable 'new_arch' referenced before assignment
> Does this happen on latest master?
Yes.
> Do you have the 4 patches, starting with this one
>
> http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=d91e35640d19471213122d36288315f071c37432
>
> in your tree?
Yes, I have that commit in poky.
>   Did you activate buildhistory? Can you provide more info
> regarding the steps you followed to reproduce this?
I am trying to build the gemini-image from the meta-ivi layer 
git@git.yoctoproject.org:meta-ivi.git The build steps are those from the 
README.md file

Florin
>
> laurentiu
>> Florin
>> ________________________________________
>> From: openembedded-core-bounces@lists.openembedded.org [openembedded-core-bounces@lists.openembedded.org] on behalf of Laurentiu Palcu [laurentiu.palcu@intel.com]
>> Sent: Friday, March 07, 2014 8:35 AM
>> To: Richard Purdie
>> Cc: openembedded-core@lists.openembedded.org
>> Subject: Re: [OE-core] [PATCH 2/3] buildhistory.bbclass: Fix dependency files creation
>>
>> On Thu, Mar 06, 2014 at 09:55:38PM +0000, Richard Purdie wrote:
>>> On Wed, 2014-03-05 at 14:39 +0200, Laurentiu Palcu wrote:
>>>> Call the new python routines.
>>>>
>>>> [YOCTO #5904]
>>>>
>>>> Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
>>>> ---
>>>>   meta/classes/buildhistory.bbclass |    9 ++++++++-
>>>>   1 file changed, 8 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
>>>> index ef4135b..01b0082 100644
>>>> --- a/meta/classes/buildhistory.bbclass
>>>> +++ b/meta/classes/buildhistory.bbclass
>>>> @@ -319,6 +319,12 @@ python buildhistory_list_installed() {
>>>>
>>>>       with open(pkgs_list_file, 'w') as pkgs_list:
>>>>           pkgs_list.write(list_installed_packages(d, 'file'))
>>>> +
>>>> +    pkgs_deps_file = os.path.join(d.getVar('WORKDIR', True),
>>>> +                                  "bh_installed_pkgs_deps.txt")
>>>> +
>>>> +    with open(pkgs_deps_file, 'w') as pkgs_deps:
>>>> +        pkgs_deps.write(list_installed_packages(d, 'deps'))
>>>>   }
>>>>
>>>>
>>>> @@ -338,7 +344,8 @@ buildhistory_get_installed() {
>>>>
>>>>      # Produce dependency graph
>>>>      # First, quote each name to handle characters that cause issues for dot
>>>> -   rootfs_list_installed_depends | sed 's:\([^| ]*\):"\1":g' > $1/depends.tmp
>>>> +   cat ${WORKDIR}/bh_installed_pkgs_deps.txt | sed 's:\([^| ]*\):"\1":g' > $1/depends.tmp && \
>>>> +           rm ${WORKDIR}/bh_installed_pkgs_deps.txt
>>>>      # Change delimiter from pipe to -> and set style for recommend lines
>>>>      sed -i -e 's:|: -> :' -e 's:"\[REC\]":[style=dotted]:' -e 's:$:;:' $1/depends.tmp
>>>>      # Add header, sorted and de-duped contents and footer and then delete the temp file
>>> With this patch, a bitbake core-image-minimal -c populate_sdk resulted
>> No, not quite. The bug appears to be in
>> RpmPM._pkg_translate_smart_to_oe(), which none of my patches touched.
>>
>> CCing Hongxu.
>>
>> laurentiu
>>
>>> in:
>>>
>>> ERROR: Error executing a python function in /media/build1/poky/meta/recipes-core/images/core-image-minimal.bb:
>>>
>>> The stack trace of python calls that resulted in this exception/failure was:
>>> File: 'buildhistory_list_installed', lineno: 18, function: <module>
>>>       0014:    with open(pkgs_deps_file, 'w') as pkgs_deps:
>>>       0015:        pkgs_deps.write(list_installed_packages(d, 'deps'))
>>>       0016:
>>>       0017:
>>>   *** 0018:buildhistory_list_installed(d)
>>>       0019:
>>> File: 'buildhistory_list_installed', lineno: 9, function: buildhistory_list_installed
>>>       0005:    pkgs_list_file = os.path.join(d.getVar('WORKDIR', True),
>>>       0006:                                  "bh_installed_pkgs.txt")
>>>       0007:
>>>       0008:    with open(pkgs_list_file, 'w') as pkgs_list:
>>>   *** 0009:        pkgs_list.write(list_installed_packages(d, 'file'))
>>>       0010:
>>>       0011:    pkgs_deps_file = os.path.join(d.getVar('WORKDIR', True),
>>>       0012:                                  "bh_installed_pkgs_deps.txt")
>>>       0013:
>>> File: '/media/build1/poky/meta/lib/oe/rootfs.py', lineno: 721, function: list_installed_packages
>>>       0717:    if img_type == "rpm":
>>>       0718:        return RpmPM(d,
>>>       0719:                     rootfs_dir,
>>>       0720:                     d.getVar('TARGET_VENDOR', True)
>>>   *** 0721:                     ).list_installed(format)
>>>       0722:    elif img_type == "ipk":
>>>       0723:        return OpkgPM(d,
>>>       0724:                      rootfs_dir,
>>>       0725:                      d.getVar("IPKGCONF_TARGET", True),
>>> File: '/media/build1/poky/meta/lib/oe/package_manager.py', lineno: 854, function: list_installed
>>>       0850:            pkg = line.split()[0]
>>>       0851:            arch = line.split()[1]
>>>       0852:            ver = line.split()[2]
>>>       0853:            pkgorigin = line.split()[3]
>>>   *** 0854:            new_pkg, new_arch = self._pkg_translate_smart_to_oe(pkg, arch)
>>>       0855:
>>>       0856:            if format == "arch":
>>>       0857:                output.append('%s %s' % (new_pkg, new_arch))
>>>       0858:            elif format == "file":
>>> File: '/media/build1/poky/meta/lib/oe/package_manager.py', lineno: 476, function: _pkg_translate_smart_to_oe
>>>       0472:
>>>       0473:            if found == 1 and fixed_arch == fixed_cmp_arch:
>>>       0474:                break
>>>       0475:        #bb.note('%s, %s -> %s, %s' % (pkg, arch, new_pkg, new_arch))
>>>   *** 0476:        return new_pkg, new_arch
>>>       0477:
>>>       0478:    def _search_pkg_name_in_feeds(self, pkg, feed_archs):
>>>       0479:        for arch in feed_archs:
>>>       0480:            arch = arch.replace('-', '_')
>>> Exception: UnboundLocalError: local variable 'new_arch' referenced before assignment
>>>
>>> ERROR: Function failed: buildhistory_list_installed
>>> ERROR: Logfile of failure stored in: /media/build1/poky/build/tmp/work/qemux86-poky-linux/core-image-minimal/1.0-r0/temp/log.d
>>>
>>>
>> _______________________________________________
>> Openembedded-core mailing list
>> Openembedded-core@lists.openembedded.org
>> http://lists.openembedded.org/mailman/listinfo/openembedded-core
Laurentiu Palcu - March 26, 2014, 1:30 p.m.
Please file a bug on this.

thanks,
laurentiu

On Wed, Mar 26, 2014 at 01:45:40PM +0200, Florin Sarbu wrote:
> On 03/26/2014 12:09 PM, Laurentiu Palcu wrote:
> >On Wed, Mar 26, 2014 at 09:15:43AM +0000, Sarbu, Florin-Ionut (Florin) wrote:
> >>I get the same error on do_rootfs for a rpm based image:
> >>
> >>Exception: UnboundLocalError: local variable 'new_arch' referenced before assignment
> >Does this happen on latest master?
> Yes.
> >Do you have the 4 patches, starting with this one
> >
> >http://git.yoctoproject.org/cgit.cgi/poky/commit/?id=d91e35640d19471213122d36288315f071c37432
> >
> >in your tree?
> Yes, I have that commit in poky.
> >  Did you activate buildhistory? Can you provide more info
> >regarding the steps you followed to reproduce this?
> I am trying to build the gemini-image from the meta-ivi layer
> git@git.yoctoproject.org:meta-ivi.git The build steps are those from
> the README.md file
> 
> Florin
> >
> >laurentiu
> >>Florin
> >>________________________________________
> >>From: openembedded-core-bounces@lists.openembedded.org [openembedded-core-bounces@lists.openembedded.org] on behalf of Laurentiu Palcu [laurentiu.palcu@intel.com]
> >>Sent: Friday, March 07, 2014 8:35 AM
> >>To: Richard Purdie
> >>Cc: openembedded-core@lists.openembedded.org
> >>Subject: Re: [OE-core] [PATCH 2/3] buildhistory.bbclass: Fix dependency files creation
> >>
> >>On Thu, Mar 06, 2014 at 09:55:38PM +0000, Richard Purdie wrote:
> >>>On Wed, 2014-03-05 at 14:39 +0200, Laurentiu Palcu wrote:
> >>>>Call the new python routines.
> >>>>
> >>>>[YOCTO #5904]
> >>>>
> >>>>Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
> >>>>---
> >>>>  meta/classes/buildhistory.bbclass |    9 ++++++++-
> >>>>  1 file changed, 8 insertions(+), 1 deletion(-)
> >>>>
> >>>>diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
> >>>>index ef4135b..01b0082 100644
> >>>>--- a/meta/classes/buildhistory.bbclass
> >>>>+++ b/meta/classes/buildhistory.bbclass
> >>>>@@ -319,6 +319,12 @@ python buildhistory_list_installed() {
> >>>>
> >>>>      with open(pkgs_list_file, 'w') as pkgs_list:
> >>>>          pkgs_list.write(list_installed_packages(d, 'file'))
> >>>>+
> >>>>+    pkgs_deps_file = os.path.join(d.getVar('WORKDIR', True),
> >>>>+                                  "bh_installed_pkgs_deps.txt")
> >>>>+
> >>>>+    with open(pkgs_deps_file, 'w') as pkgs_deps:
> >>>>+        pkgs_deps.write(list_installed_packages(d, 'deps'))
> >>>>  }
> >>>>
> >>>>
> >>>>@@ -338,7 +344,8 @@ buildhistory_get_installed() {
> >>>>
> >>>>     # Produce dependency graph
> >>>>     # First, quote each name to handle characters that cause issues for dot
> >>>>-   rootfs_list_installed_depends | sed 's:\([^| ]*\):"\1":g' > $1/depends.tmp
> >>>>+   cat ${WORKDIR}/bh_installed_pkgs_deps.txt | sed 's:\([^| ]*\):"\1":g' > $1/depends.tmp && \
> >>>>+           rm ${WORKDIR}/bh_installed_pkgs_deps.txt
> >>>>     # Change delimiter from pipe to -> and set style for recommend lines
> >>>>     sed -i -e 's:|: -> :' -e 's:"\[REC\]":[style=dotted]:' -e 's:$:;:' $1/depends.tmp
> >>>>     # Add header, sorted and de-duped contents and footer and then delete the temp file
> >>>With this patch, a bitbake core-image-minimal -c populate_sdk resulted
> >>No, not quite. The bug appears to be in
> >>RpmPM._pkg_translate_smart_to_oe(), which none of my patches touched.
> >>
> >>CCing Hongxu.
> >>
> >>laurentiu
> >>
> >>>in:
> >>>
> >>>ERROR: Error executing a python function in /media/build1/poky/meta/recipes-core/images/core-image-minimal.bb:
> >>>
> >>>The stack trace of python calls that resulted in this exception/failure was:
> >>>File: 'buildhistory_list_installed', lineno: 18, function: <module>
> >>>      0014:    with open(pkgs_deps_file, 'w') as pkgs_deps:
> >>>      0015:        pkgs_deps.write(list_installed_packages(d, 'deps'))
> >>>      0016:
> >>>      0017:
> >>>  *** 0018:buildhistory_list_installed(d)
> >>>      0019:
> >>>File: 'buildhistory_list_installed', lineno: 9, function: buildhistory_list_installed
> >>>      0005:    pkgs_list_file = os.path.join(d.getVar('WORKDIR', True),
> >>>      0006:                                  "bh_installed_pkgs.txt")
> >>>      0007:
> >>>      0008:    with open(pkgs_list_file, 'w') as pkgs_list:
> >>>  *** 0009:        pkgs_list.write(list_installed_packages(d, 'file'))
> >>>      0010:
> >>>      0011:    pkgs_deps_file = os.path.join(d.getVar('WORKDIR', True),
> >>>      0012:                                  "bh_installed_pkgs_deps.txt")
> >>>      0013:
> >>>File: '/media/build1/poky/meta/lib/oe/rootfs.py', lineno: 721, function: list_installed_packages
> >>>      0717:    if img_type == "rpm":
> >>>      0718:        return RpmPM(d,
> >>>      0719:                     rootfs_dir,
> >>>      0720:                     d.getVar('TARGET_VENDOR', True)
> >>>  *** 0721:                     ).list_installed(format)
> >>>      0722:    elif img_type == "ipk":
> >>>      0723:        return OpkgPM(d,
> >>>      0724:                      rootfs_dir,
> >>>      0725:                      d.getVar("IPKGCONF_TARGET", True),
> >>>File: '/media/build1/poky/meta/lib/oe/package_manager.py', lineno: 854, function: list_installed
> >>>      0850:            pkg = line.split()[0]
> >>>      0851:            arch = line.split()[1]
> >>>      0852:            ver = line.split()[2]
> >>>      0853:            pkgorigin = line.split()[3]
> >>>  *** 0854:            new_pkg, new_arch = self._pkg_translate_smart_to_oe(pkg, arch)
> >>>      0855:
> >>>      0856:            if format == "arch":
> >>>      0857:                output.append('%s %s' % (new_pkg, new_arch))
> >>>      0858:            elif format == "file":
> >>>File: '/media/build1/poky/meta/lib/oe/package_manager.py', lineno: 476, function: _pkg_translate_smart_to_oe
> >>>      0472:
> >>>      0473:            if found == 1 and fixed_arch == fixed_cmp_arch:
> >>>      0474:                break
> >>>      0475:        #bb.note('%s, %s -> %s, %s' % (pkg, arch, new_pkg, new_arch))
> >>>  *** 0476:        return new_pkg, new_arch
> >>>      0477:
> >>>      0478:    def _search_pkg_name_in_feeds(self, pkg, feed_archs):
> >>>      0479:        for arch in feed_archs:
> >>>      0480:            arch = arch.replace('-', '_')
> >>>Exception: UnboundLocalError: local variable 'new_arch' referenced before assignment
> >>>
> >>>ERROR: Function failed: buildhistory_list_installed
> >>>ERROR: Logfile of failure stored in: /media/build1/poky/build/tmp/work/qemux86-poky-linux/core-image-minimal/1.0-r0/temp/log.d
> >>>
> >>>
> >>_______________________________________________
> >>Openembedded-core mailing list
> >>Openembedded-core@lists.openembedded.org
> >>http://lists.openembedded.org/mailman/listinfo/openembedded-core
>

Patch

diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
index ef4135b..01b0082 100644
--- a/meta/classes/buildhistory.bbclass
+++ b/meta/classes/buildhistory.bbclass
@@ -319,6 +319,12 @@  python buildhistory_list_installed() {
 
     with open(pkgs_list_file, 'w') as pkgs_list:
         pkgs_list.write(list_installed_packages(d, 'file'))
+
+    pkgs_deps_file = os.path.join(d.getVar('WORKDIR', True),
+                                  "bh_installed_pkgs_deps.txt")
+
+    with open(pkgs_deps_file, 'w') as pkgs_deps:
+        pkgs_deps.write(list_installed_packages(d, 'deps'))
 }
 
 
@@ -338,7 +344,8 @@  buildhistory_get_installed() {
 
 	# Produce dependency graph
 	# First, quote each name to handle characters that cause issues for dot
-	rootfs_list_installed_depends | sed 's:\([^| ]*\):"\1":g' > $1/depends.tmp
+	cat ${WORKDIR}/bh_installed_pkgs_deps.txt | sed 's:\([^| ]*\):"\1":g' > $1/depends.tmp && \
+		rm ${WORKDIR}/bh_installed_pkgs_deps.txt
 	# Change delimiter from pipe to -> and set style for recommend lines
 	sed -i -e 's:|: -> :' -e 's:"\[REC\]":[style=dotted]:' -e 's:$:;:' $1/depends.tmp
 	# Add header, sorted and de-duped contents and footer and then delete the temp file