[bitbake-devel] [PATCH] fetch/wget: Start to clean up command construction

Kristof Robot krirobo at gmail.com
Thu Mar 6 20:41:35 UTC 2014


>Start to clean up wget fetcher command construction to allow clearer
>and more extensible code structure. Drops support for ${URI} and
>${FILE} directly in the commands.
>
>Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
>[...]
>         if not checkonly and 'downloadfilename' in ud.parm:
>             dldir = d.getVar("DL_DIR", True)
>             bb.utils.mkdirhier(os.path.dirname(dldir + os.sep + ud.localfile))
>-            basecmd += " -O " + dldir + os.sep + ud.localfile
>+            fetchcmd += " -O " + dldir + os.sep + ud.localfile
>
>+        uri = ud.url.split(";")[0]
>         if checkonly:
>-            fetchcmd = d.expand(basecmd + " --spider '${URI}'")
>+            fetchcmd = self.basecmd + " --spider '%s'" % uri
>         elif os.path.exists(ud.localpath):
>             # file exists, but we didnt complete it.. trying again..
>-            fetchcmd = d.expand(basecmd + " -c -P ${DL_DIR} '${URI}'")
>+            fetchcmd = self.basecmd + d.expand(" -c -P ${DL_DIR} '%s'" % uri)
>         else:
>-            fetchcmd = d.expand(basecmd + " -P ${DL_DIR} '${URI}'")
>-

This patch breaks the "downloadfilename" functionality, as the
fetchcmd append in the first if structure will be overwritten by the
fetchcmd assignments in the second if structure, effectively losing
the appended information.

As a quick fix, I replaced

 fetchcmd += " -O " + dldir + os.sep + ud.localfile

by

 self.basecmd += " -O " + dldir + os.sep + ud.localfile

but there might be a better way of resolving this?

Kristof



More information about the bitbake-devel mailing list