bitbake-user-manual-fetching.rst 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652
  1. .. SPDX-License-Identifier: CC-BY-2.5
  2. =====================
  3. File Download Support
  4. =====================
  5. |
  6. BitBake's fetch module is a standalone piece of library code that deals
  7. with the intricacies of downloading source code and files from remote
  8. systems. Fetching source code is one of the cornerstones of building
  9. software. As such, this module forms an important part of BitBake.
  10. The current fetch module is called "fetch2" and refers to the fact that
  11. it is the second major version of the API. The original version is
  12. obsolete and has been removed from the codebase. Thus, in all cases,
  13. "fetch" refers to "fetch2" in this manual.
  14. The Download (Fetch)
  15. ====================
  16. BitBake takes several steps when fetching source code or files. The
  17. fetcher codebase deals with two distinct processes in order: obtaining
  18. the files from somewhere (cached or otherwise) and then unpacking those
  19. files into a specific location and perhaps in a specific way. Getting
  20. and unpacking the files is often optionally followed by patching.
  21. Patching, however, is not covered by this module.
  22. The code to execute the first part of this process, a fetch, looks
  23. something like the following: ::
  24. src_uri = (d.getVar('SRC_URI') or "").split()
  25. fetcher = bb.fetch2.Fetch(src_uri, d)
  26. fetcher.download()
  27. This code sets up an instance of the fetch class. The instance uses a
  28. space-separated list of URLs from the :term:`SRC_URI`
  29. variable and then calls the ``download`` method to download the files.
  30. The instantiation of the fetch class is usually followed by: ::
  31. rootdir = l.getVar('WORKDIR')
  32. fetcher.unpack(rootdir)
  33. This code unpacks the downloaded files to the specified by ``WORKDIR``.
  34. .. note::
  35. For convenience, the naming in these examples matches the variables
  36. used by OpenEmbedded. If you want to see the above code in action,
  37. examine the OpenEmbedded class file ``base.bbclass``
  38. .
  39. The ``SRC_URI`` and ``WORKDIR`` variables are not hardcoded into the
  40. fetcher, since those fetcher methods can be (and are) called with
  41. different variable names. In OpenEmbedded for example, the shared state
  42. (sstate) code uses the fetch module to fetch the sstate files.
  43. When the ``download()`` method is called, BitBake tries to resolve the
  44. URLs by looking for source files in a specific search order:
  45. - *Pre-mirror Sites:* BitBake first uses pre-mirrors to try and find
  46. source files. These locations are defined using the
  47. :term:`PREMIRRORS` variable.
  48. - *Source URI:* If pre-mirrors fail, BitBake uses the original URL (e.g
  49. from ``SRC_URI``).
  50. - *Mirror Sites:* If fetch failures occur, BitBake next uses mirror
  51. locations as defined by the :term:`MIRRORS` variable.
  52. For each URL passed to the fetcher, the fetcher calls the submodule that
  53. handles that particular URL type. This behavior can be the source of
  54. some confusion when you are providing URLs for the ``SRC_URI`` variable.
  55. Consider the following two URLs: ::
  56. http://git.yoctoproject.org/git/poky;protocol=git
  57. git://git.yoctoproject.org/git/poky;protocol=http
  58. In the former case, the URL is passed to the ``wget`` fetcher, which does not
  59. understand "git". Therefore, the latter case is the correct form since the Git
  60. fetcher does know how to use HTTP as a transport.
  61. Here are some examples that show commonly used mirror definitions: ::
  62. PREMIRRORS ?= "\
  63. bzr://.*/.\* http://somemirror.org/sources/ \\n \
  64. cvs://.*/.\* http://somemirror.org/sources/ \\n \
  65. git://.*/.\* http://somemirror.org/sources/ \\n \
  66. hg://.*/.\* http://somemirror.org/sources/ \\n \
  67. osc://.*/.\* http://somemirror.org/sources/ \\n \
  68. p4://.*/.\* http://somemirror.org/sources/ \\n \
  69. svn://.*/.\* http://somemirror.org/sources/ \\n"
  70. MIRRORS =+ "\
  71. ftp://.*/.\* http://somemirror.org/sources/ \\n \
  72. http://.*/.\* http://somemirror.org/sources/ \\n \
  73. https://.*/.\* http://somemirror.org/sources/ \\n"
  74. It is useful to note that BitBake
  75. supports cross-URLs. It is possible to mirror a Git repository on an
  76. HTTP server as a tarball. This is what the ``git://`` mapping in the
  77. previous example does.
  78. Since network accesses are slow, BitBake maintains a cache of files
  79. downloaded from the network. Any source files that are not local (i.e.
  80. downloaded from the Internet) are placed into the download directory,
  81. which is specified by the :term:`DL_DIR` variable.
  82. File integrity is of key importance for reproducing builds. For
  83. non-local archive downloads, the fetcher code can verify SHA-256 and MD5
  84. checksums to ensure the archives have been downloaded correctly. You can
  85. specify these checksums by using the ``SRC_URI`` variable with the
  86. appropriate varflags as follows: ::
  87. SRC_URI[md5sum] = "value"
  88. SRC_URI[sha256sum] = "value"
  89. You can also specify the checksums as
  90. parameters on the ``SRC_URI`` as shown below: ::
  91. SRC_URI = "http://example.com/foobar.tar.bz2;md5sum=4a8e0f237e961fd7785d19d07fdb994d"
  92. If multiple URIs exist, you can specify the checksums either directly as
  93. in the previous example, or you can name the URLs. The following syntax
  94. shows how you name the URIs: ::
  95. SRC_URI = "http://example.com/foobar.tar.bz2;name=foo"
  96. SRC_URI[foo.md5sum] = 4a8e0f237e961fd7785d19d07fdb994d
  97. After a file has been downloaded and
  98. has had its checksum checked, a ".done" stamp is placed in ``DL_DIR``.
  99. BitBake uses this stamp during subsequent builds to avoid downloading or
  100. comparing a checksum for the file again.
  101. .. note::
  102. It is assumed that local storage is safe from data corruption. If
  103. this were not the case, there would be bigger issues to worry about.
  104. If :term:`BB_STRICT_CHECKSUM` is set, any
  105. download without a checksum triggers an error message. The
  106. :term:`BB_NO_NETWORK` variable can be used to
  107. make any attempted network access a fatal error, which is useful for
  108. checking that mirrors are complete as well as other things.
  109. .. _bb-the-unpack:
  110. The Unpack
  111. ==========
  112. The unpack process usually immediately follows the download. For all
  113. URLs except Git URLs, BitBake uses the common ``unpack`` method.
  114. A number of parameters exist that you can specify within the URL to
  115. govern the behavior of the unpack stage:
  116. - *unpack:* Controls whether the URL components are unpacked. If set to
  117. "1", which is the default, the components are unpacked. If set to
  118. "0", the unpack stage leaves the file alone. This parameter is useful
  119. when you want an archive to be copied in and not be unpacked.
  120. - *dos:* Applies to ``.zip`` and ``.jar`` files and specifies whether
  121. to use DOS line ending conversion on text files.
  122. - *basepath:* Instructs the unpack stage to strip the specified
  123. directories from the source path when unpacking.
  124. - *subdir:* Unpacks the specific URL to the specified subdirectory
  125. within the root directory.
  126. The unpack call automatically decompresses and extracts files with ".Z",
  127. ".z", ".gz", ".xz", ".zip", ".jar", ".ipk", ".rpm". ".srpm", ".deb" and
  128. ".bz2" extensions as well as various combinations of tarball extensions.
  129. As mentioned, the Git fetcher has its own unpack method that is
  130. optimized to work with Git trees. Basically, this method works by
  131. cloning the tree into the final directory. The process is completed
  132. using references so that there is only one central copy of the Git
  133. metadata needed.
  134. .. _bb-fetchers:
  135. Fetchers
  136. ========
  137. As mentioned earlier, the URL prefix determines which fetcher submodule
  138. BitBake uses. Each submodule can support different URL parameters, which
  139. are described in the following sections.
  140. .. _local-file-fetcher:
  141. Local file fetcher (``file://``)
  142. --------------------------------
  143. This submodule handles URLs that begin with ``file://``. The filename
  144. you specify within the URL can be either an absolute or relative path to
  145. a file. If the filename is relative, the contents of the
  146. :term:`FILESPATH` variable is used in the same way
  147. ``PATH`` is used to find executables. If the file cannot be found, it is
  148. assumed that it is available in :term:`DL_DIR` by the
  149. time the ``download()`` method is called.
  150. If you specify a directory, the entire directory is unpacked.
  151. Here are a couple of example URLs, the first relative and the second
  152. absolute: ::
  153. SRC_URI = "file://relativefile.patch"
  154. SRC_URI = "file:///Users/ich/very_important_software"
  155. .. _http-ftp-fetcher:
  156. HTTP/FTP wget fetcher (``http://``, ``ftp://``, ``https://``)
  157. -------------------------------------------------------------
  158. This fetcher obtains files from web and FTP servers. Internally, the
  159. fetcher uses the wget utility.
  160. The executable and parameters used are specified by the
  161. ``FETCHCMD_wget`` variable, which defaults to sensible values. The
  162. fetcher supports a parameter "downloadfilename" that allows the name of
  163. the downloaded file to be specified. Specifying the name of the
  164. downloaded file is useful for avoiding collisions in
  165. :term:`DL_DIR` when dealing with multiple files that
  166. have the same name.
  167. Some example URLs are as follows: ::
  168. SRC_URI = "http://oe.handhelds.org/not_there.aac"
  169. SRC_URI = "ftp://oe.handhelds.org/not_there_as_well.aac"
  170. SRC_URI = "ftp://you@oe.handhelds.org/home/you/secret.plan"
  171. .. note::
  172. Because URL parameters are delimited by semi-colons, this can
  173. introduce ambiguity when parsing URLs that also contain semi-colons,
  174. for example:
  175. ::
  176. SRC_URI = "http://abc123.org/git/?p=gcc/gcc.git;a=snapshot;h=a5dd47"
  177. Such URLs should should be modified by replacing semi-colons with '&'
  178. characters:
  179. ::
  180. SRC_URI = "http://abc123.org/git/?p=gcc/gcc.git&a=snapshot&h=a5dd47"
  181. In most cases this should work. Treating semi-colons and '&' in
  182. queries identically is recommended by the World Wide Web Consortium
  183. (W3C). Note that due to the nature of the URL, you may have to
  184. specify the name of the downloaded file as well:
  185. ::
  186. SRC_URI = "http://abc123.org/git/?p=gcc/gcc.git&a=snapshot&h=a5dd47;downloadfilename=myfile.bz2"
  187. .. _cvs-fetcher:
  188. CVS fetcher (``(cvs://``)
  189. -------------------------
  190. This submodule handles checking out files from the CVS version control
  191. system. You can configure it using a number of different variables:
  192. - :term:`FETCHCMD_cvs <FETCHCMD>`: The name of the executable to use when running
  193. the ``cvs`` command. This name is usually "cvs".
  194. - :term:`SRCDATE`: The date to use when fetching the CVS source code. A
  195. special value of "now" causes the checkout to be updated on every
  196. build.
  197. - :term:`CVSDIR`: Specifies where a temporary
  198. checkout is saved. The location is often ``DL_DIR/cvs``.
  199. - CVS_PROXY_HOST: The name to use as a "proxy=" parameter to the
  200. ``cvs`` command.
  201. - CVS_PROXY_PORT: The port number to use as a "proxyport="
  202. parameter to the ``cvs`` command.
  203. As well as the standard username and password URL syntax, you can also
  204. configure the fetcher with various URL parameters:
  205. The supported parameters are as follows:
  206. - *"method":* The protocol over which to communicate with the CVS
  207. server. By default, this protocol is "pserver". If "method" is set to
  208. "ext", BitBake examines the "rsh" parameter and sets ``CVS_RSH``. You
  209. can use "dir" for local directories.
  210. - *"module":* Specifies the module to check out. You must supply this
  211. parameter.
  212. - *"tag":* Describes which CVS TAG should be used for the checkout. By
  213. default, the TAG is empty.
  214. - *"date":* Specifies a date. If no "date" is specified, the
  215. :term:`SRCDATE` of the configuration is used to
  216. checkout a specific date. The special value of "now" causes the
  217. checkout to be updated on every build.
  218. - *"localdir":* Used to rename the module. Effectively, you are
  219. renaming the output directory to which the module is unpacked. You
  220. are forcing the module into a special directory relative to
  221. :term:`CVSDIR`.
  222. - *"rsh":* Used in conjunction with the "method" parameter.
  223. - *"scmdata":* Causes the CVS metadata to be maintained in the tarball
  224. the fetcher creates when set to "keep". The tarball is expanded into
  225. the work directory. By default, the CVS metadata is removed.
  226. - *"fullpath":* Controls whether the resulting checkout is at the
  227. module level, which is the default, or is at deeper paths.
  228. - *"norecurse":* Causes the fetcher to only checkout the specified
  229. directory with no recurse into any subdirectories.
  230. - *"port":* The port to which the CVS server connects.
  231. Some example URLs are as follows: ::
  232. SRC_URI = "cvs://CVSROOT;module=mymodule;tag=some-version;method=ext"
  233. SRC_URI = "cvs://CVSROOT;module=mymodule;date=20060126;localdir=usethat"
  234. .. _svn-fetcher:
  235. Subversion (SVN) Fetcher (``svn://``)
  236. -------------------------------------
  237. This fetcher submodule fetches code from the Subversion source control
  238. system. The executable used is specified by ``FETCHCMD_svn``, which
  239. defaults to "svn". The fetcher's temporary working directory is set by
  240. :term:`SVNDIR`, which is usually ``DL_DIR/svn``.
  241. The supported parameters are as follows:
  242. - *"module":* The name of the svn module to checkout. You must provide
  243. this parameter. You can think of this parameter as the top-level
  244. directory of the repository data you want.
  245. - *"path_spec":* A specific directory in which to checkout the
  246. specified svn module.
  247. - *"protocol":* The protocol to use, which defaults to "svn". If
  248. "protocol" is set to "svn+ssh", the "ssh" parameter is also used.
  249. - *"rev":* The revision of the source code to checkout.
  250. - *"scmdata":* Causes the ".svn" directories to be available during
  251. compile-time when set to "keep". By default, these directories are
  252. removed.
  253. - *"ssh":* An optional parameter used when "protocol" is set to
  254. "svn+ssh". You can use this parameter to specify the ssh program used
  255. by svn.
  256. - *"transportuser":* When required, sets the username for the
  257. transport. By default, this parameter is empty. The transport
  258. username is different than the username used in the main URL, which
  259. is passed to the subversion command.
  260. Following are three examples using svn: ::
  261. SRC_URI = "svn://myrepos/proj1;module=vip;protocol=http;rev=667"
  262. SRC_URI = "svn://myrepos/proj1;module=opie;protocol=svn+ssh"
  263. SRC_URI = "svn://myrepos/proj1;module=trunk;protocol=http;path_spec=${MY_DIR}/proj1"
  264. .. _git-fetcher:
  265. Git Fetcher (``git://``)
  266. ------------------------
  267. This fetcher submodule fetches code from the Git source control system.
  268. The fetcher works by creating a bare clone of the remote into
  269. :term:`GITDIR`, which is usually ``DL_DIR/git2``. This
  270. bare clone is then cloned into the work directory during the unpack
  271. stage when a specific tree is checked out. This is done using alternates
  272. and by reference to minimize the amount of duplicate data on the disk
  273. and make the unpack process fast. The executable used can be set with
  274. ``FETCHCMD_git``.
  275. This fetcher supports the following parameters:
  276. - *"protocol":* The protocol used to fetch the files. The default is
  277. "git" when a hostname is set. If a hostname is not set, the Git
  278. protocol is "file". You can also use "http", "https", "ssh" and
  279. "rsync".
  280. - *"nocheckout":* Tells the fetcher to not checkout source code when
  281. unpacking when set to "1". Set this option for the URL where there is
  282. a custom routine to checkout code. The default is "0".
  283. - *"rebaseable":* Indicates that the upstream Git repository can be
  284. rebased. You should set this parameter to "1" if revisions can become
  285. detached from branches. In this case, the source mirror tarball is
  286. done per revision, which has a loss of efficiency. Rebasing the
  287. upstream Git repository could cause the current revision to disappear
  288. from the upstream repository. This option reminds the fetcher to
  289. preserve the local cache carefully for future use. The default value
  290. for this parameter is "0".
  291. - *"nobranch":* Tells the fetcher to not check the SHA validation for
  292. the branch when set to "1". The default is "0". Set this option for
  293. the recipe that refers to the commit that is valid for a tag instead
  294. of the branch.
  295. - *"bareclone":* Tells the fetcher to clone a bare clone into the
  296. destination directory without checking out a working tree. Only the
  297. raw Git metadata is provided. This parameter implies the "nocheckout"
  298. parameter as well.
  299. - *"branch":* The branch(es) of the Git tree to clone. If unset, this
  300. is assumed to be "master". The number of branch parameters much match
  301. the number of name parameters.
  302. - *"rev":* The revision to use for the checkout. The default is
  303. "master".
  304. - *"tag":* Specifies a tag to use for the checkout. To correctly
  305. resolve tags, BitBake must access the network. For that reason, tags
  306. are often not used. As far as Git is concerned, the "tag" parameter
  307. behaves effectively the same as the "rev" parameter.
  308. - *"subpath":* Limits the checkout to a specific subpath of the tree.
  309. By default, the whole tree is checked out.
  310. - *"destsuffix":* The name of the path in which to place the checkout.
  311. By default, the path is ``git/``.
  312. - *"usehead":* Enables local ``git://`` URLs to use the current branch
  313. HEAD as the revision for use with ``AUTOREV``. The "usehead"
  314. parameter implies no branch and only works when the transfer protocol
  315. is ``file://``.
  316. Here are some example URLs: ::
  317. SRC_URI = "git://git.oe.handhelds.org/git/vip.git;tag=version-1"
  318. SRC_URI = "git://git.oe.handhelds.org/git/vip.git;protocol=http"
  319. .. _gitsm-fetcher:
  320. Git Submodule Fetcher (``gitsm://``)
  321. ------------------------------------
  322. This fetcher submodule inherits from the :ref:`Git
  323. fetcher<bitbake-user-manual/bitbake-user-manual-fetching:git fetcher
  324. (\`\`git://\`\`)>` and extends that fetcher's behavior by fetching a
  325. repository's submodules. :term:`SRC_URI` is passed to the Git fetcher as
  326. described in the :ref:`bitbake-user-manual/bitbake-user-manual-fetching:git
  327. fetcher (\`\`git://\`\`)` section.
  328. .. note::
  329. You must clean a recipe when switching between '``git://``' and
  330. '``gitsm://``' URLs.
  331. The Git Submodules fetcher is not a complete fetcher implementation.
  332. The fetcher has known issues where it does not use the normal source
  333. mirroring infrastructure properly. Further, the submodule sources it
  334. fetches are not visible to the licensing and source archiving
  335. infrastructures.
  336. .. _clearcase-fetcher:
  337. ClearCase Fetcher (``ccrc://``)
  338. -------------------------------
  339. This fetcher submodule fetches code from a
  340. `ClearCase <http://en.wikipedia.org/wiki/Rational_ClearCase>`__
  341. repository.
  342. To use this fetcher, make sure your recipe has proper
  343. :term:`SRC_URI`, :term:`SRCREV`, and
  344. :term:`PV` settings. Here is an example: ::
  345. SRC_URI = "ccrc://cc.example.org/ccrc;vob=/example_vob;module=/example_module"
  346. SRCREV = "EXAMPLE_CLEARCASE_TAG"
  347. PV = "${@d.getVar("SRCREV", False).replace("/", "+")}"
  348. The fetcher uses the ``rcleartool`` or
  349. ``cleartool`` remote client, depending on which one is available.
  350. Following are options for the ``SRC_URI`` statement:
  351. - *vob*: The name, which must include the prepending "/" character,
  352. of the ClearCase VOB. This option is required.
  353. - *module*: The module, which must include the prepending "/"
  354. character, in the selected VOB.
  355. .. note::
  356. The module and vob options are combined to create the load rule in the
  357. view config spec. As an example, consider the vob and module values from
  358. the SRC_URI statement at the start of this section. Combining those values
  359. results in the following: ::
  360. load /example_vob/example_module
  361. - *proto*: The protocol, which can be either ``http`` or ``https``.
  362. By default, the fetcher creates a configuration specification. If you
  363. want this specification written to an area other than the default, use
  364. the ``CCASE_CUSTOM_CONFIG_SPEC`` variable in your recipe to define where
  365. the specification is written.
  366. .. note::
  367. the SRCREV loses its functionality if you specify this variable. However,
  368. SRCREV is still used to label the archive after a fetch even though it does
  369. not define what is fetched.
  370. Here are a couple of other behaviors worth mentioning:
  371. - When using ``cleartool``, the login of ``cleartool`` is handled by
  372. the system. The login require no special steps.
  373. - In order to use ``rcleartool`` with authenticated users, an
  374. "rcleartool login" is necessary before using the fetcher.
  375. .. _perforce-fetcher:
  376. Perforce Fetcher (``p4://``)
  377. ----------------------------
  378. This fetcher submodule fetches code from the
  379. `Perforce <https://www.perforce.com/>`__ source control system. The
  380. executable used is specified by ``FETCHCMD_p4``, which defaults to "p4".
  381. The fetcher's temporary working directory is set by
  382. :term:`P4DIR`, which defaults to "DL_DIR/p4".
  383. The fetcher does not make use of a perforce client, instead it
  384. relies on ``p4 files`` to retrieve a list of
  385. files and ``p4 print`` to transfer the content
  386. of those files locally.
  387. To use this fetcher, make sure your recipe has proper
  388. :term:`SRC_URI`, :term:`SRCREV`, and
  389. :term:`PV` values. The p4 executable is able to use the
  390. config file defined by your system's ``P4CONFIG`` environment variable
  391. in order to define the Perforce server URL and port, username, and
  392. password if you do not wish to keep those values in a recipe itself. If
  393. you choose not to use ``P4CONFIG``, or to explicitly set variables that
  394. ``P4CONFIG`` can contain, you can specify the ``P4PORT`` value, which is
  395. the server's URL and port number, and you can specify a username and
  396. password directly in your recipe within ``SRC_URI``.
  397. Here is an example that relies on ``P4CONFIG`` to specify the server URL
  398. and port, username, and password, and fetches the Head Revision: ::
  399. SRC_URI = "p4://example-depot/main/source/..."
  400. SRCREV = "${AUTOREV}"
  401. PV = "p4-${SRCPV}"
  402. S = "${WORKDIR}/p4"
  403. Here is an example that specifies the server URL and port, username, and
  404. password, and fetches a Revision based on a Label: ::
  405. P4PORT = "tcp:p4server.example.net:1666"
  406. SRC_URI = "p4://user:passwd@example-depot/main/source/..."
  407. SRCREV = "release-1.0"
  408. PV = "p4-${SRCPV}"
  409. S = "${WORKDIR}/p4"
  410. .. note::
  411. You should always set S to "${WORKDIR}/p4" in your recipe.
  412. By default, the fetcher strips the depot location from the local file paths. In
  413. the above example, the content of ``example-depot/main/source/`` will be placed
  414. in ``${WORKDIR}/p4``. For situations where preserving parts of the remote depot
  415. paths locally is desirable, the fetcher supports two parameters:
  416. - *"module":*
  417. The top-level depot location or directory to fetch. The value of this
  418. parameter can also point to a single file within the depot, in which case
  419. the local file path will include the module path.
  420. - *"remotepath":*
  421. When used with the value "``keep``", the fetcher will mirror the full depot
  422. paths locally for the specified location, even in combination with the
  423. ``module`` parameter.
  424. Here is an example use of the the ``module`` parameter: ::
  425. SRC_URI = "p4://user:passwd@example-depot/main;module=source/..."
  426. In this case, the content of the top-level directory ``source/`` will be fetched
  427. to ``${P4DIR}``, including the directory itself. The top-level directory will
  428. be accesible at ``${P4DIR}/source/``.
  429. Here is an example use of the the ``remotepath`` parameter: ::
  430. SRC_URI = "p4://user:passwd@example-depot/main;module=source/...;remotepath=keep"
  431. In this case, the content of the top-level directory ``source/`` will be fetched
  432. to ``${P4DIR}``, but the complete depot paths will be mirrored locally. The
  433. top-level directory will be accessible at
  434. ``${P4DIR}/example-depot/main/source/``.
  435. .. _repo-fetcher:
  436. Repo Fetcher (``repo://``)
  437. --------------------------
  438. This fetcher submodule fetches code from ``google-repo`` source control
  439. system. The fetcher works by initiating and syncing sources of the
  440. repository into :term:`REPODIR`, which is usually
  441. ``${DL_DIR}/repo``.
  442. This fetcher supports the following parameters:
  443. - *"protocol":* Protocol to fetch the repository manifest (default:
  444. git).
  445. - *"branch":* Branch or tag of repository to get (default: master).
  446. - *"manifest":* Name of the manifest file (default: ``default.xml``).
  447. Here are some example URLs: ::
  448. SRC_URI = "repo://REPOROOT;protocol=git;branch=some_branch;manifest=my_manifest.xml"
  449. SRC_URI = "repo://REPOROOT;protocol=file;branch=some_branch;manifest=my_manifest.xml"
  450. Other Fetchers
  451. --------------
  452. Fetch submodules also exist for the following:
  453. - Bazaar (``bzr://``)
  454. - Mercurial (``hg://``)
  455. - npm (``npm://``)
  456. - OSC (``osc://``)
  457. - Secure FTP (``sftp://``)
  458. - Secure Shell (``ssh://``)
  459. - Trees using Git Annex (``gitannex://``)
  460. No documentation currently exists for these lesser used fetcher
  461. submodules. However, you might find the code helpful and readable.
  462. Auto Revisions
  463. ==============
  464. We need to document ``AUTOREV`` and ``SRCREV_FORMAT`` here.