* [PATCH 0/2]
@ 2017-12-18 22:12 Amanda Brindle
2017-12-18 22:12 ` [PATCH 1/2] oe-pkgdata-util: Refactor functions for consistency Amanda Brindle
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Amanda Brindle @ 2017-12-18 22:12 UTC (permalink / raw)
To: openembedded-core; +Cc: paul.eggleton, Amanda Brindle
The following changes since commit b73e96e7f3f5d1ba3a221d99792a7a3c7ef42c21:
python-scons: upgrade to v3.0.1; use pypi.bbclass (2017-12-13 14:00:52 +0000)
are available in the git repository at:
git://git.yoctoproject.org/poky-contrib abrindle/rprovides
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=abrindle/rprovides
Amanda Brindle (2):
oe-pkgdata-util: Refactor functions for consistency
oe-pkgdata-util: Add support for RPROVIDES
scripts/oe-pkgdata-util | 173 +++++++++++++++++++++++++++---------------------
1 file changed, 97 insertions(+), 76 deletions(-)
--
2.7.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] oe-pkgdata-util: Refactor functions for consistency
2017-12-18 22:12 [PATCH 0/2] Amanda Brindle
@ 2017-12-18 22:12 ` Amanda Brindle
2017-12-18 22:12 ` [PATCH 2/2] oe-pkgdata-util: Add support for RPROVIDES Amanda Brindle
2018-01-14 9:09 ` [PATCH 0/2] Richard Purdie
2 siblings, 0 replies; 4+ messages in thread
From: Amanda Brindle @ 2017-12-18 22:12 UTC (permalink / raw)
To: openembedded-core; +Cc: paul.eggleton, Amanda Brindle
Refactor functions lookup_recipe and package_info to be consistent with
list_pkg_files. Print the appropriate information as soon as it's found,
rather than storing it in a mappings variable and wait to print after
searching all packages.
Signed-off-by: Amanda Brindle <amanda.r.brindle@intel.com>
---
scripts/oe-pkgdata-util | 107 ++++++++++++++++++++++--------------------------
1 file changed, 48 insertions(+), 59 deletions(-)
diff --git a/scripts/oe-pkgdata-util b/scripts/oe-pkgdata-util
index c6fba56..e4ccf30 100755
--- a/scripts/oe-pkgdata-util
+++ b/scripts/oe-pkgdata-util
@@ -257,25 +257,22 @@ def lookup_recipe(args):
for pkgitem in args.pkg:
pkgs.extend(pkgitem.split())
- mappings = defaultdict(list)
for pkg in pkgs:
- pkgfile = os.path.join(args.pkgdata_dir, 'runtime-reverse', pkg)
- if os.path.exists(pkgfile):
- with open(pkgfile, 'r') as f:
+ pkgdatafile = os.path.join(args.pkgdata_dir, 'runtime-reverse', pkg)
+ if os.path.exists(pkgdatafile):
+ with open(pkgdatafile, 'r') as f:
+ found = False
for line in f:
- fields = line.rstrip().split(': ')
- if fields[0] == 'PN':
- mappings[pkg].append(fields[1])
+ if line.startswith('PN'):
+ print("\t%s" % line.split(':', 1)[1].strip())
+ found = True
break
- if len(mappings) < len(pkgs):
- missing = list(set(pkgs) - set(mappings.keys()))
- logger.error("The following packages could not be found: %s" % ', '.join(missing))
- sys.exit(1)
-
- items = []
- for pkg in pkgs:
- items.extend(mappings.get(pkg, []))
- print('\n'.join(items))
+ if not found:
+ logger.error("Unable to find PN entry in %s" % pkgdatafile)
+ sys.exit(1)
+ else:
+ logger.error("Unable to find any built runtime package named %s" % pkg)
+ sys.exit(1)
def package_info(args):
# Handle both multiple arguments and multiple values within an arg (old syntax)
@@ -293,51 +290,43 @@ def package_info(args):
logger.error("No packages specified")
sys.exit(1)
- mappings = defaultdict(lambda: defaultdict(str))
for pkg in packages:
- pkgfile = os.path.join(args.pkgdata_dir, 'runtime-reverse', pkg)
- if os.path.exists(pkgfile):
- with open(pkgfile, 'r') as f:
+ pkgdatafile = os.path.join(args.pkgdata_dir, 'runtime-reverse', pkg)
+ if os.path.exists(pkgdatafile):
+ with open(pkgdatafile, 'r') as f:
+ pkge = ''
+ pkgr = ''
+ pe = ''
+ pr = ''
for line in f:
- fields = line.rstrip().split(': ')
- if fields[0].endswith("_" + pkg):
- k = fields[0][:len(fields[0]) - len(pkg) - 1]
- else:
- k = fields[0]
- v = fields[1] if len(fields) == 2 else ""
- mappings[pkg][k] = v
-
- if len(mappings) < len(packages):
- missing = list(set(packages) - set(mappings.keys()))
- logger.error("The following packages could not be found: %s" %
- ', '.join(missing))
- sys.exit(1)
-
- items = []
- for pkg in packages:
- pkg_version = mappings[pkg]['PKGV']
- if mappings[pkg]['PKGE']:
- pkg_version = mappings[pkg]['PKGE'] + ":" + pkg_version
- if mappings[pkg]['PKGR']:
- pkg_version = pkg_version + "-" + mappings[pkg]['PKGR']
- recipe = mappings[pkg]['PN']
- recipe_version = mappings[pkg]['PV']
- if mappings[pkg]['PE']:
- recipe_version = mappings[pkg]['PE'] + ":" + recipe_version
- if mappings[pkg]['PR']:
- recipe_version = recipe_version + "-" + mappings[pkg]['PR']
- pkg_size = mappings[pkg]['PKGSIZE']
-
- line = "%s %s %s %s %s" % (pkg, pkg_version, recipe, recipe_version, pkg_size)
-
- if args.extra:
- for var in args.extra:
- val = mappings[pkg][var].strip()
- val = re.sub(r'\s+', ' ', val)
- line += ' "%s"' % val
-
- items.append(line)
- print('\n'.join(items))
+ 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
+ print("%s %s %s %s %s" % (pkg, pkg_version, recipe, recipe_version, pkg_size))
+ else:
+ logger.error("Unable to find any built runtime package named %s" % pkg)
+ sys.exit(1)
def get_recipe_pkgs(pkgdata_dir, recipe, unpackaged):
recipedatafile = os.path.join(pkgdata_dir, recipe)
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] oe-pkgdata-util: Add support for RPROVIDES
2017-12-18 22:12 [PATCH 0/2] Amanda Brindle
2017-12-18 22:12 ` [PATCH 1/2] oe-pkgdata-util: Refactor functions for consistency Amanda Brindle
@ 2017-12-18 22:12 ` Amanda Brindle
2018-01-14 9:09 ` [PATCH 0/2] Richard Purdie
2 siblings, 0 replies; 4+ messages in thread
From: Amanda Brindle @ 2017-12-18 22:12 UTC (permalink / raw)
To: openembedded-core; +Cc: paul.eggleton, Amanda Brindle
In lookup_reicpe, package_info, and list_pkg_files, check if the package
name exists in runtime-rprovides. If so, and the provider package has a
different name than the inputted package, print a note that says the
specified package is in another package's RPROVIDES. If the provider
package has the same name as the inputted package, continue as before.
Fixes [YOCTO 11943]
Signed-off-by: Amanda Brindle <amanda.r.brindle@intel.com>
---
scripts/oe-pkgdata-util | 152 +++++++++++++++++++++++++++++-------------------
1 file changed, 92 insertions(+), 60 deletions(-)
diff --git a/scripts/oe-pkgdata-util b/scripts/oe-pkgdata-util
index e4ccf30..45e1505 100755
--- a/scripts/oe-pkgdata-util
+++ b/scripts/oe-pkgdata-util
@@ -252,29 +252,72 @@ def lookup_pkg(args):
print('\n'.join(items))
def lookup_recipe(args):
+ def parse_pkgdatafile(pkgdatafile):
+ with open(pkgdatafile, 'r') as f:
+ found = False
+ for line in f:
+ if line.startswith('PN'):
+ print("%s" % line.split(':', 1)[1].strip())
+ found = True
+ break
+ if not found:
+ logger.error("Unable to find PN entry in %s" % pkgdatafile)
+ sys.exit(1)
+
# Handle both multiple arguments and multiple values within an arg (old syntax)
pkgs = []
for pkgitem in args.pkg:
pkgs.extend(pkgitem.split())
for pkg in pkgs:
+ providepkgpath = os.path.join(args.pkgdata_dir, "runtime-rprovides", pkg)
+ if os.path.exists(providepkgpath):
+ for f in os.listdir(providepkgpath):
+ if f != pkg:
+ print("%s is in the RPROVIDES of %s:" % (pkg, f))
+ pkgdatafile = os.path.join(args.pkgdata_dir, "runtime", f)
+ parse_pkgdatafile(pkgdatafile)
+ break
pkgdatafile = os.path.join(args.pkgdata_dir, 'runtime-reverse', pkg)
- if os.path.exists(pkgdatafile):
- with open(pkgdatafile, 'r') as f:
- found = False
- for line in f:
- if line.startswith('PN'):
- print("\t%s" % line.split(':', 1)[1].strip())
- found = True
- break
- if not found:
- logger.error("Unable to find PN entry in %s" % pkgdatafile)
- sys.exit(1)
- else:
+ if not os.path.exists(pkgdatafile):
logger.error("Unable to find any built runtime package named %s" % pkg)
sys.exit(1)
+ parse_pkgdatafile(pkgdatafile)
def package_info(args):
+ def parse_pkgdatafile(pkgdatafile):
+ with open(pkgdatafile, 'r') as f:
+ pkge = ''
+ pkgr = ''
+ pe = ''
+ pr = ''
+ 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
+ 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)
packages = []
if args.file:
@@ -291,42 +334,19 @@ def package_info(args):
sys.exit(1)
for pkg in packages:
- pkgdatafile = os.path.join(args.pkgdata_dir, 'runtime-reverse', pkg)
- if os.path.exists(pkgdatafile):
- with open(pkgdatafile, 'r') as f:
- pkge = ''
- pkgr = ''
- pe = ''
- pr = ''
- 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
- print("%s %s %s %s %s" % (pkg, pkg_version, recipe, recipe_version, pkg_size))
- else:
+ providepkgpath = os.path.join(args.pkgdata_dir, "runtime-rprovides", pkg)
+ if os.path.exists(providepkgpath):
+ for f in os.listdir(providepkgpath):
+ if f != pkg:
+ print("%s is in the RPROVIDES of %s:" % (pkg, f))
+ pkgdatafile = os.path.join(args.pkgdata_dir, "runtime", f)
+ parse_pkgdatafile(pkgdatafile)
+ break
+ pkgdatafile = os.path.join(args.pkgdata_dir, "runtime-reverse", pkg)
+ if not os.path.exists(pkgdatafile):
logger.error("Unable to find any built runtime package named %s" % pkg)
sys.exit(1)
+ parse_pkgdatafile(pkgdatafile)
def get_recipe_pkgs(pkgdata_dir, recipe, unpackaged):
recipedatafile = os.path.join(pkgdata_dir, recipe)
@@ -415,6 +435,21 @@ def list_pkgs(args):
def list_pkg_files(args):
import json
+ def parse_pkgdatafile(pkgdatafile):
+ with open(pkgdatafile, 'r') as f:
+ found = False
+ for line in f:
+ if line.startswith('FILES_INFO:'):
+ found = True
+ val = line.split(':', 1)[1].strip()
+ dictval = json.loads(val)
+ for fullpth in sorted(dictval):
+ print("\t%s" % fullpth)
+ break
+ if not found:
+ logger.error("Unable to find FILES_INFO entry in %s" % pkgdatafile)
+ sys.exit(1)
+
if args.recipe:
if args.pkg:
@@ -444,25 +479,22 @@ def list_pkg_files(args):
continue
logger.error("Unable to find any built runtime package named %s" % pkg)
sys.exit(1)
+ parse_pkgdatafile(pkgdatafile)
+
else:
+ providepkgpath = os.path.join(args.pkgdata_dir, "runtime-rprovides", pkg)
+ if os.path.exists(providepkgpath):
+ for f in os.listdir(providepkgpath):
+ if f != pkg:
+ print("%s is in the RPROVIDES of %s:" % (pkg, f))
+ pkgdatafile = os.path.join(args.pkgdata_dir, "runtime", f)
+ parse_pkgdatafile(pkgdatafile)
+ break
pkgdatafile = os.path.join(args.pkgdata_dir, "runtime", pkg)
if not os.path.exists(pkgdatafile):
logger.error("Unable to find any built recipe-space package named %s" % pkg)
sys.exit(1)
-
- with open(pkgdatafile, 'r') as f:
- found = False
- for line in f:
- if line.startswith('FILES_INFO:'):
- found = True
- val = line.split(':', 1)[1].strip()
- dictval = json.loads(val)
- for fullpth in sorted(dictval):
- print("\t%s" % fullpth)
- break
- if not found:
- logger.error("Unable to find FILES_INFO entry in %s" % pkgdatafile)
- sys.exit(1)
+ parse_pkgdatafile(pkgdatafile)
def find_path(args):
import json
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2]
2017-12-18 22:12 [PATCH 0/2] Amanda Brindle
2017-12-18 22:12 ` [PATCH 1/2] oe-pkgdata-util: Refactor functions for consistency Amanda Brindle
2017-12-18 22:12 ` [PATCH 2/2] oe-pkgdata-util: Add support for RPROVIDES Amanda Brindle
@ 2018-01-14 9:09 ` Richard Purdie
2 siblings, 0 replies; 4+ messages in thread
From: Richard Purdie @ 2018-01-14 9:09 UTC (permalink / raw)
To: Amanda Brindle, openembedded-core; +Cc: paul.eggleton
On Mon, 2017-12-18 at 14:12 -0800, Amanda Brindle wrote:
> The following changes since commit
> b73e96e7f3f5d1ba3a221d99792a7a3c7ef42c21:
>
> python-scons: upgrade to v3.0.1; use pypi.bbclass (2017-12-13
> 14:00:52 +0000)
>
> are available in the git repository at:
>
> git://git.yoctoproject.org/poky-contrib abrindle/rprovides
> http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=abrindle/r
> provides
>
> Amanda Brindle (2):
> oe-pkgdata-util: Refactor functions for consistency
> oe-pkgdata-util: Add support for RPROVIDES
>
> scripts/oe-pkgdata-util | 173 +++++++++++++++++++++++++++-----------
> ----------
> 1 file changed, 97 insertions(+), 76 deletions(-)
Hi Amanda,
I pulled these into master-next for testing but we saw:
https://autobuilder.yocto.io/builders/nightly-oe-selftest/builds/753/steps/Running%20oe-selftest/logs/stdio
You can reproduce with:
oe-selftest -r pkgdata.OePkgdataUtilTests
Cheers,
Richard
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-01-14 9:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-18 22:12 [PATCH 0/2] Amanda Brindle
2017-12-18 22:12 ` [PATCH 1/2] oe-pkgdata-util: Refactor functions for consistency Amanda Brindle
2017-12-18 22:12 ` [PATCH 2/2] oe-pkgdata-util: Add support for RPROVIDES Amanda Brindle
2018-01-14 9:09 ` [PATCH 0/2] Richard Purdie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox