| Summary: | Image manifest file lacking newline char in last line | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Build System, Metadata & Runtime] Meta-yocto | Reporter: | Pau Espin Pedrol <pespin.shar> | ||||
| Component: | meta-yocto | Assignee: | Mariano Lopez <mariano.lopez> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | enhancement | ||||||
| Priority: | Medium | CC: | benjamin.esquivel, poky.bs.watcher, poky.watcher, richard.purdie | ||||
| Version: | unspecified | ||||||
| Target Milestone: | 2.1 M2 | ||||||
| Hardware: | x86 | ||||||
| OS: | Multiple | ||||||
| Whiteboard: | |||||||
| OS type for building Yocto: | --- | Type of Regression: | --- | ||||
| Verified: | Documentation change: | No (bug/feature does not impact docs) | |||||
| Attachments: |
|
||||||
Forget about the patch, I found out it breaks other code which gets the package list with "arch" 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('IMAGE_MANIFEST', True), 'w+') as image_manifest:
image_manifest.write(image_list_installed_packages(d, 'ver'))
image_manifest.write("\n")
}
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't pass the current format and then go splitting in all the places this function is used.
What do you think about that?
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'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. To be clear about the problems here, the format parameter to image_list_installed_packages() is ugly and we shouldn'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't need string splitting in the callers. Having a function called "list", a python keyword is also horrible. 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'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 Sent patch for review: http://lists.openembedded.org/pipermail/openembedded-core/2016-January/115006.html 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 |
Created attachment 2438 [details] 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'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.