Comments
Patch
@@ -762,6 +762,10 @@ class FetchData(object):
if hasattr(self.method, "urldata_init"):
self.method.urldata_init(self, d)
+ if "downloadfilename" in self.parm:
+ # if user sets downloadfilename, use it instead.
+ self.basename = self.parm["downloadfilename"]
+
if "localpath" in self.parm:
# if user sets localpath for file, use it instead.
self.localpath = self.parm["localpath"]
@@ -50,7 +50,11 @@ class Wget(FetchMethod):
def urldata_init(self, ud, d):
- ud.basename = os.path.basename(ud.path)
+ if 'downloadfilename' in ud.parm:
+ ud.basename = ud.parm['downloadfilename']
+ else:
+ ud.basename = os.path.basename(ud.path)
+
ud.localfile = data.expand(urllib.unquote(ud.basename), d)
def download(self, uri, ud, d, checkonly = False):
@@ -58,6 +62,9 @@ class Wget(FetchMethod):
basecmd = d.getVar("FETCHCMD_wget", True) or "/usr/bin/env wget -t 2 -T 30 -nv --passive-ftp --no-check-certificate"
+ if 'downloadfilename' in ud.parm:
+ basecmd += " -O ${DL_DIR}/" + ud.localfile
+
if checkonly:
fetchcmd = d.getVar("CHECKCOMMAND_wget", True) or d.expand(basecmd + " -c -P ${DL_DIR} '${URI}'")
elif os.path.exists(ud.localpath):