* [PATCH 1/1] package_ipk.bbclass: Add check for empty lines in DESCRIPTION [not found] <cover.1485247027.git.mariano.lopez@linux.intel.com> @ 2017-01-24 8:37 ` mariano.lopez 2017-01-24 18:52 ` Christopher Larson 0 siblings, 1 reply; 4+ messages in thread From: mariano.lopez @ 2017-01-24 8:37 UTC (permalink / raw) To: openembedded-core From: Mariano Lopez <mariano.lopez@linux.intel.com> opkg uses empty lines as separator for next package and if an ipk file was packaged with empty lines in DESCRIPTION opkg won't be able to handle such ipk file, this happens at execution time. This commit will add a check for empty lines in DESCRIPTION when generating to ipk package to avoid this issue. [YOCTO #10677] Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com> --- meta/classes/package_ipk.bbclass | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/meta/classes/package_ipk.bbclass b/meta/classes/package_ipk.bbclass index a76b235..a8a4ddc 100644 --- a/meta/classes/package_ipk.bbclass +++ b/meta/classes/package_ipk.bbclass @@ -32,6 +32,13 @@ python do_package_ipk () { bb.error("Variables incorrectly set, unable to package") return + # opkg won't allow empty lines in package's description at execution + # time, so is better to fail at build time instead when trying to install. + description = d.getVar('DESCRIPTION').encode('UTF-8', 'ignore') + description = description.decode('unicode_escape') + if ([line for line in description.splitlines() if not line.strip()]): + bb.fatal("opkg won't allow empty lines in DESCRIPTION") + packages = d.getVar('PACKAGES') if not packages or packages == '': bb.debug(1, "No packages; nothing to do") -- 2.6.6 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] package_ipk.bbclass: Add check for empty lines in DESCRIPTION 2017-01-24 8:37 ` [PATCH 1/1] package_ipk.bbclass: Add check for empty lines in DESCRIPTION mariano.lopez @ 2017-01-24 18:52 ` Christopher Larson 2017-01-25 11:56 ` Richard Purdie 0 siblings, 1 reply; 4+ messages in thread From: Christopher Larson @ 2017-01-24 18:52 UTC (permalink / raw) To: Mariano Lopez; +Cc: Patches and discussions about the oe-core layer [-- Attachment #1: Type: text/plain, Size: 819 bytes --] On Tue, Jan 24, 2017 at 1:37 AM, <mariano.lopez@linux.intel.com> wrote: > From: Mariano Lopez <mariano.lopez@linux.intel.com> > > opkg uses empty lines as separator for next package and if an ipk > file was packaged with empty lines in DESCRIPTION opkg won't be > able to handle such ipk file, this happens at execution time. > > This commit will add a check for empty lines in DESCRIPTION when > generating to ipk package to avoid this issue. > > [YOCTO #10677] > > Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com> > Could it handle a line with just a space, or a period? Could you not replace the lines with that instead, rather than aborting? -- Christopher Larson clarson at kergoth dot com Founder - BitBake, OpenEmbedded, OpenZaurus Senior Software Engineer, Mentor Graphics [-- Attachment #2: Type: text/html, Size: 1434 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] package_ipk.bbclass: Add check for empty lines in DESCRIPTION 2017-01-24 18:52 ` Christopher Larson @ 2017-01-25 11:56 ` Richard Purdie 2017-01-26 15:16 ` Mariano Lopez 0 siblings, 1 reply; 4+ messages in thread From: Richard Purdie @ 2017-01-25 11:56 UTC (permalink / raw) To: Christopher Larson, Mariano Lopez Cc: Patches and discussions about the oe-core layer On Tue, 2017-01-24 at 11:52 -0700, Christopher Larson wrote: > > On Tue, Jan 24, 2017 at 1:37 AM, <mariano.lopez@linux.intel.com> > wrote: > > From: Mariano Lopez <mariano.lopez@linux.intel.com> > > > > opkg uses empty lines as separator for next package and if an ipk > > file was packaged with empty lines in DESCRIPTION opkg won't be > > able to handle such ipk file, this happens at execution time. > > > > This commit will add a check for empty lines in DESCRIPTION when > > generating to ipk package to avoid this issue. > > > > [YOCTO #10677] > > > > Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com> > > > Could it handle a line with just a space, or a period? Could you not > replace the lines with that instead, rather than aborting? FWIW package_deb uses ".". Also, please use bb.fatal() calls with caution, I just removed several from that class. In this case its perhaps ok but often the correct thing to do is raise an exception of some kind. This means bitbake will generate a usable traceback rather than simply printing the fatal message. In this case the message is probably fine but there were several cases where a traceback was a much better idea as the fatal message wasn't enough to debug with. Cheers, Richard ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] package_ipk.bbclass: Add check for empty lines in DESCRIPTION 2017-01-25 11:56 ` Richard Purdie @ 2017-01-26 15:16 ` Mariano Lopez 0 siblings, 0 replies; 4+ messages in thread From: Mariano Lopez @ 2017-01-26 15:16 UTC (permalink / raw) To: Richard Purdie, Christopher Larson Cc: Patches and discussions about the oe-core layer On 25/01/17 05:56, Richard Purdie wrote: > On Tue, 2017-01-24 at 11:52 -0700, Christopher Larson wrote: >> On Tue, Jan 24, 2017 at 1:37 AM, <mariano.lopez@linux.intel.com> >> wrote: >>> From: Mariano Lopez <mariano.lopez@linux.intel.com> >>> >>> opkg uses empty lines as separator for next package and if an ipk >>> file was packaged with empty lines in DESCRIPTION opkg won't be >>> able to handle such ipk file, this happens at execution time. >>> >>> This commit will add a check for empty lines in DESCRIPTION when >>> generating to ipk package to avoid this issue. >>> >>> [YOCTO #10677] >>> >>> Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com> >>> >> Could it handle a line with just a space, or a period? Could you not >> replace the lines with that instead, rather than aborting? > FWIW package_deb uses ".". Also opkg will strip() the lines, so an empty space is not a option here. > > Also, please use bb.fatal() calls with caution, I just removed several > from that class. In this case its perhaps ok but often the correct > thing to do is raise an exception of some kind. This means bitbake will > generate a usable traceback rather than simply printing the fatal > message. In this case the message is probably fine but there were > several cases where a traceback was a much better idea as the fatal > message wasn't enough to debug with. Fair enough, I will consider this advice when using bb.fatal() Regards, Mariano ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-01-26 15:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <cover.1485247027.git.mariano.lopez@linux.intel.com>
2017-01-24 8:37 ` [PATCH 1/1] package_ipk.bbclass: Add check for empty lines in DESCRIPTION mariano.lopez
2017-01-24 18:52 ` Christopher Larson
2017-01-25 11:56 ` Richard Purdie
2017-01-26 15:16 ` Mariano Lopez
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox