@@ -1304,7 +1304,6 @@ class FetchData(object):
self.localpath = None
self.lockfile = None
self.mirrortarballs = []
- self.basename = None
(self.type, self.host, self.path, self.user, self.pswd, self.parm) = decodeurl(d.expand(url))
self.date = self.getSRCDate(d)
self.url = url
@@ -1360,10 +1359,17 @@ class FetchData(object):
self.ignore_checksums = False
+ if not self.localfile and self.needdonestamp:
+ if 'downloadfilename' in self.parm:
+ self.localfile = self.parm['downloadfilename']
+ else:
+ self.localfile = os.path.basename(self.path)
+ if not os.path.basename(self.localfile):
+ self.localfile = self.host + self.path.replace("/", ".")
+
if "localpath" in self.parm:
# if user sets localpath for file, use it instead.
self.localpath = self.parm["localpath"]
- self.basename = os.path.basename(self.localpath)
elif self.localfile:
self.localpath = self.method.localpath(self, d)
@@ -1377,8 +1383,8 @@ class FetchData(object):
basepath = self.localpath
elif self.localpath:
basepath = dldir + os.sep + os.path.basename(self.localpath)
- elif self.basename:
- basepath = dldir + os.sep + self.basename
+ elif self.localfile:
+ basepath = dldir + os.sep + self.localfile
else:
bb.fatal("Can't determine lock path for url %s" % url)
@@ -40,14 +40,6 @@ class GCP(FetchMethod):
def recommends_checksum(self, urldata):
return True
- def urldata_init(self, ud, d):
- if 'downloadfilename' in ud.parm:
- ud.basename = ud.parm['downloadfilename']
- else:
- ud.basename = os.path.basename(ud.path)
-
- ud.localfile = ud.basename
-
def get_gcp_client(self):
from google.cloud import storage
self.gcp_client = storage.Client(project=None)
@@ -29,7 +29,6 @@ class Local(FetchMethod):
def urldata_init(self, ud, d):
# We don't set localfile as for this fetcher the file is already local!
- ud.basename = os.path.basename(ud.path)
ud.basepath = ud.path
ud.needdonestamp = False
if "*" in ud.path:
@@ -72,13 +72,6 @@ class S3(FetchMethod):
return True
def urldata_init(self, ud, d):
- if 'downloadfilename' in ud.parm:
- ud.basename = ud.parm['downloadfilename']
- else:
- ud.basename = os.path.basename(ud.path)
-
- ud.localfile = ud.basename
-
ud.basecmd = d.getVar("FETCHCMD_s3") or "/usr/bin/env aws s3"
def download(self, ud, d):
@@ -72,13 +72,6 @@ class SFTP(FetchMethod):
"git repository using ssh, you need to use the " +
"git:// prefix with protocol=ssh", ud.url)
- if 'downloadfilename' in ud.parm:
- ud.basename = ud.parm['downloadfilename']
- else:
- ud.basename = os.path.basename(ud.path)
-
- ud.localfile = ud.basename
-
def download(self, ud, d):
"""Fetch urls"""
@@ -73,15 +73,6 @@ class Wget(FetchMethod):
if ud.parm['protocol'] == 'git':
raise bb.fetch2.ParameterError("Invalid protocol - if you wish to fetch from a git repository using http, you need to instead use the git:// prefix with protocol=http", ud.url)
- if 'downloadfilename' in ud.parm:
- ud.basename = ud.parm['downloadfilename']
- else:
- ud.basename = os.path.basename(ud.path)
-
- ud.localfile = ud.basename
- if not ud.localfile:
- ud.localfile = ud.host + ud.path.replace("/", ".")
-
self.basecmd = d.getVar("FETCHCMD_wget") or "/usr/bin/env wget -t 2 -T 100"
if ud.type == 'ftp' or ud.type == 'ftps':