summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorScott Rifenbark <scott.m.rifenbark@intel.com>2014-02-18 17:43:15 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-03-09 18:59:03 -0700
commit9b3e31e5e16238a7038d3fea409121be1e0e0709 (patch)
treef0285b1b4782125075d6a9afd1ee0f22c9db7b8c /bitbake
parentcd0c0673dcbd3e158bab8ad27a1b74b8629da146 (diff)
downloadpoky-9b3e31e5e16238a7038d3fea409121be1e0e0709.tar.gz
bitbake: user-manual-fetching.xml: Re-write of the Fetching chapter.
Based on a Richard Purdie re-write. (Bitbake rev: fad9a6258f8c04bbe0168e46898dd27b86c39ee0) Signed-off-by: Scott Rifenbark <scott.m.rifenbark@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/doc/user-manual/user-manual-fetching.xml582
1 files changed, 436 insertions, 146 deletions
diff --git a/bitbake/doc/user-manual/user-manual-fetching.xml b/bitbake/doc/user-manual/user-manual-fetching.xml
index 846968419b..87951fd4b4 100644
--- a/bitbake/doc/user-manual/user-manual-fetching.xml
+++ b/bitbake/doc/user-manual/user-manual-fetching.xml
@@ -5,57 +5,112 @@
5<title>File Download Support</title> 5<title>File Download Support</title>
6 6
7 <para> 7 <para>
8 BitBake's <filename>fetch</filename> and 8 BitBake's fetch module is a standalone piece of library code
9 <filename>fetch2</filename> modules support downloading 9 that deals with the intricacies of downloading source code
10 files. 10 and files from remote systems.
11 This chapter provides an overview of the fetching process 11 Fetching source code is one of the corner stones of building software.
12 and also presents sections on each of the fetchers BitBake 12 As such, this module forms an important part of BitBake.
13 supports.
14 <note>
15 The original <filename>fetch</filename> code, for all
16 practical purposes, has been replaced by
17 <filename>fetch2</filename> code.
18 Consequently, the information in this chapter does not
19 apply to <filename>fetch</filename>.
20 </note>
21 </para> 13 </para>
22 14
23 <section id='file-download-overview'> 15 <para>
24 <title>Overview</title> 16 The current fetch module is called "fetch2" and refers to the
17 fact that it is the second major version of the API.
18 The original version is obsolete and removed from the codebase.
19 Thus, in all cases, "fetch" refers to "fetch2" in this
20 manual.
21 </para>
22
23 <section id='the-download-fetch'>
24 <title>The Download (Fetch)</title>
25
26 <para>
27 BitBake takes several steps when fetching source code or files.
28 The fetcher codebase deals with two distinct processes in order:
29 obtaining the files from somewhere (cached or otherwise)
30 and then unpacking those files into a specific location and
31 perhaps in a specific way.
32 Getting and unpacking the files is often optionally followed
33 by patching.
34 Patching, however, is not covered by the fetch.
35 </para>
25 36
26 <para> 37 <para>
27 When BitBake starts to execute, the very first thing 38 The code to execute the first part of this process, a fetch,
28 it does is to fetch the source files needed. 39 looks something like the following:
29 This section overviews the process. 40 <literallayout class='monospaced'>
41 src_uri = (d.getVar('SRC_URI', True) or "").split()
42 fetcher = bb.fetch2.Fetch(src_uri, d)
43 fetcher.download()
44 </literallayout>
45 This code sets up an instance of the fetch module.
46 The instance uses a space-separated list of URLs from the
47 <link linkend='var-SRC_URI'><filename>SRC_URI</filename></link>
48 variable and then calls the <filename>download</filename>
49 method to download the files.
30 </para> 50 </para>
31 51
32 <para> 52 <para>
33 When BitBake goes looking for source files, it follows a search 53 The instance of the fetch module is usually followed by:
34 order: 54 <literallayout class='monospaced'>
35 <orderedlist> 55 rootdir = l.getVar('WORKDIR', True)
56 fetcher.unpack(rootdir)
57 </literallayout>
58 This code unpacks the downloaded files to the
59 specified by <filename>WORKDIR</filename>.
60 <note>
61 For convenience, the naming in these examples matches
62 the variables used by OpenEmbedded.
63 </note>
64 The <filename>SRC_URI</filename> and <filename>WORKDIR</filename>
65 variables are not coded into the fetcher.
66 They variables can (and are) called with different variable names.
67 In OpenEmbedded for example, the shared state (sstate) code uses
68 the fetch module to fetch the sstate files.
69 </para>
70
71 <para>
72 When the <filename>download()</filename> method is called,
73 BitBake tries to fulfill the URLs by looking for source files
74 in a specific search order:
75 <itemizedlist>
36 <listitem><para><emphasis>Pre-mirror Sites:</emphasis> 76 <listitem><para><emphasis>Pre-mirror Sites:</emphasis>
37 BitBake first uses pre-mirrors to try and find source 77 BitBake first uses pre-mirrors to try and find source files.
38 files.
39 These locations are defined using the 78 These locations are defined using the
40 <link linkend='var-PREMIRRORS'><filename>PREMIRRORS</filename></link> 79 <link linkend='var-PREMIRRORS'><filename>PREMIRRORS</filename></link>
41 variable. 80 variable.
42 </para></listitem> 81 </para></listitem>
43 <listitem><para><emphasis>Source URI:</emphasis> 82 <listitem><para><emphasis>Source URI:</emphasis>
44 If pre-mirrors fail, BitBake uses 83 If pre-mirrors fail, BitBake uses the original URL (e.g from
45 <link linkend='var-SRC_URI'><filename>SRC_URI</filename></link>. 84 <filename>SRC_URI</filename>).
46 </para></listitem> 85 </para></listitem>
47 <listitem><para><emphasis>Mirror Sites:</emphasis> 86 <listitem><para><emphasis>Mirror Sites:</emphasis>
48 If fetch failures occur using <filename>SRC_URI</filename>, 87 If fetch failures occur, BitBake next uses mirror location as
49 BitBake next uses mirror location as defined by the 88 defined by the
50 <link linkend='var-MIRRORS'><filename>MIRRORS</filename></link> 89 <link linkend='var-MIRRORS'><filename>MIRRORS</filename></link>
51 variable. 90 variable.
52 </para></listitem> 91 </para></listitem>
53 </orderedlist> 92 </itemizedlist>
93 </para>
94
95 <para>
96 For each URL passed to the fetcher, the fetcher
97 calls the submodule that handles that particular URL type.
98 This behavior can be the source of some confusion when you
99 are providing URLs for the <filename>SRC_URI</filename>
100 variable.
101 Consider the following two URLs:
102 <literallayout class='monospaced'>
103 http://git.yoctoproject.org/git/poky;protocol=git
104 git://git.yoctoproject.org/git/poky;protocol=http
105 </literallayout>
106 In the former case, the URL is passed to the
107 <filename>wget</filename> fetcher, which does not
108 understand "git".
109 Therefore, the latter case is the correct form since the
110 Git fetcher does know how to use HTTP as a transport.
54 </para> 111 </para>
55 112
56 <para> 113 <para>
57 Because cross-URLs are supported, it is possible to mirror
58 a Git repository on an HTTP server as a tarball.
59 Here are some examples that show commonly used mirror 114 Here are some examples that show commonly used mirror
60 definitions: 115 definitions:
61 <literallayout class='monospaced'> 116 <literallayout class='monospaced'>
@@ -74,19 +129,29 @@
74 http://.*/.* http://somemirror.org/sources/ \n \ 129 http://.*/.* http://somemirror.org/sources/ \n \
75 https://.*/.* http://somemirror.org/sources/ \n" 130 https://.*/.* http://somemirror.org/sources/ \n"
76 </literallayout> 131 </literallayout>
132 It is useful to note that BitBake supports
133 cross-URLs.
134 It is possible to mirror a Git repository on an HTTP
135 server as a tarball.
136 This is what the <filename>git://</filename> mapping in
137 the previous example does.
77 </para> 138 </para>
78 139
79 <para> 140 <para>
80 Any source files that are not local (i.e. downloaded from 141 Since network accesses are slow, Bitbake maintains a
81 the Internet) are placed into the download directory, 142 cache of files downloaded from the network.
82 which is specified by 143 Any source files that are not local (i.e.
83 <link linkend='var-DL_DIR'><filename>DL_DIR</filename></link>. 144 downloaded from the Internet) are placed into the download
145 directory, which is specified by the
146 <link linkend='var-DL_DIR'><filename>DL_DIR</filename></link>
147 variable.
84 </para> 148 </para>
85 149
86 <para> 150 <para>
151 File integrity is of key importance for reproducing builds.
87 For non-local archive downloads, the fetcher code can verify 152 For non-local archive downloads, the fetcher code can verify
88 sha256 and md5 checksums to ensure 153 sha256 and md5 checksums to ensure the archives have been
89 the archives have been downloaded correctly. 154 downloaded correctly.
90 You can specify these checksums by using the 155 You can specify these checksums by using the
91 <filename>SRC_URI</filename> variable with the appropriate 156 <filename>SRC_URI</filename> variable with the appropriate
92 varflags as follows: 157 varflags as follows:
@@ -97,66 +162,133 @@
97 You can also specify the checksums as parameters on the 162 You can also specify the checksums as parameters on the
98 <filename>SRC_URI</filename> as shown below: 163 <filename>SRC_URI</filename> as shown below:
99 <literallayout class='monospaced'> 164 <literallayout class='monospaced'>
100 SRC_URI="http://example.com/foobar.tar.bz2;md5sum=4a8e0f237e961fd7785d19d07fdb994d" 165 SRC_URI = "http://example.com/foobar.tar.bz2;md5sum=4a8e0f237e961fd7785d19d07f
166db994d"
101 </literallayout> 167 </literallayout>
102 If 168 If multiple URIs exist, you can specify the checksums either
103 <link linkend='var-BB_STRICT_CHECKSUM'><filename>BB_STRICT_CHECKSUM</filename></link> 169 directly as in the previous example, or you can name the URLs.
104 is set, any download without a checksum triggers an error message. 170 The following syntax shows how you name the URIs:
105 In cases where multiple files are listed using
106 <filename>SRC_URI</filename>, the name parameter is used
107 assign names to the URLs and these are then specified
108 in the checksums using the following form:
109 <literallayout class='monospaced'> 171 <literallayout class='monospaced'>
110 SRC_URI[name.sha256sum] 172 SRC_URI = "http://example.com/foobar.tar.bz2;name=foo"
173 SRC_URI[foo.md5sum] = 4a8e0f237e961fd7785d19d07fdb994d
111 </literallayout> 174 </literallayout>
175 After a file has been downloaded and has had its checksum checked,
176 a ".done" stamp is placed in <filename>DL_DIR</filename>.
177 BitBake uses this stamp during subsequent builds to avoid
178 downloading or comparing a checksum for the file again.
179 <note>
180 It is assumed that local storage is safe from data corruption.
181 If this were not the case, there would be bigger issues to worry about.
182 </note>
183 </para>
184
185 <para>
186 If
187 <link linkend='var-BB_STRICT_CHECKSUM'><filename>BB_STRICT_CHECKSUM</filename></link>
188 is set, any download without a checksum triggers an
189 error message.
190 The
191 <link linkend='var-BB_NO_NETWORK'><filename>BB_NO_NETWORK</filename></link>
192 variable can be used to make any attempted network access a fatal
193 error, which is useful for checking that mirrors are complete
194 as well as other things.
112 </para> 195 </para>
113 </section> 196 </section>
114 197
115 <section id='bb-fetchers'> 198 <section id='bb-the-unpack'>
116 <title>Fetchers</title> 199 <title>The Unpack</title>
200
201 <para>
202 The unpack process usually immediately follows the download.
203 For all URLs except Git URLs, BitBake uses the common
204 <filename>unpack</filename> method.
205 </para>
117 206
118 <para> 207 <para>
119 As mentioned in the previous section, the 208 A number of parameters exist that you can specify within the
120 <filename>SRC_URI</filename> is normally used to 209 URL to govern the behavior of the unpack stage:
121 tell BitBake which files to fetch. 210 <itemizedlist>
122 And, the fetcher BitBake uses depends on the how 211 <listitem><para><emphasis>unpack:</emphasis>
123 <filename>SRC_URI</filename> is set. 212 Controls whether the URL components are unpacked.
213 If set to "1", which is the default, the components
214 are unpacked.
215 If set to "0", the unpack stage leaves the file alone.
216 This parameter is useful when you want an archive to be
217 copied in and not be unpacked.
218 </para></listitem>
219 <listitem><para><emphasis>dos:</emphasis>
220 Applies to <filename>.zip</filename> and
221 <filename>.jar</filename> files and specifies whether to
222 use DOS line ending conversion on text files.
223 </para></listitem>
224 <listitem><para><emphasis>basepath:</emphasis>
225 Instructs the unpack stage to strip the specified
226 directories from the source path when unpacking.
227 </para></listitem>
228 <listitem><para><emphasis>subdir:</emphasis>
229 Unpacks the specific URL to the specified subdirectory
230 within the root directory.
231 </para></listitem>
232 </itemizedlist>
233 The unpack call automatically decompresses and extracts files
234 with ".Z", ".z", ".gz", ".xz", ".zip", ".jar", ".ipk", ".rpm".
235 ".srpm", ".deb" and ".bz2" extensions as well as various combinations
236 of tarball extensions.
124 </para> 237 </para>
125 238
126 <para> 239 <para>
127 These next few sections describe the available fetchers and 240 As mentioned, the Git fetcher has its own unpack method that
128 their options. 241 is optimized to work with Git trees.
129 Each fetcher honors a set of variables URI parameters, 242 Basically, this method works by cloning the tree into the final
130 which are separated by semi-colon characters and consist 243 directory.
131 of a key and a value. 244 The process is completed using references so that there is
132 The semantics of the variables and parameters are 245 only one central copy of the Git metadata needed.
133 defined by the fetcher.
134 BitBake tries to have consistent semantics between the
135 different fetchers.
136 </para> 246 </para>
247 </section>
137 248
138 <section id='local-file-fetcher'> 249 <section id='bb-fetchers'>
139 <title>Local file fetcher</title> 250 <title>Fetchers</title>
140 251
141 <para> 252 <para>
142 The URN for the local file fetcher is file. 253 As mentioned earlier, the URL prefix determines which
143 </para> 254 fetcher submodule BitBake uses.
255 Each submodule can support different URL parameters,
256 which are described in the following sections.
257 </para>
258
259 <section id='local-file-fetcher'>
260 <title>Local file fetcher (<filename>file://</filename>)</title>
144 261
145 <para> 262 <para>
146 The filename can be either absolute or relative. 263 This submodule handles URLs that begin with
147 If the filename is relative, 264 <filename>file://</filename>.
265 The filename you specify with in the URL can
266 either be an absolute or relative path to a file.
267 If the filename is relative, the contents of the
148 <link linkend='var-FILESPATH'><filename>FILESPATH</filename></link> 268 <link linkend='var-FILESPATH'><filename>FILESPATH</filename></link>
149 is used. 269 variable is used in the same way
270 <filename>PATH</filename> is used to find executables.
150 Failing that, 271 Failing that,
151 <link linkend='var-FILESDIR'><filename>FILESDIR</filename></link> 272 <link linkend='var-FILESDIR'><filename>FILESDIR</filename></link>
152 is used to find the appropriate relative file. 273 is used to find the appropriate relative file.
274 <note>
275 <filename>FILESDIR</filename> is deprecated and can
276 be replaced with <filename>FILESPATH</filename>.
277 Because <filename>FILESDIR</filename> is likely to be
278 removed, you should not use this variable in any new code.
279 </note>
280 If the file cannot be found, it is assumed that it is available in
281 <link linkend='var-DL_DIR'><filename>DL_DIR</filename></link>
282 by the time the <filename>download()</filename> method is called.
153 </para> 283 </para>
154 284
155 <para> 285 <para>
156 The metadata usually extend these variables to include 286 If you specify a directory, the entire directory is
157 variations of the values in 287 unpacked.
158 <link linkend='var-OVERRIDES'><filename>OVERRIDES</filename></link>. 288 </para>
159 Single files and complete directories can be specified. 289
290 <para>
291 Here are some example URLs:
160 <literallayout class='monospaced'> 292 <literallayout class='monospaced'>
161 SRC_URI = "file://relativefile.patch" 293 SRC_URI = "file://relativefile.patch"
162 SRC_URI = "file://relativefile.patch;this=ignored" 294 SRC_URI = "file://relativefile.patch;this=ignored"
@@ -166,36 +298,53 @@
166 </section> 298 </section>
167 299
168 <section id='cvs-fetcher'> 300 <section id='cvs-fetcher'>
169 <title>CVS fetcher</title> 301 <title>CVS fetcher (<filename>(cvs://</filename>)</title>
170
171 <para>
172 The URN for the CVS fetcher is cvs.
173 </para>
174 302
175 <para> 303 <para>
176 This fetcher honors the variables <filename>CVSDIR</filename>, 304 This submodule handles checking out files from the
177 <filename>SRCDATE</filename>, <filename>FETCHCOMMAND_cvs</filename>, 305 CVS version control system.
178 <filename>UPDATECOMMAND_cvs</filename>. 306 You can configure it using a number of different variables:
179 The 307 <itemizedlist>
180 <link linkend='var-DL_DIR'><filename>DL_DIR</filename></link> 308 <listitem><para><emphasis><filename>FETCHCMD_cvs</filename>:</emphasis>
181 variable specifies where a 309 The name of the executable to use when running
182 temporary checkout is saved. 310 the <filename>cvs</filename> command.
183 The 311 This name is usually "cvs".
184 <link linkend='var-SRCDATE'><filename>SRCDATE</filename></link> 312 </para></listitem>
185 variable specifies which date to 313 <listitem><para><emphasis><filename>SRCDATE</filename>:</emphasis>
186 use when doing the fetching. 314 The date to use when fetching the CVS source code.
187 The special value of "now" causes the checkout to be 315 A special value of "now" causes the checkout to
188 updated on every build. 316 be updated on every build.
189 The <filename>FETCHCOMMAND</filename> and 317 </para></listitem>
190 <filename>UPDATECOMMAND</filename> variables specify the executables 318 <listitem><para><emphasis><filename>CVSDIR</filename>:</emphasis>
191 to use for the CVS checkout or update. 319 Specifies where a temporary checkout is saved.
320 The location is often <filename>DL_DIR/cvs</filename>.
321 </para></listitem>
322 <listitem><para><emphasis><filename>CVS_PROXY_HOST</filename>:</emphasis>
323 The name to use as a "proxy=" parameter to the
324 <filename>cvs</filename> command.
325 </para></listitem>
326 <listitem><para><emphasis><filename>CVS_PROXY_PORT</filename>:</emphasis>
327 The port number to use as a "proxyport=" parameter to
328 the <filename>cvs</filename> command.
329 </para></listitem>
330 </itemizedlist>
331 As well as the standard username and password URL syntax,
332 you can also configure the fetcher with various URL parameters:
192 </para> 333 </para>
193 334
194 <para> 335 <para>
195 The supported parameters are as follows: 336 The supported parameters are as follows:
196 <itemizedlist> 337 <itemizedlist>
338 <listitem><para><emphasis>"method":</emphasis>
339 The protocol over which to communicate with the cvs server.
340 By default, this protocol is "pserver".
341 If "method" is set to "ext", BitBake examines the
342 "rsh" parameter and sets <filename>CVS_RSH</filename>.
343 You can use "dir" for local directories.
344 </para></listitem>
197 <listitem><para><emphasis>"module":</emphasis> 345 <listitem><para><emphasis>"module":</emphasis>
198 Specifies the module to check out. 346 Specifies the module to check out.
347 You must supply this parameter.
199 </para></listitem> 348 </para></listitem>
200 <listitem><para><emphasis>"tag":</emphasis> 349 <listitem><para><emphasis>"tag":</emphasis>
201 Describes which CVS TAG should be used for 350 Describes which CVS TAG should be used for
@@ -210,23 +359,36 @@
210 The special value of "now" causes the checkout to be 359 The special value of "now" causes the checkout to be
211 updated on every build. 360 updated on every build.
212 </para></listitem> 361 </para></listitem>
213 <listitem><para><emphasis>"method":</emphasis>
214 By default <filename>pserver</filename>.
215 If "method" is set to "ext", BitBake examines the "rsh"
216 parameter and sets <filename>CVS_RSH</filename>.
217 </para></listitem>
218 <listitem><para><emphasis>"localdir":</emphasis> 362 <listitem><para><emphasis>"localdir":</emphasis>
219 Used to checkout force into a special 363 Used to rename the module.
364 Effectively, you are renaming the output directory
365 to which the module is unpacked.
366 You are forcing the module into a special
220 directory relative to <filename>CVSDIR</filename>. 367 directory relative to <filename>CVSDIR</filename>.
221 </para></listitem> 368 </para></listitem>
222 <listitem><para><emphasis>"rsh"</emphasis> 369 <listitem><para><emphasis>"rsh"</emphasis>
223 Used in conjunction with the "method" parameter. 370 Used in conjunction with the "method" parameter.
224 </para></listitem> 371 </para></listitem>
225 <listitem><para><emphasis>"scmdata":</emphasis> 372 <listitem><para><emphasis>"scmdata":</emphasis>
226 I need a description for this. 373 Causes the CVS metadata to be maintained in the tarball
374 the fetcher creates when set to "keep".
375 The tarball is expanded into the work directory.
376 By default, the CVS metadata is removed.
377 </para></listitem>
378 <listitem><para><emphasis>"fullpath":</emphasis>
379 Controls whether the resulting checkout is at the
380 module level, which is the default, or is at deeper
381 paths.
382 </para></listitem>
383 <listitem><para><emphasis>"norecurse":</emphasis>
384 Causes the fetcher to only checkout the specified
385 directory with no recurse into any subdirectories.
386 </para></listitem>
387 <listitem><para><emphasis>"port":</emphasis>
388 The port to which the CVS server connects.
227 </para></listitem> 389 </para></listitem>
228 </itemizedlist> 390 </itemizedlist>
229 Following are two examples using cvs: 391 Some example URLs are as follows:
230 <literallayout class='monospaced'> 392 <literallayout class='monospaced'>
231 SRC_URI = "cvs://CVSROOT;module=mymodule;tag=some-version;method=ext" 393 SRC_URI = "cvs://CVSROOT;module=mymodule;tag=some-version;method=ext"
232 SRC_URI = "cvs://CVSROOT;module=mymodule;date=20060126;localdir=usethat" 394 SRC_URI = "cvs://CVSROOT;module=mymodule;date=20060126;localdir=usethat"
@@ -235,19 +397,27 @@
235 </section> 397 </section>
236 398
237 <section id='http-ftp-fetcher'> 399 <section id='http-ftp-fetcher'>
238 <title>HTTP/FTP fetcher</title> 400 <title>HTTP/FTP wget fetcher (<filename>http://</filename>, <filename>ftp://</filename>, <filename>https://</filename>)</title>
239 401
240 <para> 402 <para>
241 The URNs for the HTTP/FTP fetcher are http, https, and ftp. 403 This fetcher obtains files from web and FTP servers.
404 Internally, the fetcher uses the wget utility.
242 </para> 405 </para>
243 406
244 <para> 407 <para>
245 This fetcher honors the variables 408 The executable and parameters used are specified by the
246 <filename>FETCHCOMMAND_wget</filename>. 409 <filename>FETCHCMD_wget</filename> variable, which defaults
247 The <filename>FETCHCOMMAND</filename> variable 410 to a sensible values.
248 contains the command used for fetching. 411 The fetcher supports a parameter "downloadfilename" that
249 “${URI}” and “${FILES}” are replaced by the URI and 412 allows the name of the downloaded file to be specified.
250 the base name of the file to be fetched. 413 Specifying the name of the downloaded file is useful
414 for avoiding collisions in
415 <link linkend='var-DL_DIR'><filename>DL_DIR</filename></link>
416 when dealing with multiple files that have the same name.
417 </para>
418
419 <para>
420 Some example URLs are as follows:
251 <literallayout class='monospaced'> 421 <literallayout class='monospaced'>
252 SRC_URI = "http://oe.handhelds.org/not_there.aac" 422 SRC_URI = "http://oe.handhelds.org/not_there.aac"
253 SRC_URI = "ftp://oe.handhelds.org/not_there_as_well.aac" 423 SRC_URI = "ftp://oe.handhelds.org/not_there_as_well.aac"
@@ -257,36 +427,46 @@
257 </section> 427 </section>
258 428
259 <section id='svn-fetcher'> 429 <section id='svn-fetcher'>
260 <title>SVN Fetcher</title> 430 <title>Subversion (SVN) Fetcher (<filename>svn://</filename>)</title>
261 431
262 <para> 432 <para>
263 The URN for the SVN fetcher is svn. 433 This fetcher submodule fetches code from the
264 </para> 434 Subversion source control system.
265 435 The executable used is specified by
266 <para> 436 <filename>FETCHCMD_svn</filename>, which defaults
267 This fetcher honors the variables 437 to "svn".
268 <filename>FETCHCOMMAND_svn</filename>, 438 The fetcher's temporary working directory is set
269 <filename>SVNDIR</filename>, 439 by <filename>SVNDIR</filename>, which is usually
270 and 440 <filename>DL_DIR/svn</filename>.
271 <link linkend='var-SRCREV'><filename>SRCREV</filename></link>.
272 The <filename>FETCHCOMMAND</filename> variable contains the
273 <filename>subversion</filename> command.
274 The <filename>SRCREV</filename> variable specifies which revision
275 to use when doing the fetching.
276 </para> 441 </para>
277 442
278 <para> 443 <para>
279 The supported parameters are as follows: 444 The supported parameters are as follows:
280 <itemizedlist> 445 <itemizedlist>
281 <listitem><para><emphasis>"proto":</emphasis> 446 <listitem><para><emphasis>"module":</emphasis>
282 The Subversion protocol. 447 The name of the svn module to checkout.
448 You must provide this parameter.
449 You can think of this parameter as the top-level
450 directory of the repository data you want.
451 </para></listitem>
452 <listitem><para><emphasis>"protocol":</emphasis>
453 The protocol to use, which defaults to "svn".
454 Other options are "svn+ssh" and "rsh".
455 For "rsh", the "rsh" parameter is also used.
283 </para></listitem> 456 </para></listitem>
284 <listitem><para><emphasis>"rev":</emphasis> 457 <listitem><para><emphasis>"rev":</emphasis>
285 The Subversion revision. 458 The revision of the source code to checkout.
459 </para></listitem>
460 <listitem><para><emphasis>"date":</emphasis>
461 The date of the source code to checkout.
462 Specific revisions are generally much safer to checkout
463 rather than by date as they do not involve timezones
464 (e.g. they are much more deterministic).
286 </para></listitem> 465 </para></listitem>
287 <listitem><para><emphasis>"scmdata":</emphasis> 466 <listitem><para><emphasis>"scmdata":</emphasis>
288 Set to "keep" causes the “.svn” directories 467 Causes the “.svn” directories to be available during
289 to be available during compile-time. 468 compile-time when set to "keep".
469 By default, these directories are removed.
290 </para></listitem> 470 </para></listitem>
291 </itemizedlist> 471 </itemizedlist>
292 Following are two examples using svn: 472 Following are two examples using svn:
@@ -298,40 +478,150 @@
298 </section> 478 </section>
299 479
300 <section id='git-fetcher'> 480 <section id='git-fetcher'>
301 <title>GIT Fetcher</title> 481 <title>GIT Fetcher (<filename>git://</filename>)</title>
302
303 <para>
304 The URN for the Git Fetcher is git.
305 </para>
306 482
307 <para> 483 <para>
308 The variable <filename>GITDIR</filename> is used as the 484 This fetcher submodule fetches code from the Git
309 base directory in which the Git tree is cloned. 485 source control system.
486 The fetcher works by creating a bare clone of the
487 remote into <filename>GITDIR</filename>, which is
488 usually <filename>DL_DIR/git</filename>.
489 This bare clone is then cloned into the work directory during the
490 unpack stage when a specific tree is checked out.
491 This is done using alternates and by reference to
492 minimize the amount of duplicate data on the disk and
493 make the unpack process fast.
494 The executable used can be set with
495 <filename>FETCHCMD_git</filename>.
310 </para> 496 </para>
311 497
312 <para> 498 <para>
313 The supported parameters are as follows: 499 This fetcher supports the following parameters:
314 <itemizedlist> 500 <itemizedlist>
315 <listitem><para><emphasis>"tag":</emphasis>
316 The Git tag.
317 The default is "master".
318 </para></listitem>
319 <listitem><para><emphasis>"protocol":</emphasis> 501 <listitem><para><emphasis>"protocol":</emphasis>
320 The Git protocol. 502 The protocol used to fetch the files.
321 The default is "git" when a hostname is set. 503 The default is "git" when a hostname is set.
322 If a hostname is not set, the Git protocol is "file". 504 If a hostname is not set, the Git protocol is "file".
505 You can also use "http", "https", "ssh" and "rsync".
323 </para></listitem> 506 </para></listitem>
324 <listitem><para><emphasis>"scmdata":</emphasis> 507 <listitem><para><emphasis>"nocheckout":</emphasis>
325 When set to “keep”, the “.git” directory is available 508 Tells the fetcher to not checkout source code when
326 during compile-time. 509 unpacking when set to "1".
510 Set this option for the URL where there is a custom
511 routine to checkout code.
512 The default is "0".
513 </para></listitem>
514 <listitem><para><emphasis>"rebaseable":</emphasis>
515 Indicates that the upstream Git repository can be rebased.
516 You should set this parameter to "1" if
517 revisions can become detached from branches.
518 In this case, the source mirror tarball is done per
519 revision, which has a loss of efficiency.
520 Rebasing the upstream Git repository could cause the
521 current revision to disappear from the upstream repository.
522 This option reminds the fetcher to preserve the local cache
523 carefully for future use.
524 The default value for this parameter is "0".
525 </para></listitem>
526 <listitem><para><emphasis>"nobranch":</emphasis>
527 Tells the fetcher to not check the SHA validation
528 for the branch when set to "1".
529 The default is "0".
530 Set this option for the recipe that refers to
531 the commit that is valid for a tag instead of
532 the branch.
533 </para></listitem>
534 <listitem><para><emphasis>"bareclone":</emphasis>
535 Tells the fetcher to clone a bare clone into the
536 destination directory without checking out a working tree.
537 Only the raw Git metadata is provided.
538 This parameter implies the "nocheckout" parameter as well.
539 </para></listitem>
540 <listitem><para><emphasis>"branch":</emphasis>
541 The branch(es) of the Git tree to clone.
542 If unset, this is assumed to be "master".
543 The number of branch parameters much match the number of
544 name parameters.
545 </para></listitem>
546 <listitem><para><emphasis>"rev":</emphasis>
547 The revision to use for the checkout.
548 The default is "master".
549 </para></listitem>
550 <listitem><para><emphasis>"tag":</emphasis>
551 Specifies a tag to use for the checkout.
552 To correctly resolve tags, BitBake must access the
553 network.
554 For that reason, tags are often not used.
555 As far as Git is concerned, the "tag" parameter behaves
556 effectively the same as the "revision" parameter.
557 </para></listitem>
558 <listitem><para><emphasis>"subpath":</emphasis>
559 Limits the checkout to a specific subpath of the tree.
560 By default, the whole tree is checked out.
561 </para></listitem>
562 <listitem><para><emphasis>"destsuffix":</emphasis>
563 The name of the path in which to place the checkout.
564 By default, the path is <filename>git/</filename>.
327 </para></listitem> 565 </para></listitem>
328 </itemizedlist> 566 </itemizedlist>
329 Following are two examples using git: 567 Here are some example URLs:
330 <literallayout class='monospaced'> 568 <literallayout class='monospaced'>
331 SRC_URI = "git://git.oe.handhelds.org/git/vip.git;tag=version-1" 569 SRC_URI = "git://git.oe.handhelds.org/git/vip.git;tag=version-1"
332 SRC_URI = "git://git.oe.handhelds.org/git/vip.git;protocol=http" 570 SRC_URI = "git://git.oe.handhelds.org/git/vip.git;protocol=http"
333 </literallayout> 571 </literallayout>
334 </para> 572 </para>
335 </section> 573 </section>
574
575 <section id='other-fetchers'>
576 <title>Other Fetchers</title>
577
578 <para>
579 Fetch submodules also exist for the following:
580 <itemizedlist>
581 <listitem><para>
582 Bazzar (<filename>bzr://</filename>)
583 </para></listitem>
584 <listitem><para>
585 Perforce (<filename>p4://</filename>)
586 </para></listitem>
587 <listitem><para>
588 SVK
589 </para></listitem>
590 <listitem><para>
591 Git Submodules (<filename>gitsm://</filename>)
592 </para></listitem>
593 <listitem><para>
594 Trees using Git Annex (<filename>gitannex://</filename>)
595 </para></listitem>
596 <listitem><para>
597 Secure FTP (<filename>sftp://</filename>)
598 </para></listitem>
599 <listitem><para>
600 Secure Shell (<filename>ssh://</filename>)
601 </para></listitem>
602 <listitem><para>
603 Repo (<filename>repo://</filename>)
604 </para></listitem>
605 <listitem><para>
606 OSC (<filename>osc://</filename>)
607 </para></listitem>
608 <listitem><para>
609 Mercurial (<filename>hg://</filename>)
610 </para></listitem>
611 </itemizedlist>
612 No documentation currently exists for these lesser used
613 fetcher submodules.
614 However, you might find the code helpful and readable.
615 </para>
616 </section>
617 </section>
618
619 <section id='auto-revisions'>
620 <title>Auto Revisions</title>
621
622 <para>
623 We need to document <filename>AUTOREV</filename> and
624 <filename>SRCREV_FORMAT</filename> here.
625 </para>
336 </section> 626 </section>
337</chapter> 627</chapter>