summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/fetch2/__init__.py17
-rw-r--r--bitbake/lib/bb/fetch2/local.py1
2 files changed, 11 insertions, 7 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index ea5287406d..81964f112e 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -963,15 +963,18 @@ class FetchMethod(object):
963 dest = os.path.join(rootdir, os.path.basename(file)) 963 dest = os.path.join(rootdir, os.path.basename(file))
964 if (file != dest) and not (os.path.exists(dest) and os.path.samefile(file, dest)): 964 if (file != dest) and not (os.path.exists(dest) and os.path.samefile(file, dest)):
965 if os.path.isdir(file): 965 if os.path.isdir(file):
966 filesdir = os.path.realpath(data.getVar("FILESDIR", True)) 966 # If for example we're asked to copy file://foo/bar, we need to unpack the result into foo/bar
967 basepath = getattr(urldata, "basepath", None)
967 destdir = "." 968 destdir = "."
968 if file[0:len(filesdir)] == filesdir: 969 if basepath and basepath.endswith("/"):
969 destdir = file[len(filesdir):file.rfind('/')] 970 basepath = basepath.rstrip("/")
971 elif basepath:
972 basepath = os.path.dirname(basepath)
973 if basepath and basepath.find("/") != -1:
974 destdir = basepath[:basepath.rfind('/')]
970 destdir = destdir.strip('/') 975 destdir = destdir.strip('/')
971 if len(destdir) < 1: 976 if destdir != "." and not os.access("%s/%s" % (rootdir, destdir), os.F_OK):
972 destdir = "." 977 os.makedirs("%s/%s" % (rootdir, destdir))
973 elif not os.access("%s/%s" % (rootdir, destdir), os.F_OK):
974 os.makedirs("%s/%s" % (rootdir, destdir))
975 cmd = 'cp -pPR %s %s/%s/' % (file, rootdir, destdir) 978 cmd = 'cp -pPR %s %s/%s/' % (file, rootdir, destdir)
976 #cmd = 'tar -cf - -C "%d" -ps . | tar -xf - -C "%s/%s/"' % (file, rootdir, destdir) 979 #cmd = 'tar -cf - -C "%d" -ps . | tar -xf - -C "%s/%s/"' % (file, rootdir, destdir)
977 else: 980 else:
diff --git a/bitbake/lib/bb/fetch2/local.py b/bitbake/lib/bb/fetch2/local.py
index 7ea2f3b2e4..45de15f48a 100644
--- a/bitbake/lib/bb/fetch2/local.py
+++ b/bitbake/lib/bb/fetch2/local.py
@@ -44,6 +44,7 @@ class Local(FetchMethod):
44 # We don't set localfile as for this fetcher the file is already local! 44 # We don't set localfile as for this fetcher the file is already local!
45 ud.decodedurl = urllib.unquote(ud.url.split("://")[1].split(";")[0]) 45 ud.decodedurl = urllib.unquote(ud.url.split("://")[1].split(";")[0])
46 ud.basename = os.path.basename(ud.decodedurl) 46 ud.basename = os.path.basename(ud.decodedurl)
47 ud.basepath = ud.decodedurl
47 return 48 return
48 49
49 def localpath(self, url, urldata, d): 50 def localpath(self, url, urldata, d):