summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2016-09-08 14:07:36 +1200
committerPaul Eggleton <paul.eggleton@linux.intel.com>2016-09-19 08:05:30 +1200
commit48874d7612b3b85ab8794541e60d621d52bc53e0 (patch)
tree4eb3c49924b4ac163e291acba6d8a9d8ba049f36
parent3914ebc55625ceb10c332f2e93f6737276acf736 (diff)
downloadopenembedded-core-contrib-48874d7612b3b85ab8794541e60d621d52bc53e0.tar.gz
openembedded-core-contrib-48874d7612b3b85ab8794541e60d621d52bc53e0.tar.bz2
openembedded-core-contrib-48874d7612b3b85ab8794541e60d621d52bc53e0.zip
recipetool: create: fix error with git tree and no network
When creating a recipe for an existing local git clone, we attempt to use the fetcher to determine if it supports the SRCREV variable. Unfortunately running this code does a network check to get the latest revision as a direct result of us using '${AUTOREV}' as a default value. If you don't have a network connection this will of course fail. Rather than have this block creating the recipe, catch the exception and just guess from the URL. Ultimately this should probably be fixed in the fetcher but for now this will at least resolve the issue on this end. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
-rw-r--r--scripts/lib/recipetool/create.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py
index f7b0676f32..f8701d401e 100644
--- a/scripts/lib/recipetool/create.py
+++ b/scripts/lib/recipetool/create.py
@@ -336,10 +336,16 @@ def supports_srcrev(uri):
# odd interactions with the urldata cache which lead to errors
localdata.setVar('SRCREV', '${AUTOREV}')
bb.data.update_data(localdata)
- fetcher = bb.fetch2.Fetch([uri], localdata)
- urldata = fetcher.ud
- for u in urldata:
- if urldata[u].method.supports_srcrev():
+ try:
+ fetcher = bb.fetch2.Fetch([uri], localdata)
+ urldata = fetcher.ud
+ for u in urldata:
+ if urldata[u].method.supports_srcrev():
+ return True
+ except bb.fetch2.FetchError as e:
+ logger.debug('FetchError in supports_srcrev: %s' % str(e))
+ # Fall back to basic check
+ if uri.startswith(('git://', 'gitsm://')):
return True
return False