<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>7427</bug_id>
          
          <creation_ts>2015-03-09 09:38:31 +0000</creation_ts>
          <short_desc>Image manifest file lacking newline char in last line</short_desc>
          <delta_ts>2016-01-29 17:39:19 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>Meta-yocto</product>
          <component>meta-yocto</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>2.1 M2</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Pau Espin Pedrol">pespin.shar</reporter>
          <assigned_to name="Mariano Lopez">mariano.lopez</assigned_to>
          <cc>benjamin.esquivel</cc>
    
    <cc>poky.bs.watcher</cc>
    
    <cc>poky.watcher</cc>
    
    <cc>richard.purdie</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>49286</commentid>
    <comment_count>0</comment_count>
      <attachid>2438</attachid>
    <who name="Pau Espin Pedrol">pespin.shar</who>
    <bug_when>2015-03-09 09:38:31 +0000</bug_when>
    <thetext>Created attachment 2438
Patch which fixes the issue for me

I was having problems to generate automatically some information from the manifest file because a package was missing, until I discovered that it was actually the last package in the list and I noticed that that last line in that file doesn&apos;t have a newline character, which in my opinion is the usual case in most text files.

So I open this bug report in order to get that fixed, and I propose a patch I did which solves the issue for me at least. 

I am using deb packaging system, but I guess similar patches ar needed in the same file for other packaging system too.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>49300</commentid>
    <comment_count>1</comment_count>
    <who name="Pau Espin Pedrol">pespin.shar</who>
    <bug_when>2015-03-09 14:42:43 +0000</bug_when>
    <thetext>Forget about the patch, I found out it breaks other code which gets the package list with &quot;arch&quot; parameter.

Easiest solution is to implement it in image.bbclass by writing an newline at the end:

python write_image_manifest () {
    from oe.rootfs import image_list_installed_packages
    with open(d.getVar(&apos;IMAGE_MANIFEST&apos;, True), &apos;w+&apos;) as image_manifest:
        image_manifest.write(image_list_installed_packages(d, &apos;ver&apos;))
        image_manifest.write(&quot;\n&quot;)
}


However, I feel the way the list is generated in image_list_installed_packages and how the code that uses it is kind of bad... imho or you use same output in all lines (meaning last one has also a newline char), or you convert those to python lists already inside image_list_installed_packages, but I wouldn&apos;t pass the current format and then go splitting in all the places this function is used.

What do you think about that?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>49685</commentid>
    <comment_count>2</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2015-03-24 10:56:01 +0000</bug_when>
    <thetext>For what its worth I agree that the way the data is currently being passed around is horrible, we should use some better data structure.

At this point I&apos;ll merge a patch as you propose adding the newline character and then in 1.9 we should consider rewriting the structure of the code as an enhancement/cleanup.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>57252</commentid>
    <comment_count>3</comment_count>
    <who name="Richard Purdie">richard.purdie</who>
    <bug_when>2015-12-14 15:59:05 +0000</bug_when>
    <thetext>To be clear about the problems here, the format parameter to image_list_installed_packages() is ugly and we shouldn&apos;t be passing around several different formats of this data. A better solution would be to have one return data format which encompasses all the types and doesn&apos;t need string splitting in the callers.

Having a function called &quot;list&quot;, a python keyword is also horrible.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>57257</commentid>
    <comment_count>4</comment_count>
    <who name="Mariano Lopez">mariano.lopez</who>
    <bug_when>2015-12-14 20:41:08 +0000</bug_when>
    <thetext>I was checking where the image_list_installed_packages() is used and it seems it is only in OE-Core. Regarding the output it is very different based on the format, so a one size fits all solution won&apos;t work. What can be done is to return a list or dictionary to the callers and they can format the output as desired. Currently there are 5 defined formats and here is the sample output:

arch:

adwaita-icon-theme all
alsa-conf core2-64
alsa-conf-base core2-64
alsa-plugins-pulseaudio-conf core2-64

deps:

adwaita-icon-theme|hicolor-icon-theme
adwaita-icon-theme|hicolor-icon-theme
adwaita-icon-theme|hicolor-icon-theme
adwaita-icon-theme|busybox
adwaita-icon-theme|busybox
alsa-plugins-pulseaudio-conf|libasound-module-conf-pulse
alsa-plugins-pulseaudio-conf|libasound-module-ctl-pulse
alsa-plugins-pulseaudio-conf|libasound-module-pcm-pulse

file:

adwaita-icon-theme /path/to/tmp/deploy/rpm/all/adwaita-icon-theme-3.18.0-r0.all.rpm all
alsa-conf /path/to/tmp/deploy/rpm/core2_64/alsa-conf-1.0.29-r0.core2_64.rpm core2-64alsa-conf-base /home/mlopezva/repo/poky/bug7427/tmp/deploy/rpm/core2_64/alsa-conf-base-1.0.29-r0.core2_64.rpm core2-64
alsa-plugins-pulseaudio-conf /path/to/tmp/deploy/rpm/core2_64/alsa-plugins-pulseaudio-conf-1.0.29-r0.core2_64.rpm core2-64

ver:

adwaita-icon-theme all 3.18.0
alsa-conf core2-64 1.0.29
alsa-conf-base core2-64 1.0.29

default:

adwaita-icon-theme
alsa-conf
alsa-conf-base
alsa-plugins-pulseaudio-conf</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>57679</commentid>
    <comment_count>5</comment_count>
    <who name="Mariano Lopez">mariano.lopez</who>
    <bug_when>2016-01-08 15:11:38 +0000</bug_when>
    <thetext>Sent patch for review:

http://lists.openembedded.org/pipermail/openembedded-core/2016-January/115006.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>58350</commentid>
    <comment_count>6</comment_count>
    <who name="Mariano Lopez">mariano.lopez</who>
    <bug_when>2016-01-29 17:39:19 +0000</bug_when>
    <thetext>This has been integrated in master:

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

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

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

http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=571289df7b2b59a3f00c267824931e3efaaabc3b</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>2438</attachid>
            <date>2015-03-09 09:38:31 +0000</date>
            <delta_ts>2015-03-09 09:38:31 +0000</delta_ts>
            <desc>Patch which fixes the issue for me</desc>
            <filename>0001-package_manager.py-Add-missing-final-newline-char-to.patch</filename>
            <type>text/plain</type>
            <size>847</size>
            <attacher name="Pau Espin Pedrol">pespin.shar</attacher>
            
              <data encoding="base64">RnJvbSBlNWU1MjAzNTlkNWYzZWFlMzdmNDI2MjBiN2MwOWQzMmFjNWM0NzY2IE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBQYXUgRXNwaW4gUGVkcm9sIDxwYXUuZXNwaW5AZXNzZW5zaXVt
LmNvbT4KRGF0ZTogTW9uLCA5IE1hciAyMDE1IDEwOjM1OjMyICswMTAwClN1YmplY3Q6IFtQQVRD
SF0gcGFja2FnZV9tYW5hZ2VyLnB5OiBBZGQgbWlzc2luZyBmaW5hbCBuZXdsaW5lIGNoYXIgdG8g
c29tZQogRHBrZ1BrZ3NMaXN0Lmxpc3QoKSBvdXRwdXRzCgpTaWduZWQtb2ZmLWJ5OiBQYXUgRXNw
aW4gUGVkcm9sIDxwYXUuZXNwaW5AZXNzZW5zaX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