summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2012-11-22 21:41:21 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-11-26 10:01:24 +0000
commit6a2ce81fc6dbf39ccb9ee973b7b61f9e10406918 (patch)
tree1a93a877a944c6f9b23127e9c3bb4d743ede1c23 /bitbake
parent7420cf5d67653e950e484c1dd3c9c3d2f2ff43af (diff)
downloadpoky-6a2ce81fc6dbf39ccb9ee973b7b61f9e10406918.tar.gz
bitbake: fetch2: Avoid using FILESDIR in unpack
Currently there is code which uses FILESDIR in unpack to ensure parent directories are created, leading to differing behaviour depending on which search path is used to locate the directory. This change standardises the code and takes the data from the fetcher in question meaning we can standardise the code and deprecate FILESDIR. (Bitbake rev: 1cccb3bd01ed82e4978acfef0fda1bd797eef72a) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
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):