recipetool: create: fix handling of URIs containing #

The # character in a URI denotes a fragment; we don't care about this
since it is never supposed to be sent to the server, so remove it from
the URI before actually trying to fetch it or use it in SRC_URI within
the recipe.

(This has come up because download links on pypi.python.org seem to have
a fragment containing the md5sum of the download; without stripping this
off the fetcher will choke on it.)

(From OE-Core rev: 58dc726808817210764eab963a4d453dc4ff49aa)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Paul Eggleton
2015-09-22 17:21:29 +01:00
committed by Richard Purdie
parent a35ad723ce
commit 210d959023

View File

@@ -23,6 +23,7 @@ import fnmatch
import re
import logging
import scriptutils
import urlparse
logger = logging.getLogger('recipetool')
@@ -102,7 +103,8 @@ def create_recipe(args):
srcrev = '${AUTOREV}'
if '://' in args.source:
# Fetch a URL
srcuri = args.source
fetchuri = urlparse.urldefrag(args.source)[0]
srcuri = fetchuri
rev_re = re.compile(';rev=([^;]+)')
res = rev_re.search(srcuri)
if res:
@@ -111,7 +113,7 @@ def create_recipe(args):
tempsrc = tempfile.mkdtemp(prefix='recipetool-')
srctree = tempsrc
logger.info('Fetching %s...' % srcuri)
checksums = scriptutils.fetch_uri(tinfoil.config_data, args.source, srctree, srcrev)
checksums = scriptutils.fetch_uri(tinfoil.config_data, fetchuri, srctree, srcrev)
dirlist = os.listdir(srctree)
if 'git.indirectionsymlink' in dirlist:
dirlist.remove('git.indirectionsymlink')