summaryrefslogtreecommitdiffstats
path: root/scripts/lib/recipetool/create.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib/recipetool/create.py')
-rw-r--r--scripts/lib/recipetool/create.py40
1 files changed, 20 insertions, 20 deletions
diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py
index 2b7cc76ccb..2a6a28ba91 100644
--- a/scripts/lib/recipetool/create.py
+++ b/scripts/lib/recipetool/create.py
@@ -417,7 +417,7 @@ def create_recipe(args):
417 pkgarch = "${MACHINE_ARCH}" 417 pkgarch = "${MACHINE_ARCH}"
418 418
419 extravalues = {} 419 extravalues = {}
420 checksums = (None, None) 420 checksums = {}
421 tempsrc = '' 421 tempsrc = ''
422 source = args.source 422 source = args.source
423 srcsubdir = '' 423 srcsubdir = ''
@@ -439,22 +439,25 @@ def create_recipe(args):
439 if res: 439 if res:
440 srcrev = res.group(1) 440 srcrev = res.group(1)
441 srcuri = rev_re.sub('', srcuri) 441 srcuri = rev_re.sub('', srcuri)
442 tempsrc = tempfile.mkdtemp(prefix='recipetool-') 442
443 srctree = tempsrc 443 tmpparent = tinfoil.config_data.getVar('BASE_WORKDIR')
444 d = bb.data.createCopy(tinfoil.config_data) 444 bb.utils.mkdirhier(tmpparent)
445 if fetchuri.startswith('npm://'): 445 tempsrc = tempfile.mkdtemp(prefix='recipetool-', dir=tmpparent)
446 # Check if npm is available 446 srctree = os.path.join(tempsrc, 'source')
447 npm_bindir = check_npm(tinfoil, args.devtool) 447
448 d.prependVar('PATH', '%s:' % npm_bindir)
449 logger.info('Fetching %s...' % srcuri)
450 try: 448 try:
451 checksums = scriptutils.fetch_uri(d, fetchuri, srctree, srcrev) 449 checksums, ftmpdir = scriptutils.fetch_url(tinfoil, srcuri, srcrev, srctree, logger, preserve_tmp=args.keep_temp)
452 except bb.fetch2.BBFetchException as e: 450 except scriptutils.FetchUrlFailure as e:
453 logger.error(str(e).rstrip()) 451 logger.error(str(e))
454 sys.exit(1) 452 sys.exit(1)
453
454 if ftmpdir and args.keep_temp:
455 logger.info('Fetch temp directory is %s' % ftmpdir)
456
455 dirlist = os.listdir(srctree) 457 dirlist = os.listdir(srctree)
456 if 'git.indirectionsymlink' in dirlist: 458 filterout = ['git.indirectionsymlink']
457 dirlist.remove('git.indirectionsymlink') 459 dirlist = [x for x in dirlist if x not in filterout]
460 logger.debug('Directory listing (excluding filtered out):\n %s' % '\n '.join(dirlist))
458 if len(dirlist) == 1: 461 if len(dirlist) == 1:
459 singleitem = os.path.join(srctree, dirlist[0]) 462 singleitem = os.path.join(srctree, dirlist[0])
460 if os.path.isdir(singleitem): 463 if os.path.isdir(singleitem):
@@ -465,7 +468,7 @@ def create_recipe(args):
465 check_single_file(dirlist[0], fetchuri) 468 check_single_file(dirlist[0], fetchuri)
466 elif len(dirlist) == 0: 469 elif len(dirlist) == 0:
467 if '/' in fetchuri: 470 if '/' in fetchuri:
468 fn = os.path.join(d.getVar('DL_DIR'), fetchuri.split('/')[-1]) 471 fn = os.path.join(tinfoil.config_data.getVar('DL_DIR'), fetchuri.split('/')[-1])
469 if os.path.isfile(fn): 472 if os.path.isfile(fn):
470 check_single_file(fn, fetchuri) 473 check_single_file(fn, fetchuri)
471 # If we've got to here then there's no source so we might as well give up 474 # If we've got to here then there's no source so we might as well give up
@@ -593,11 +596,8 @@ def create_recipe(args):
593 if not srcuri: 596 if not srcuri:
594 lines_before.append('# No information for SRC_URI yet (only an external source tree was specified)') 597 lines_before.append('# No information for SRC_URI yet (only an external source tree was specified)')
595 lines_before.append('SRC_URI = "%s"' % srcuri) 598 lines_before.append('SRC_URI = "%s"' % srcuri)
596 (md5value, sha256value) = checksums 599 for key, value in sorted(checksums.items()):
597 if md5value: 600 lines_before.append('SRC_URI[%s] = "%s"' % (key, value))
598 lines_before.append('SRC_URI[md5sum] = "%s"' % md5value)
599 if sha256value:
600 lines_before.append('SRC_URI[sha256sum] = "%s"' % sha256value)
601 if srcuri and supports_srcrev(srcuri): 601 if srcuri and supports_srcrev(srcuri):
602 lines_before.append('') 602 lines_before.append('')
603 lines_before.append('# Modify these as desired') 603 lines_before.append('# Modify these as desired')