* [PATCHv2 1/2] oe-pkgdata-util: Make parse_pkgdatafile() support package suffixed vars
@ 2018-06-02 19:30 Peter Kjellerstedt
2018-06-02 19:30 ` [PATCHv2 2/2] oe-pkgdata-util: package-info: Re-add support for the --extra option Peter Kjellerstedt
2018-06-03 16:14 ` [PATCHv2 1/2] oe-pkgdata-util: Make parse_pkgdatafile() support package suffixed vars Richard Purdie
0 siblings, 2 replies; 4+ messages in thread
From: Peter Kjellerstedt @ 2018-06-02 19:30 UTC (permalink / raw)
To: openembedded-core
Support for variables suffixed with package names, e.g., PKGV_foo, was
removed in commit 3d2c87c4, which broke support for recipes that set
other versions on their packages than what is in ${PV}.
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---
scripts/oe-pkgdata-util | 46 ++++++++++++++++++----------------------------
1 file changed, 18 insertions(+), 28 deletions(-)
diff --git a/scripts/oe-pkgdata-util b/scripts/oe-pkgdata-util
index aea8a57516..965f473725 100755
--- a/scripts/oe-pkgdata-util
+++ b/scripts/oe-pkgdata-util
@@ -286,36 +286,26 @@ def lookup_recipe(args):
def package_info(args):
def parse_pkgdatafile(pkgdatafile):
+ vars = ['PKGV', 'PKGE', 'PKGR', 'PN', 'PV', 'PE', 'PR', 'PKGSIZE']
with open(pkgdatafile, 'r') as f:
- pkge = ''
- pkgr = ''
- pe = ''
- pr = ''
+ vals = dict()
for line in f:
- if line.startswith('PKGV:'):
- pkg_version = line.split(':', 1)[1].strip()
- elif line.startswith('PKGE:'):
- pkge = line.split(':', 1)[1].strip()
- elif line.startswith('PKGR:'):
- pkgr = line.split(':', 1)[1].strip()
- elif line.startswith('PN:'):
- recipe = line.split(':', 1)[1].strip()
- elif line.startswith('PV:'):
- recipe_version = line.split(':', 1)[1].strip()
- elif line.startswith('PE:'):
- pe = line.split(':', 1)[1].strip()
- elif line.startswith('PR:'):
- pr = line.split(':', 1)[1].strip()
- elif line.startswith('PKGSIZE'):
- pkg_size = line.split(':', 1)[1].strip()
- if pkge:
- pkg_version = pkge + ":" + pkg_version
- if pkgr:
- pkg_version = pkg_version + "-" + pkgr
- if pe:
- recipe_version = pe + ":" + recipe_version
- if pr:
- recipe_version = recipe_version + "-" + pr
+ for var in vars:
+ m = re.match(var + '(?:_\S+)?:\s*(.+?)\s*$', line)
+ if m:
+ vals[var] = m.group(1)
+ pkg_version = vals['PKGV'] or ''
+ recipe = vals['PN'] or ''
+ recipe_version = vals['PV'] or ''
+ pkg_size = vals['PKGSIZE'] or ''
+ if 'PKGE' in vals:
+ pkg_version = vals['PKGE'] + ":" + pkg_version
+ if 'PKGR' in vals:
+ pkg_version = pkg_version + "-" + vals['PKGR']
+ if 'PE' in vals:
+ recipe_version = vals['PE'] + ":" + recipe_version
+ if 'PR' in vals:
+ recipe_version = recipe_version + "-" + vals['PR']
print("%s %s %s %s %s" % (pkg, pkg_version, recipe, recipe_version, pkg_size))
# Handle both multiple arguments and multiple values within an arg (old syntax)
--
2.12.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCHv2 2/2] oe-pkgdata-util: package-info: Re-add support for the --extra option
2018-06-02 19:30 [PATCHv2 1/2] oe-pkgdata-util: Make parse_pkgdatafile() support package suffixed vars Peter Kjellerstedt
@ 2018-06-02 19:30 ` Peter Kjellerstedt
2018-06-03 16:14 ` [PATCHv2 1/2] oe-pkgdata-util: Make parse_pkgdatafile() support package suffixed vars Richard Purdie
1 sibling, 0 replies; 4+ messages in thread
From: Peter Kjellerstedt @ 2018-06-02 19:30 UTC (permalink / raw)
To: openembedded-core
Commit 64d3ce83 broke the --extra option.
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---
scripts/oe-pkgdata-util | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/scripts/oe-pkgdata-util b/scripts/oe-pkgdata-util
index 965f473725..bd12047ea5 100755
--- a/scripts/oe-pkgdata-util
+++ b/scripts/oe-pkgdata-util
@@ -287,8 +287,11 @@ def lookup_recipe(args):
def package_info(args):
def parse_pkgdatafile(pkgdatafile):
vars = ['PKGV', 'PKGE', 'PKGR', 'PN', 'PV', 'PE', 'PR', 'PKGSIZE']
+ if args.extra:
+ vars += args.extra
with open(pkgdatafile, 'r') as f:
vals = dict()
+ extra = ''
for line in f:
for var in vars:
m = re.match(var + '(?:_\S+)?:\s*(.+?)\s*$', line)
@@ -306,7 +309,12 @@ def package_info(args):
recipe_version = vals['PE'] + ":" + recipe_version
if 'PR' in vals:
recipe_version = recipe_version + "-" + vals['PR']
- print("%s %s %s %s %s" % (pkg, pkg_version, recipe, recipe_version, pkg_size))
+ if args.extra:
+ for var in args.extra:
+ if var in vals:
+ val = re.sub(r'\s+', ' ', vals[var])
+ extra += ' "%s"' % val
+ print("%s %s %s %s %s%s" % (pkg, pkg_version, recipe, recipe_version, pkg_size, extra))
# Handle both multiple arguments and multiple values within an arg (old syntax)
packages = []
--
2.12.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCHv2 1/2] oe-pkgdata-util: Make parse_pkgdatafile() support package suffixed vars
2018-06-02 19:30 [PATCHv2 1/2] oe-pkgdata-util: Make parse_pkgdatafile() support package suffixed vars Peter Kjellerstedt
2018-06-02 19:30 ` [PATCHv2 2/2] oe-pkgdata-util: package-info: Re-add support for the --extra option Peter Kjellerstedt
@ 2018-06-03 16:14 ` Richard Purdie
2018-06-04 7:37 ` Peter Kjellerstedt
1 sibling, 1 reply; 4+ messages in thread
From: Richard Purdie @ 2018-06-03 16:14 UTC (permalink / raw)
To: Peter Kjellerstedt, openembedded-core
On Sat, 2018-06-02 at 21:30 +0200, Peter Kjellerstedt wrote:
> Support for variables suffixed with package names, e.g., PKGV_foo,
> was
> removed in commit 3d2c87c4, which broke support for recipes that set
> other versions on their packages than what is in ${PV}.
Would it be possible to write some simple tests for oe-pkgdata-util to
make sure we don't break it again?
Cheers,
Richard
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCHv2 1/2] oe-pkgdata-util: Make parse_pkgdatafile() support package suffixed vars
2018-06-03 16:14 ` [PATCHv2 1/2] oe-pkgdata-util: Make parse_pkgdatafile() support package suffixed vars Richard Purdie
@ 2018-06-04 7:37 ` Peter Kjellerstedt
0 siblings, 0 replies; 4+ messages in thread
From: Peter Kjellerstedt @ 2018-06-04 7:37 UTC (permalink / raw)
To: Richard Purdie, openembedded-core@lists.openembedded.org
> -----Original Message-----
> From: openembedded-core-bounces@lists.openembedded.org
> [mailto:openembedded-core-bounces@lists.openembedded.org] On Behalf Of
> Richard Purdie
> Sent: den 3 juni 2018 18:14
> To: Peter Kjellerstedt <peter.kjellerstedt@axis.com>; openembedded-
> core@lists.openembedded.org
> Subject: Re: [OE-core] [PATCHv2 1/2] oe-pkgdata-util: Make
> parse_pkgdatafile() support package suffixed vars
>
> On Sat, 2018-06-02 at 21:30 +0200, Peter Kjellerstedt wrote:
> > Support for variables suffixed with package names, e.g., PKGV_foo, was
> > removed in commit 3d2c87c4, which broke support for recipes that set
> > other versions on their packages than what is in ${PV}.
>
> Would it be possible to write some simple tests for oe-pkgdata-util to
> make sure we don't break it again?
It probably would. However, I am not the one to do the first ones (I
generally suck at anything related to unit tests). But I can probably
help add some to cover our use cases once there is a precedence for
how to do it.
> Cheers,
>
> Richard
//Peter
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-06-04 7:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-02 19:30 [PATCHv2 1/2] oe-pkgdata-util: Make parse_pkgdatafile() support package suffixed vars Peter Kjellerstedt
2018-06-02 19:30 ` [PATCHv2 2/2] oe-pkgdata-util: package-info: Re-add support for the --extra option Peter Kjellerstedt
2018-06-03 16:14 ` [PATCHv2 1/2] oe-pkgdata-util: Make parse_pkgdatafile() support package suffixed vars Richard Purdie
2018-06-04 7:37 ` Peter Kjellerstedt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox