summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/fetch2/__init__.py')
-rw-r--r--bitbake/lib/bb/fetch2/__init__.py17
1 files changed, 10 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: