Skip to contentSkip to conversation

add downloadfilename parameter to bitbake wget fetcher

PATCH New [email protected] 1 participant 2 messages Jul 19, 2012

lore
Share & tools
lore
#0 lore raw

cover add downloadfilename parameter to bitbake wget fetcher

From: Nitin A Kamble <[email protected]>

The following changes since commit 5b014eae151a1584df4e3d3b96d18f9df3e55665:

fix my typos in patch headers (2012-07-16 21:45:01 -0700)

are available in the git repository at:
git://git.pokylinux.org/poky-contrib nitin/misc
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=nitin/misc

Nitin A Kamble (1):
bitbake wget fetcher: add parameter: downloadfilename

 bitbake/lib/bb/fetch2/__init__.py |    4 ++++
 bitbake/lib/bb/fetch2/wget.py     |    9 ++++++++-
 2 files changed, 12 insertions(+), 1 deletions(-)
Signature · 1 line
1.7.3.4
#1 lore raw

PATCH 1/1 bitbake wget fetcher: add parameter: downloadfilename

From: Nitin A Kamble <[email protected]>

this allows wget fetcher to store the downloaded file in a specified custom filename in ${DL_DIR}

Exmaple:
SRC_URI = "https://edc.intel.com/Download.aspx?id=6190;downloadfilename=LIN_IEMGD_1_14_GOLD_2443.tgz"

This fixes bug:
[YOCTO #2570]

---
 bitbake/lib/bb/fetch2/__init__.py |    4 ++++
 bitbake/lib/bb/fetch2/wget.py     |    9 ++++++++-
 2 files changed, 12 insertions(+), 1 deletions(-)
bitbake/lib/bb/fetch2/__init__.py +4 -0
index fa963be..4cb1546 100644
@@ -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"]
bitbake/lib/bb/fetch2/wget.py +8 -1
index b784afb..9affa0d 100644
@@ -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):
Signature · 1 line
1.7.3.4