summaryrefslogtreecommitdiff
path: root/scripts/lib
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2015-12-22 17:03:00 +1300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-12-22 16:44:03 +0000
commit83b1245b2638eb5d314fe663d33cd52a776a34a7 (patch)
tree22c9f9d660717c1124b252594483c197d5f0b3bc /scripts/lib
parent7e63a672517518644a37ce006e05b5494c29cf6e (diff)
downloadopenembedded-core-83b1245b2638eb5d314fe663d33cd52a776a34a7.tar.gz
openembedded-core-83b1245b2638eb5d314fe663d33cd52a776a34a7.tar.bz2
openembedded-core-83b1245b2638eb5d314fe663d33cd52a776a34a7.zip
recipetool: create: detect when specified URL returns a web page
If the user specifies a URL that just returns a web page, then it's probably incorrect (or broken); attempt to detect this and show an error if it's the case. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib')
-rw-r--r--scripts/lib/recipetool/create.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py
index f98f5257f4..3d5a373527 100644
--- a/scripts/lib/recipetool/create.py
+++ b/scripts/lib/recipetool/create.py
@@ -130,10 +130,17 @@ def create_recipe(args):
dirlist = os.listdir(srctree)
if 'git.indirectionsymlink' in dirlist:
dirlist.remove('git.indirectionsymlink')
- if len(dirlist) == 1 and os.path.isdir(os.path.join(srctree, dirlist[0])):
- # We unpacked a single directory, so we should use that
- srcsubdir = dirlist[0]
- srctree = os.path.join(srctree, srcsubdir)
+ if len(dirlist) == 1:
+ singleitem = os.path.join(srctree, dirlist[0])
+ if os.path.isdir(singleitem):
+ # We unpacked a single directory, so we should use that
+ srcsubdir = dirlist[0]
+ srctree = os.path.join(srctree, srcsubdir)
+ else:
+ with open(singleitem, 'r') as f:
+ if '<html' in f.read(100).lower():
+ logger.error('Fetching "%s" returned a single HTML page - check the URL is correct and functional' % fetchuri)
+ sys.exit(1)
else:
# Assume we're pointing to an existing source tree
if args.extract_to: