summaryrefslogtreecommitdiffstats
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-28 09:25:13 +0000
commit38803e38d6d03b33817ef1d861e0b34b26c5a5f2 (patch)
tree8c86aa50f746d2d95a7bbda0058afaf2b819fe08
parente78a03980ae2799cb8eaf4ecaf96697cc5395104 (diff)
downloadpoky-38803e38d6d03b33817ef1d861e0b34b26c5a5f2.tar.gz
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. (From OE-Core rev: 83b1245b2638eb5d314fe663d33cd52a776a34a7) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-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):
130 dirlist = os.listdir(srctree) 130 dirlist = os.listdir(srctree)
131 if 'git.indirectionsymlink' in dirlist: 131 if 'git.indirectionsymlink' in dirlist:
132 dirlist.remove('git.indirectionsymlink') 132 dirlist.remove('git.indirectionsymlink')
133 if len(dirlist) == 1 and os.path.isdir(os.path.join(srctree, dirlist[0])): 133 if len(dirlist) == 1:
134 # We unpacked a single directory, so we should use that 134 singleitem = os.path.join(srctree, dirlist[0])
135 srcsubdir = dirlist[0] 135 if os.path.isdir(singleitem):
136 srctree = os.path.join(srctree, srcsubdir) 136 # We unpacked a single directory, so we should use that
137 srcsubdir = dirlist[0]
138 srctree = os.path.join(srctree, srcsubdir)
139 else:
140 with open(singleitem, 'r') as f:
141 if '<html' in f.read(100).lower():
142 logger.error('Fetching "%s" returned a single HTML page - check the URL is correct and functional' % fetchuri)
143 sys.exit(1)
137 else: 144 else:
138 # Assume we're pointing to an existing source tree 145 # Assume we're pointing to an existing source tree
139 if args.extract_to: 146 if args.extract_to: