File download support
Overview
BitBake provides support to download files this procedure
is called fetching and it handled by the fetch and fetch2
modules. At this point the original fetch code is considered to
be replaced by fetch2 and this manual only related to the
fetch2 codebase.
The SRC_URI is normally used to tell BitBake which files
to fetch. The next sections will describe the available
fetchers and their options. Each fetcher honors a set of
variables and per URI parameters separated by a
;
consisting of a key and a value. The semantics
of the variables and parameters are defined by the fetcher.
BitBake tries to have consistent semantics between the
different fetchers.
The overall fetch process is that first, fetches are
attempted from PREMIRRORS. If those don't work, the original
SRC_URI is attempted and if that fails, BitBake will fall back
to MIRRORS. Cross urls are supported, so its possible to mirror
a git repository on an http server as a tarball for example.
Some example commonly used mirror definitions are:
PREMIRRORS?= "\ bzr://.*/.*
http://somemirror.org/sources/ \n \ cvs://.*/.*
http://somemirror.org/sources/ \n \ git://.*/.*
http://somemirror.org/sources/ \n \ hg://.*/.*
http://somemirror.org/sources/ \n \ osc://.*/.*
http://somemirror.org/sources/ \n \ p4://.*/.*
http://somemirror.org/sources/ \n \ svk://.*/.*
http://somemirror.org/sources/ \n \ svn://.*/.*
http://somemirror.org/sources/ \n"
MIRRORS=+ "\ ftp://.*/.*
http://somemirror.org/sources/ \n \ http://.*/.*
http://somemirror.org/sources/ \n \ https://.*/.*
http://somemirror.org/sources/ \n"
Non-local downloaded output is placed into the directory
specified by the
DL_DIR. For non local archive downloads the
code can verify sha256 and md5 checksums for the download to
ensure the file has been downloaded correctly. These may be
specified either in the form
SRC_URI[md5sum]for the md5 checksum and
SRC_URI[sha256sum]for the sha256 checksum or
as parameters on the SRC_URI such as
SRC_URI="http://example.com/foobar.tar.bz2;md5sum=4a8e0f237e961fd7785d19d07fdb994d".
If
BB_STRICT_CHECKSUMis set, any download
without a checksum will trigger an error message. In cases
where multiple files are listed in SRC_URI, the name parameter
is used assign names to the urls and these are then specified
in the checksums in the form SRC_URI[name.sha256sum].
Local file fetcher
The URN for the local file fetcher is
file. The filename can be either absolute
or relative. If the filename is relative,
FILESPATHand failing that
FILESDIRwill be used to find the appropriate
relative file. The metadata usually extend these variables to
include variations of the values in
OVERRIDES. Single files and complete
directories can be specified.
SRC_URI= "file://relativefile.patch"
SRC_URI=
"file://relativefile.patch;this=ignored"
SRC_URI=
"file:///Users/ich/very_important_software"
CVS fetcher
The URN for the CVS fetcher is
cvs. This fetcher honors the variables
CVSDIR,
SRCDATE,
FETCHCOMMAND_cvs,
UPDATECOMMAND_cvs.
DL_DIRspecifies where a temporary checkout
is saved.
SRCDATEspecifies which date to use when
doing the fetching (the special value of "now" will cause the
checkout to be updated on every build).
FETCHCOMMANDand
UPDATECOMMANDspecify which executables to
use for the CVS checkout or update.
The supported parameters are
module,
tag,
date,
method,
localdir,
rshand
scmdata. The
modulespecifies which module to check out,
the
tagdescribes which CVS TAG should be used
for the checkout. By default the TAG is empty. A
datecan be specified to override the SRCDATE
of the configuration to checkout a specific date. The special
value of "now" will cause the checkout to be updated on every
build.
methodis by default
pserver. If
extis used the
rshparameter will be evaluated and
CVS_RSHwill be set. Finally,
localdiris used to checkout into a special
directory relative to
CVSDIR.
SRC_URI=
"cvs://CVSROOT;module=mymodule;tag=some-version;method=ext"
SRC_URI=
"cvs://CVSROOT;module=mymodule;date=20060126;localdir=usethat"
HTTP/FTP fetcher
The URNs for the HTTP/FTP fetcher are
http,
httpsand
ftp. This fetcher honors the variables
FETCHCOMMAND_wget.
FETCHCOMMANDcontains the command used for
fetching.
${URI}
and
${FILES}
will be replaced by the URI and basename
of the file to be fetched.
SRC_URI=
"http://oe.handhelds.org/not_there.aac"
SRC_URI=
"ftp://oe.handhelds.org/not_there_as_well.aac"
SRC_URI=
"ftp://you@oe.handheld.sorg/home/you/secret.plan"
SVN fetcher
The URN for the SVN fetcher is
svn.
This fetcher honors the variables
FETCHCOMMAND_svn,
SVNDIR,
SRCREV.
FETCHCOMMANDcontains the subversion command.
SRCREVspecifies which revision to use when
doing the fetching.
The supported parameters are
proto,
revand
scmdata.
protois the Subversion protocol,
revis the Subversion revision. If
scmdatais set to
keep
, the
.svn
directories will be available during
compile-time.
SRC_URI=
"svn://svn.oe.handhelds.org/svn;module=vip;proto=http;rev=667"
SRC_URI=
"svn://svn.oe.handhelds.org/svn/;module=opie;proto=svn+ssh;date=20060126"
GIT fetcher
The URN for the GIT Fetcher is
git.
The variable
GITDIRwill be used as the base directory
where the git tree is cloned to.
The parameters are
tag,
protocoland
scmdata.
tagis a Git tag, the default is
master
.
protocolis the Git protocol to use and
defaults to
git
if a hostname is set, otherwise its
file
. If
scmdatais set to
keep
, the
.git
directory will be available during
compile-time.
SRC_URI=
"git://git.oe.handhelds.org/git/vip.git;tag=version-1"
SRC_URI=
"git://git.oe.handhelds.org/git/vip.git;protocol=http"