summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--scripts/lib/devtool/standard.py4
-rw-r--r--scripts/lib/recipetool/create.py15
2 files changed, 14 insertions, 5 deletions
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index 645a61f25b..f2ba69976f 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -65,6 +65,10 @@ def add(args, config, basepath, workspace):
65 elif os.path.isdir(args.recipename): 65 elif os.path.isdir(args.recipename):
66 logger.warn('Ambiguous argument %s - assuming you mean it to be the recipe name') 66 logger.warn('Ambiguous argument %s - assuming you mean it to be the recipe name')
67 67
68 if args.srctree and os.path.isfile(args.srctree):
69 args.fetchuri = 'file://' + os.path.abspath(args.srctree)
70 args.srctree = ''
71
68 if args.fetch: 72 if args.fetch:
69 if args.fetchuri: 73 if args.fetchuri:
70 raise DevtoolError('URI specified as positional argument as well as -f/--fetch') 74 raise DevtoolError('URI specified as positional argument as well as -f/--fetch')
diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py
index 95b16fb310..f246028a02 100644
--- a/scripts/lib/recipetool/create.py
+++ b/scripts/lib/recipetool/create.py
@@ -351,11 +351,16 @@ def create_recipe(args):
351 extravalues = {} 351 extravalues = {}
352 checksums = (None, None) 352 checksums = (None, None)
353 tempsrc = '' 353 tempsrc = ''
354 source = args.source
354 srcsubdir = '' 355 srcsubdir = ''
355 srcrev = '${AUTOREV}' 356 srcrev = '${AUTOREV}'
356 if '://' in args.source: 357
358 if os.path.isfile(source):
359 source = 'file://%s' % os.path.abspath(source)
360
361 if '://' in source:
357 # Fetch a URL 362 # Fetch a URL
358 fetchuri = reformat_git_uri(urldefrag(args.source)[0]) 363 fetchuri = reformat_git_uri(urldefrag(source)[0])
359 if args.binary: 364 if args.binary:
360 # Assume the archive contains the directory structure verbatim 365 # Assume the archive contains the directory structure verbatim
361 # so we need to extract to a subdirectory 366 # so we need to extract to a subdirectory
@@ -426,10 +431,10 @@ def create_recipe(args):
426 if args.extract_to: 431 if args.extract_to:
427 logger.error('--extract-to cannot be specified if source is a directory') 432 logger.error('--extract-to cannot be specified if source is a directory')
428 sys.exit(1) 433 sys.exit(1)
429 if not os.path.isdir(args.source): 434 if not os.path.isdir(source):
430 logger.error('Invalid source directory %s' % args.source) 435 logger.error('Invalid source directory %s' % source)
431 sys.exit(1) 436 sys.exit(1)
432 srctree = args.source 437 srctree = source
433 srcuri = '' 438 srcuri = ''
434 if os.path.exists(os.path.join(srctree, '.git')): 439 if os.path.exists(os.path.join(srctree, '.git')):
435 # Try to get upstream repo location from origin remote 440 # Try to get upstream repo location from origin remote