bitbake-user-manual-fetching.xml 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821
  1. <!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
  2. "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
  3. <chapter>
  4. <title>File Download Support</title>
  5. <para>
  6. BitBake's fetch module is a standalone piece of library code
  7. that deals with the intricacies of downloading source code
  8. and files from remote systems.
  9. Fetching source code is one of the cornerstones of building software.
  10. As such, this module forms an important part of BitBake.
  11. </para>
  12. <para>
  13. The current fetch module is called "fetch2" and refers to the
  14. fact that it is the second major version of the API.
  15. The original version is obsolete and has been removed from the codebase.
  16. Thus, in all cases, "fetch" refers to "fetch2" in this
  17. manual.
  18. </para>
  19. <section id='the-download-fetch'>
  20. <title>The Download (Fetch)</title>
  21. <para>
  22. BitBake takes several steps when fetching source code or files.
  23. The fetcher codebase deals with two distinct processes in order:
  24. obtaining the files from somewhere (cached or otherwise)
  25. and then unpacking those files into a specific location and
  26. perhaps in a specific way.
  27. Getting and unpacking the files is often optionally followed
  28. by patching.
  29. Patching, however, is not covered by this module.
  30. </para>
  31. <para>
  32. The code to execute the first part of this process, a fetch,
  33. looks something like the following:
  34. <literallayout class='monospaced'>
  35. src_uri = (d.getVar('SRC_URI') or "").split()
  36. fetcher = bb.fetch2.Fetch(src_uri, d)
  37. fetcher.download()
  38. </literallayout>
  39. This code sets up an instance of the fetch class.
  40. The instance uses a space-separated list of URLs from the
  41. <link linkend='var-SRC_URI'><filename>SRC_URI</filename></link>
  42. variable and then calls the <filename>download</filename>
  43. method to download the files.
  44. </para>
  45. <para>
  46. The instantiation of the fetch class is usually followed by:
  47. <literallayout class='monospaced'>
  48. rootdir = l.getVar('WORKDIR')
  49. fetcher.unpack(rootdir)
  50. </literallayout>
  51. This code unpacks the downloaded files to the
  52. specified by <filename>WORKDIR</filename>.
  53. <note>
  54. For convenience, the naming in these examples matches
  55. the variables used by OpenEmbedded.
  56. If you want to see the above code in action, examine
  57. the OpenEmbedded class file <filename>base.bbclass</filename>.
  58. </note>
  59. The <filename>SRC_URI</filename> and <filename>WORKDIR</filename>
  60. variables are not hardcoded into the fetcher, since those fetcher
  61. methods can be (and are) called with different variable names.
  62. In OpenEmbedded for example, the shared state (sstate) code uses
  63. the fetch module to fetch the sstate files.
  64. </para>
  65. <para>
  66. When the <filename>download()</filename> method is called,
  67. BitBake tries to resolve the URLs by looking for source files
  68. in a specific search order:
  69. <itemizedlist>
  70. <listitem><para><emphasis>Pre-mirror Sites:</emphasis>
  71. BitBake first uses pre-mirrors to try and find source files.
  72. These locations are defined using the
  73. <link linkend='var-PREMIRRORS'><filename>PREMIRRORS</filename></link>
  74. variable.
  75. </para></listitem>
  76. <listitem><para><emphasis>Source URI:</emphasis>
  77. If pre-mirrors fail, BitBake uses the original URL (e.g from
  78. <filename>SRC_URI</filename>).
  79. </para></listitem>
  80. <listitem><para><emphasis>Mirror Sites:</emphasis>
  81. If fetch failures occur, BitBake next uses mirror locations as
  82. defined by the
  83. <link linkend='var-MIRRORS'><filename>MIRRORS</filename></link>
  84. variable.
  85. </para></listitem>
  86. </itemizedlist>
  87. </para>
  88. <para>
  89. For each URL passed to the fetcher, the fetcher
  90. calls the submodule that handles that particular URL type.
  91. This behavior can be the source of some confusion when you
  92. are providing URLs for the <filename>SRC_URI</filename>
  93. variable.
  94. Consider the following two URLs:
  95. <literallayout class='monospaced'>
  96. http://git.yoctoproject.org/git/poky;protocol=git
  97. git://git.yoctoproject.org/git/poky;protocol=http
  98. </literallayout>
  99. In the former case, the URL is passed to the
  100. <filename>wget</filename> fetcher, which does not
  101. understand "git".
  102. Therefore, the latter case is the correct form since the
  103. Git fetcher does know how to use HTTP as a transport.
  104. </para>
  105. <para>
  106. Here are some examples that show commonly used mirror
  107. definitions:
  108. <literallayout class='monospaced'>
  109. PREMIRRORS ?= "\
  110. bzr://.*/.* http://somemirror.org/sources/ \n \
  111. cvs://.*/.* http://somemirror.org/sources/ \n \
  112. git://.*/.* http://somemirror.org/sources/ \n \
  113. hg://.*/.* http://somemirror.org/sources/ \n \
  114. osc://.*/.* http://somemirror.org/sources/ \n \
  115. p4://.*/.* http://somemirror.org/sources/ \n \
  116. svn://.*/.* http://somemirror.org/sources/ \n"
  117. MIRRORS =+ "\
  118. ftp://.*/.* http://somemirror.org/sources/ \n \
  119. http://.*/.* http://somemirror.org/sources/ \n \
  120. https://.*/.* http://somemirror.org/sources/ \n"
  121. </literallayout>
  122. It is useful to note that BitBake supports
  123. cross-URLs.
  124. It is possible to mirror a Git repository on an HTTP
  125. server as a tarball.
  126. This is what the <filename>git://</filename> mapping in
  127. the previous example does.
  128. </para>
  129. <para>
  130. Since network accesses are slow, Bitbake maintains a
  131. cache of files downloaded from the network.
  132. Any source files that are not local (i.e.
  133. downloaded from the Internet) are placed into the download
  134. directory, which is specified by the
  135. <link linkend='var-DL_DIR'><filename>DL_DIR</filename></link>
  136. variable.
  137. </para>
  138. <para>
  139. File integrity is of key importance for reproducing builds.
  140. For non-local archive downloads, the fetcher code can verify
  141. SHA-256 and MD5 checksums to ensure the archives have been
  142. downloaded correctly.
  143. You can specify these checksums by using the
  144. <filename>SRC_URI</filename> variable with the appropriate
  145. varflags as follows:
  146. <literallayout class='monospaced'>
  147. SRC_URI[md5sum] = "<replaceable>value</replaceable>"
  148. SRC_URI[sha256sum] = "<replaceable>value</replaceable>"
  149. </literallayout>
  150. You can also specify the checksums as parameters on the
  151. <filename>SRC_URI</filename> as shown below:
  152. <literallayout class='monospaced'>
  153. SRC_URI = "http://example.com/foobar.tar.bz2;md5sum=4a8e0f237e961fd7785d19d07fdb994d"
  154. </literallayout>
  155. If multiple URIs exist, you can specify the checksums either
  156. directly as in the previous example, or you can name the URLs.
  157. The following syntax shows how you name the URIs:
  158. <literallayout class='monospaced'>
  159. SRC_URI = "http://example.com/foobar.tar.bz2;name=foo"
  160. SRC_URI[foo.md5sum] = 4a8e0f237e961fd7785d19d07fdb994d
  161. </literallayout>
  162. After a file has been downloaded and has had its checksum checked,
  163. a ".done" stamp is placed in <filename>DL_DIR</filename>.
  164. BitBake uses this stamp during subsequent builds to avoid
  165. downloading or comparing a checksum for the file again.
  166. <note>
  167. It is assumed that local storage is safe from data corruption.
  168. If this were not the case, there would be bigger issues to worry about.
  169. </note>
  170. </para>
  171. <para>
  172. If
  173. <link linkend='var-BB_STRICT_CHECKSUM'><filename>BB_STRICT_CHECKSUM</filename></link>
  174. is set, any download without a checksum triggers an
  175. error message.
  176. The
  177. <link linkend='var-BB_NO_NETWORK'><filename>BB_NO_NETWORK</filename></link>
  178. variable can be used to make any attempted network access a fatal
  179. error, which is useful for checking that mirrors are complete
  180. as well as other things.
  181. </para>
  182. </section>
  183. <section id='bb-the-unpack'>
  184. <title>The Unpack</title>
  185. <para>
  186. The unpack process usually immediately follows the download.
  187. For all URLs except Git URLs, BitBake uses the common
  188. <filename>unpack</filename> method.
  189. </para>
  190. <para>
  191. A number of parameters exist that you can specify within the
  192. URL to govern the behavior of the unpack stage:
  193. <itemizedlist>
  194. <listitem><para><emphasis>unpack:</emphasis>
  195. Controls whether the URL components are unpacked.
  196. If set to "1", which is the default, the components
  197. are unpacked.
  198. If set to "0", the unpack stage leaves the file alone.
  199. This parameter is useful when you want an archive to be
  200. copied in and not be unpacked.
  201. </para></listitem>
  202. <listitem><para><emphasis>dos:</emphasis>
  203. Applies to <filename>.zip</filename> and
  204. <filename>.jar</filename> files and specifies whether to
  205. use DOS line ending conversion on text files.
  206. </para></listitem>
  207. <listitem><para><emphasis>basepath:</emphasis>
  208. Instructs the unpack stage to strip the specified
  209. directories from the source path when unpacking.
  210. </para></listitem>
  211. <listitem><para><emphasis>subdir:</emphasis>
  212. Unpacks the specific URL to the specified subdirectory
  213. within the root directory.
  214. </para></listitem>
  215. </itemizedlist>
  216. The unpack call automatically decompresses and extracts files
  217. with ".Z", ".z", ".gz", ".xz", ".zip", ".jar", ".ipk", ".rpm".
  218. ".srpm", ".deb" and ".bz2" extensions as well as various combinations
  219. of tarball extensions.
  220. </para>
  221. <para>
  222. As mentioned, the Git fetcher has its own unpack method that
  223. is optimized to work with Git trees.
  224. Basically, this method works by cloning the tree into the final
  225. directory.
  226. The process is completed using references so that there is
  227. only one central copy of the Git metadata needed.
  228. </para>
  229. </section>
  230. <section id='bb-fetchers'>
  231. <title>Fetchers</title>
  232. <para>
  233. As mentioned earlier, the URL prefix determines which
  234. fetcher submodule BitBake uses.
  235. Each submodule can support different URL parameters,
  236. which are described in the following sections.
  237. </para>
  238. <section id='local-file-fetcher'>
  239. <title>Local file fetcher (<filename>file://</filename>)</title>
  240. <para>
  241. This submodule handles URLs that begin with
  242. <filename>file://</filename>.
  243. The filename you specify within the URL can be
  244. either an absolute or relative path to a file.
  245. If the filename is relative, the contents of the
  246. <link linkend='var-FILESPATH'><filename>FILESPATH</filename></link>
  247. variable is used in the same way
  248. <filename>PATH</filename> is used to find executables.
  249. If the file cannot be found, it is assumed that it is available in
  250. <link linkend='var-DL_DIR'><filename>DL_DIR</filename></link>
  251. by the time the <filename>download()</filename> method is called.
  252. </para>
  253. <para>
  254. If you specify a directory, the entire directory is
  255. unpacked.
  256. </para>
  257. <para>
  258. Here are a couple of example URLs, the first relative and
  259. the second absolute:
  260. <literallayout class='monospaced'>
  261. SRC_URI = "file://relativefile.patch"
  262. SRC_URI = "file:///Users/ich/very_important_software"
  263. </literallayout>
  264. </para>
  265. </section>
  266. <section id='http-ftp-fetcher'>
  267. <title>HTTP/FTP wget fetcher (<filename>http://</filename>, <filename>ftp://</filename>, <filename>https://</filename>)</title>
  268. <para>
  269. This fetcher obtains files from web and FTP servers.
  270. Internally, the fetcher uses the wget utility.
  271. </para>
  272. <para>
  273. The executable and parameters used are specified by the
  274. <filename>FETCHCMD_wget</filename> variable, which defaults
  275. to sensible values.
  276. The fetcher supports a parameter "downloadfilename" that
  277. allows the name of the downloaded file to be specified.
  278. Specifying the name of the downloaded file is useful
  279. for avoiding collisions in
  280. <link linkend='var-DL_DIR'><filename>DL_DIR</filename></link>
  281. when dealing with multiple files that have the same name.
  282. </para>
  283. <para>
  284. Some example URLs are as follows:
  285. <literallayout class='monospaced'>
  286. SRC_URI = "http://oe.handhelds.org/not_there.aac"
  287. SRC_URI = "ftp://oe.handhelds.org/not_there_as_well.aac"
  288. SRC_URI = "ftp://you@oe.handhelds.org/home/you/secret.plan"
  289. </literallayout>
  290. </para>
  291. <note>
  292. Because URL parameters are delimited by semi-colons, this can
  293. introduce ambiguity when parsing URLs that also contain semi-colons,
  294. for example:
  295. <literallayout class='monospaced'>
  296. SRC_URI = "http://abc123.org/git/?p=gcc/gcc.git;a=snapshot;h=a5dd47"
  297. </literallayout>
  298. Such URLs should should be modified by replacing semi-colons with '&amp;' characters:
  299. <literallayout class='monospaced'>
  300. SRC_URI = "http://abc123.org/git/?p=gcc/gcc.git&amp;a=snapshot&amp;h=a5dd47"
  301. </literallayout>
  302. In most cases this should work. Treating semi-colons and '&amp;' in queries
  303. identically is recommended by the World Wide Web Consortium (W3C).
  304. Note that due to the nature of the URL, you may have to specify the name
  305. of the downloaded file as well:
  306. <literallayout class='monospaced'>
  307. SRC_URI = "http://abc123.org/git/?p=gcc/gcc.git&amp;a=snapshot&amp;h=a5dd47;downloadfilename=myfile.bz2"
  308. </literallayout>
  309. </note>
  310. </section>
  311. <section id='cvs-fetcher'>
  312. <title>CVS fetcher (<filename>(cvs://</filename>)</title>
  313. <para>
  314. This submodule handles checking out files from the
  315. CVS version control system.
  316. You can configure it using a number of different variables:
  317. <itemizedlist>
  318. <listitem><para><emphasis><filename>FETCHCMD_cvs</filename>:</emphasis>
  319. The name of the executable to use when running
  320. the <filename>cvs</filename> command.
  321. This name is usually "cvs".
  322. </para></listitem>
  323. <listitem><para><emphasis><filename>SRCDATE</filename>:</emphasis>
  324. The date to use when fetching the CVS source code.
  325. A special value of "now" causes the checkout to
  326. be updated on every build.
  327. </para></listitem>
  328. <listitem><para><emphasis><link linkend='var-CVSDIR'><filename>CVSDIR</filename></link>:</emphasis>
  329. Specifies where a temporary checkout is saved.
  330. The location is often <filename>DL_DIR/cvs</filename>.
  331. </para></listitem>
  332. <listitem><para><emphasis><filename>CVS_PROXY_HOST</filename>:</emphasis>
  333. The name to use as a "proxy=" parameter to the
  334. <filename>cvs</filename> command.
  335. </para></listitem>
  336. <listitem><para><emphasis><filename>CVS_PROXY_PORT</filename>:</emphasis>
  337. The port number to use as a "proxyport=" parameter to
  338. the <filename>cvs</filename> command.
  339. </para></listitem>
  340. </itemizedlist>
  341. As well as the standard username and password URL syntax,
  342. you can also configure the fetcher with various URL parameters:
  343. </para>
  344. <para>
  345. The supported parameters are as follows:
  346. <itemizedlist>
  347. <listitem><para><emphasis>"method":</emphasis>
  348. The protocol over which to communicate with the CVS
  349. server.
  350. By default, this protocol is "pserver".
  351. If "method" is set to "ext", BitBake examines the
  352. "rsh" parameter and sets <filename>CVS_RSH</filename>.
  353. You can use "dir" for local directories.
  354. </para></listitem>
  355. <listitem><para><emphasis>"module":</emphasis>
  356. Specifies the module to check out.
  357. You must supply this parameter.
  358. </para></listitem>
  359. <listitem><para><emphasis>"tag":</emphasis>
  360. Describes which CVS TAG should be used for
  361. the checkout.
  362. By default, the TAG is empty.
  363. </para></listitem>
  364. <listitem><para><emphasis>"date":</emphasis>
  365. Specifies a date.
  366. If no "date" is specified, the
  367. <link linkend='var-SRCDATE'><filename>SRCDATE</filename></link>
  368. of the configuration is used to checkout a specific date.
  369. The special value of "now" causes the checkout to be
  370. updated on every build.
  371. </para></listitem>
  372. <listitem><para><emphasis>"localdir":</emphasis>
  373. Used to rename the module.
  374. Effectively, you are renaming the output directory
  375. to which the module is unpacked.
  376. You are forcing the module into a special
  377. directory relative to
  378. <link linkend='var-CVSDIR'><filename>CVSDIR</filename></link>.
  379. </para></listitem>
  380. <listitem><para><emphasis>"rsh"</emphasis>
  381. Used in conjunction with the "method" parameter.
  382. </para></listitem>
  383. <listitem><para><emphasis>"scmdata":</emphasis>
  384. Causes the CVS metadata to be maintained in the tarball
  385. the fetcher creates when set to "keep".
  386. The tarball is expanded into the work directory.
  387. By default, the CVS metadata is removed.
  388. </para></listitem>
  389. <listitem><para><emphasis>"fullpath":</emphasis>
  390. Controls whether the resulting checkout is at the
  391. module level, which is the default, or is at deeper
  392. paths.
  393. </para></listitem>
  394. <listitem><para><emphasis>"norecurse":</emphasis>
  395. Causes the fetcher to only checkout the specified
  396. directory with no recurse into any subdirectories.
  397. </para></listitem>
  398. <listitem><para><emphasis>"port":</emphasis>
  399. The port to which the CVS server connects.
  400. </para></listitem>
  401. </itemizedlist>
  402. Some example URLs are as follows:
  403. <literallayout class='monospaced'>
  404. SRC_URI = "cvs://CVSROOT;module=mymodule;tag=some-version;method=ext"
  405. SRC_URI = "cvs://CVSROOT;module=mymodule;date=20060126;localdir=usethat"
  406. </literallayout>
  407. </para>
  408. </section>
  409. <section id='svn-fetcher'>
  410. <title>Subversion (SVN) Fetcher (<filename>svn://</filename>)</title>
  411. <para>
  412. This fetcher submodule fetches code from the
  413. Subversion source control system.
  414. The executable used is specified by
  415. <filename>FETCHCMD_svn</filename>, which defaults
  416. to "svn".
  417. The fetcher's temporary working directory is set by
  418. <link linkend='var-SVNDIR'><filename>SVNDIR</filename></link>,
  419. which is usually <filename>DL_DIR/svn</filename>.
  420. </para>
  421. <para>
  422. The supported parameters are as follows:
  423. <itemizedlist>
  424. <listitem><para><emphasis>"module":</emphasis>
  425. The name of the svn module to checkout.
  426. You must provide this parameter.
  427. You can think of this parameter as the top-level
  428. directory of the repository data you want.
  429. </para></listitem>
  430. <listitem><para><emphasis>"path_spec":</emphasis>
  431. A specific directory in which to checkout the
  432. specified svn module.
  433. </para></listitem>
  434. <listitem><para><emphasis>"protocol":</emphasis>
  435. The protocol to use, which defaults to "svn".
  436. If "protocol" is set to "svn+ssh", the "ssh"
  437. parameter is also used.
  438. </para></listitem>
  439. <listitem><para><emphasis>"rev":</emphasis>
  440. The revision of the source code to checkout.
  441. </para></listitem>
  442. <listitem><para><emphasis>"scmdata":</emphasis>
  443. Causes the “.svn” directories to be available during
  444. compile-time when set to "keep".
  445. By default, these directories are removed.
  446. </para></listitem>
  447. <listitem><para><emphasis>"ssh":</emphasis>
  448. An optional parameter used when "protocol" is set
  449. to "svn+ssh".
  450. You can use this parameter to specify the ssh
  451. program used by svn.
  452. </para></listitem>
  453. <listitem><para><emphasis>"transportuser":</emphasis>
  454. When required, sets the username for the transport.
  455. By default, this parameter is empty.
  456. The transport username is different than the username
  457. used in the main URL, which is passed to the subversion
  458. command.
  459. </para></listitem>
  460. </itemizedlist>
  461. Following are three examples using svn:
  462. <literallayout class='monospaced'>
  463. SRC_URI = "svn://myrepos/proj1;module=vip;protocol=http;rev=667"
  464. SRC_URI = "svn://myrepos/proj1;module=opie;protocol=svn+ssh"
  465. SRC_URI = "svn://myrepos/proj1;module=trunk;protocol=http;path_spec=${MY_DIR}/proj1"
  466. </literallayout>
  467. </para>
  468. </section>
  469. <section id='git-fetcher'>
  470. <title>Git Fetcher (<filename>git://</filename>)</title>
  471. <para>
  472. This fetcher submodule fetches code from the Git
  473. source control system.
  474. The fetcher works by creating a bare clone of the
  475. remote into
  476. <link linkend='var-GITDIR'><filename>GITDIR</filename></link>,
  477. which is usually <filename>DL_DIR/git2</filename>.
  478. This bare clone is then cloned into the work directory during the
  479. unpack stage when a specific tree is checked out.
  480. This is done using alternates and by reference to
  481. minimize the amount of duplicate data on the disk and
  482. make the unpack process fast.
  483. The executable used can be set with
  484. <filename>FETCHCMD_git</filename>.
  485. </para>
  486. <para>
  487. This fetcher supports the following parameters:
  488. <itemizedlist>
  489. <listitem><para><emphasis>"protocol":</emphasis>
  490. The protocol used to fetch the files.
  491. The default is "git" when a hostname is set.
  492. If a hostname is not set, the Git protocol is "file".
  493. You can also use "http", "https", "ssh" and "rsync".
  494. </para></listitem>
  495. <listitem><para><emphasis>"nocheckout":</emphasis>
  496. Tells the fetcher to not checkout source code when
  497. unpacking when set to "1".
  498. Set this option for the URL where there is a custom
  499. routine to checkout code.
  500. The default is "0".
  501. </para></listitem>
  502. <listitem><para><emphasis>"rebaseable":</emphasis>
  503. Indicates that the upstream Git repository can be rebased.
  504. You should set this parameter to "1" if
  505. revisions can become detached from branches.
  506. In this case, the source mirror tarball is done per
  507. revision, which has a loss of efficiency.
  508. Rebasing the upstream Git repository could cause the
  509. current revision to disappear from the upstream repository.
  510. This option reminds the fetcher to preserve the local cache
  511. carefully for future use.
  512. The default value for this parameter is "0".
  513. </para></listitem>
  514. <listitem><para><emphasis>"nobranch":</emphasis>
  515. Tells the fetcher to not check the SHA validation
  516. for the branch when set to "1".
  517. The default is "0".
  518. Set this option for the recipe that refers to
  519. the commit that is valid for a tag instead of
  520. the branch.
  521. </para></listitem>
  522. <listitem><para><emphasis>"bareclone":</emphasis>
  523. Tells the fetcher to clone a bare clone into the
  524. destination directory without checking out a working tree.
  525. Only the raw Git metadata is provided.
  526. This parameter implies the "nocheckout" parameter as well.
  527. </para></listitem>
  528. <listitem><para><emphasis>"branch":</emphasis>
  529. The branch(es) of the Git tree to clone.
  530. If unset, this is assumed to be "master".
  531. The number of branch parameters much match the number of
  532. name parameters.
  533. </para></listitem>
  534. <listitem><para><emphasis>"rev":</emphasis>
  535. The revision to use for the checkout.
  536. The default is "master".
  537. </para></listitem>
  538. <listitem><para><emphasis>"tag":</emphasis>
  539. Specifies a tag to use for the checkout.
  540. To correctly resolve tags, BitBake must access the
  541. network.
  542. For that reason, tags are often not used.
  543. As far as Git is concerned, the "tag" parameter behaves
  544. effectively the same as the "rev" parameter.
  545. </para></listitem>
  546. <listitem><para><emphasis>"subpath":</emphasis>
  547. Limits the checkout to a specific subpath of the tree.
  548. By default, the whole tree is checked out.
  549. </para></listitem>
  550. <listitem><para><emphasis>"destsuffix":</emphasis>
  551. The name of the path in which to place the checkout.
  552. By default, the path is <filename>git/</filename>.
  553. </para></listitem>
  554. </itemizedlist>
  555. Here are some example URLs:
  556. <literallayout class='monospaced'>
  557. SRC_URI = "git://git.oe.handhelds.org/git/vip.git;tag=version-1"
  558. SRC_URI = "git://git.oe.handhelds.org/git/vip.git;protocol=http"
  559. </literallayout>
  560. </para>
  561. </section>
  562. <section id='gitsm-fetcher'>
  563. <title>Git Submodule Fetcher (<filename>gitsm://</filename>)</title>
  564. <para>
  565. This fetcher submodule inherits from the
  566. <link linkend='git-fetcher'>Git fetcher</link> and extends
  567. that fetcher's behavior by fetching a repository's submodules.
  568. <link linkend='var-SRC_URI'><filename>SRC_URI</filename></link>
  569. is passed to the Git fetcher as described in the
  570. "<link linkend='git-fetcher'>Git Fetcher (<filename>git://</filename>)</link>"
  571. section.
  572. <note>
  573. <title>Notes and Warnings</title>
  574. <para>
  575. You must clean a recipe when switching between
  576. '<filename>git://</filename>' and
  577. '<filename>gitsm://</filename>' URLs.
  578. </para>
  579. <para>
  580. The Git Submodules fetcher is not a complete fetcher
  581. implementation.
  582. The fetcher has known issues where it does not use the
  583. normal source mirroring infrastructure properly.
  584. </para>
  585. </note>
  586. </para>
  587. </section>
  588. <section id='clearcase-fetcher'>
  589. <title>ClearCase Fetcher (<filename>ccrc://</filename>)</title>
  590. <para>
  591. This fetcher submodule fetches code from a
  592. <ulink url='http://en.wikipedia.org/wiki/Rational_ClearCase'>ClearCase</ulink>
  593. repository.
  594. </para>
  595. <para>
  596. To use this fetcher, make sure your recipe has proper
  597. <link linkend='var-SRC_URI'><filename>SRC_URI</filename></link>,
  598. <link linkend='var-SRCREV'><filename>SRCREV</filename></link>, and
  599. <link linkend='var-PV'><filename>PV</filename></link> settings.
  600. Here is an example:
  601. <literallayout class='monospaced'>
  602. SRC_URI = "ccrc://cc.example.org/ccrc;vob=/example_vob;module=/example_module"
  603. SRCREV = "EXAMPLE_CLEARCASE_TAG"
  604. PV = "${@d.getVar("SRCREV", False).replace("/", "+")}"
  605. </literallayout>
  606. The fetcher uses the <filename>rcleartool</filename> or
  607. <filename>cleartool</filename> remote client, depending on
  608. which one is available.
  609. </para>
  610. <para>
  611. Following are options for the <filename>SRC_URI</filename>
  612. statement:
  613. <itemizedlist>
  614. <listitem><para><emphasis><filename>vob</filename></emphasis>:
  615. The name, which must include the
  616. prepending "/" character, of the ClearCase VOB.
  617. This option is required.
  618. </para></listitem>
  619. <listitem><para><emphasis><filename>module</filename></emphasis>:
  620. The module, which must include the
  621. prepending "/" character, in the selected VOB.
  622. <note>
  623. The <filename>module</filename> and <filename>vob</filename>
  624. options are combined to create the <filename>load</filename> rule in
  625. the view config spec.
  626. As an example, consider the <filename>vob</filename> and
  627. <filename>module</filename> values from the
  628. <filename>SRC_URI</filename> statement at the start of this section.
  629. Combining those values results in the following:
  630. <literallayout class='monospaced'>
  631. load /example_vob/example_module
  632. </literallayout>
  633. </note>
  634. </para></listitem>
  635. <listitem><para><emphasis><filename>proto</filename></emphasis>:
  636. The protocol, which can be either <filename>http</filename> or
  637. <filename>https</filename>.
  638. </para></listitem>
  639. </itemizedlist>
  640. </para>
  641. <para>
  642. By default, the fetcher creates a configuration specification.
  643. If you want this specification written to an area other than the default,
  644. use the <filename>CCASE_CUSTOM_CONFIG_SPEC</filename> variable
  645. in your recipe to define where the specification is written.
  646. <note>
  647. the <filename>SRCREV</filename> loses its functionality if you
  648. specify this variable.
  649. However, <filename>SRCREV</filename> is still used to label the
  650. archive after a fetch even though it does not define what is
  651. fetched.
  652. </note>
  653. </para>
  654. <para>
  655. Here are a couple of other behaviors worth mentioning:
  656. <itemizedlist>
  657. <listitem><para>
  658. When using <filename>cleartool</filename>, the login of
  659. <filename>cleartool</filename> is handled by the system.
  660. The login require no special steps.
  661. </para></listitem>
  662. <listitem><para>
  663. In order to use <filename>rcleartool</filename> with authenticated
  664. users, an "rcleartool login" is necessary before using the fetcher.
  665. </para></listitem>
  666. </itemizedlist>
  667. </para>
  668. </section>
  669. <section id='perforce-fetcher'>
  670. <title>Perforce Fetcher (<filename>p4://</filename>)</title>
  671. <para>
  672. This fetcher submodule fetches code from the
  673. <ulink url='https://www.perforce.com/'>Perforce</ulink>
  674. source control system.
  675. The executable used is specified by
  676. <filename>FETCHCMD_p4</filename>, which defaults
  677. to "p4".
  678. The fetcher's temporary working directory is set by
  679. <link linkend='var-P4DIR'><filename>P4DIR</filename></link>,
  680. which defaults to "DL_DIR/p4".
  681. </para>
  682. <para>
  683. To use this fetcher, make sure your recipe has proper
  684. <link linkend='var-SRC_URI'><filename>SRC_URI</filename></link>,
  685. <link linkend='var-SRCREV'><filename>SRCREV</filename></link>, and
  686. <link linkend='var-PV'><filename>PV</filename></link> values.
  687. The p4 executable is able to use the config file defined by your
  688. system's <filename>P4CONFIG</filename> environment variable in
  689. order to define the Perforce server URL and port, username, and
  690. password if you do not wish to keep those values in a recipe
  691. itself.
  692. If you choose not to use <filename>P4CONFIG</filename>,
  693. or to explicitly set variables that <filename>P4CONFIG</filename>
  694. can contain, you can specify the <filename>P4PORT</filename> value,
  695. which is the server's URL and port number, and you can
  696. specify a username and password directly in your recipe within
  697. <filename>SRC_URI</filename>.
  698. </para>
  699. <para>
  700. Here is an example that relies on <filename>P4CONFIG</filename>
  701. to specify the server URL and port, username, and password, and
  702. fetches the Head Revision:
  703. <literallayout class='monospaced'>
  704. SRC_URI = "p4://example-depot/main/source/..."
  705. SRCREV = "${AUTOREV}"
  706. PV = "p4-${SRCPV}"
  707. S = "${WORKDIR}/p4"
  708. </literallayout>
  709. </para>
  710. <para>
  711. Here is an example that specifies the server URL and port,
  712. username, and password, and fetches a Revision based on a Label:
  713. <literallayout class='monospaced'>
  714. P4PORT = "tcp:p4server.example.net:1666"
  715. SRC_URI = "p4://user:passwd@example-depot/main/source/..."
  716. SRCREV = "release-1.0"
  717. PV = "p4-${SRCPV}"
  718. S = "${WORKDIR}/p4"
  719. </literallayout>
  720. <note>
  721. You should always set <filename>S</filename>
  722. to <filename>"${WORKDIR}/p4"</filename> in your recipe.
  723. </note>
  724. </para>
  725. </section>
  726. <section id='other-fetchers'>
  727. <title>Other Fetchers</title>
  728. <para>
  729. Fetch submodules also exist for the following:
  730. <itemizedlist>
  731. <listitem><para>
  732. Bazaar (<filename>bzr://</filename>)
  733. </para></listitem>
  734. <listitem><para>
  735. Trees using Git Annex (<filename>gitannex://</filename>)
  736. </para></listitem>
  737. <listitem><para>
  738. Secure FTP (<filename>sftp://</filename>)
  739. </para></listitem>
  740. <listitem><para>
  741. Secure Shell (<filename>ssh://</filename>)
  742. </para></listitem>
  743. <listitem><para>
  744. Repo (<filename>repo://</filename>)
  745. </para></listitem>
  746. <listitem><para>
  747. OSC (<filename>osc://</filename>)
  748. </para></listitem>
  749. <listitem><para>
  750. Mercurial (<filename>hg://</filename>)
  751. </para></listitem>
  752. </itemizedlist>
  753. No documentation currently exists for these lesser used
  754. fetcher submodules.
  755. However, you might find the code helpful and readable.
  756. </para>
  757. </section>
  758. </section>
  759. <section id='auto-revisions'>
  760. <title>Auto Revisions</title>
  761. <para>
  762. We need to document <filename>AUTOREV</filename> and
  763. <filename>SRCREV_FORMAT</filename> here.
  764. </para>
  765. </section>
  766. </chapter>