diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2017-07-20 16:48:10 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-07-21 08:44:25 +0100 |
commit | 7d474e27bc851b22b7c00ace66ac40ea45588054 (patch) | |
tree | d2e6abfa483ff914a96c220f639e61f86dd13a25 /scripts | |
parent | 047d37633b2d451ee4f53c635d3f48b9b0732e44 (diff) | |
download | poky-7d474e27bc851b22b7c00ace66ac40ea45588054.tar.gz |
recipetool: create: eliminate second fetch for packages
When dealing with package files (.rpm, .ipk etc.) we need to unpack them
ourselves to get the metadata, which is thrown away when the fetcher
unpacks them. However, since we've already fetched the file once, I'm
not sure as to why I thought I needed to fetch it again - we can just
get the local path and then unpack it directly.
(From OE-Core rev: be45e9b17e9dbc8c2594d3a939be377ab0720a7c)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/lib/recipetool/create.py | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py index 923c336849..2b7cc76ccb 100644 --- a/scripts/lib/recipetool/create.py +++ b/scripts/lib/recipetool/create.py | |||
@@ -478,20 +478,11 @@ def create_recipe(args): | |||
478 | bb.process.run('git submodule update --init --recursive', cwd=srctree) | 478 | bb.process.run('git submodule update --init --recursive', cwd=srctree) |
479 | 479 | ||
480 | if is_package(fetchuri): | 480 | if is_package(fetchuri): |
481 | tmpfdir = tempfile.mkdtemp(prefix='recipetool-') | 481 | localdata = bb.data.createCopy(tinfoil.config_data) |
482 | try: | 482 | pkgfile = bb.fetch2.localpath(fetchuri, localdata) |
483 | pkgfile = None | 483 | if pkgfile: |
484 | tmpfdir = tempfile.mkdtemp(prefix='recipetool-') | ||
484 | try: | 485 | try: |
485 | fileuri = fetchuri + ';unpack=0' | ||
486 | scriptutils.fetch_uri(tinfoil.config_data, fileuri, tmpfdir, srcrev) | ||
487 | for root, _, files in os.walk(tmpfdir): | ||
488 | for f in files: | ||
489 | pkgfile = os.path.join(root, f) | ||
490 | break | ||
491 | except bb.fetch2.BBFetchException as e: | ||
492 | logger.warn('Second fetch to get metadata failed: %s' % str(e).rstrip()) | ||
493 | |||
494 | if pkgfile: | ||
495 | if pkgfile.endswith(('.deb', '.ipk')): | 486 | if pkgfile.endswith(('.deb', '.ipk')): |
496 | stdout, _ = bb.process.run('ar x %s' % pkgfile, cwd=tmpfdir) | 487 | stdout, _ = bb.process.run('ar x %s' % pkgfile, cwd=tmpfdir) |
497 | stdout, _ = bb.process.run('tar xf control.tar.gz', cwd=tmpfdir) | 488 | stdout, _ = bb.process.run('tar xf control.tar.gz', cwd=tmpfdir) |
@@ -501,8 +492,8 @@ def create_recipe(args): | |||
501 | stdout, _ = bb.process.run('rpm -qp --xml %s > pkginfo.xml' % pkgfile, cwd=tmpfdir) | 492 | stdout, _ = bb.process.run('rpm -qp --xml %s > pkginfo.xml' % pkgfile, cwd=tmpfdir) |
502 | values = convert_rpm_xml(os.path.join(tmpfdir, 'pkginfo.xml')) | 493 | values = convert_rpm_xml(os.path.join(tmpfdir, 'pkginfo.xml')) |
503 | extravalues.update(values) | 494 | extravalues.update(values) |
504 | finally: | 495 | finally: |
505 | shutil.rmtree(tmpfdir) | 496 | shutil.rmtree(tmpfdir) |
506 | else: | 497 | else: |
507 | # Assume we're pointing to an existing source tree | 498 | # Assume we're pointing to an existing source tree |
508 | if args.extract_to: | 499 | if args.extract_to: |