summaryrefslogtreecommitdiffstats
path: root/doc/user-manual/user-manual-fetching.xml
blob: cdca64c80118413127cb068bbed0354853e7ba72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">

<chapter>
<title>File download support</title>

    <section id='file-download-overview'>
        <title>Overview</title>

        <para>
            BitBake provides support to download files.
            This procedure is called fetching and is handled by the
            fetch and fetch2 modules.
            At this point, the original fetch code is considered to
            be replaced by fetch2 and this manual is only related
            to the fetch2 codebase.
        </para>

        <para>
            The <filename>SRC_URI</filename> is normally used to
            tell BitBake which files to fetch.
            The next sections describe the available fetchers and
            their options.
            Each fetcher honors a set of variables and per
            URI parameters separated by a “;” consisting of a key and
            a value.
            The semantics of the variables and parameters are
            defined by the fetcher.
            BitBake tries to have consistent semantics between the
            different fetchers.
        </para>

        <para>
            The overall fetch process first attempts to fetch from
            <filename>PREMIRRORS</filename>.
            If these fail, the original <filename>SRC_URI</filename>
            is attempted.
            If that fails, BitBake falls back to
            <filename>MIRRORS</filename>.
            Because cross-URLs are supported, it is possible to mirror
            a Git repository on an HTTP server as a tarball.
            Here are some examples that show commonly used mirror
            definitions:
            <literallayout class='monospaced'>
PREMIRRORS ?= "\
    bzr://.*/.*   http://somemirror.org/sources/ \n \
    cvs://.*/.*   http://somemirror.org/sources/ \n \
    git://.*/.*   http://somemirror.org/sources/ \n \
    hg://.*/.*    http://somemirror.org/sources/ \n \
    osc://.*/.*   http://somemirror.org/sources/ \n \
    p4://.*/.*    http://somemirror.org/sources/ \n \
    svk://.*/.*   http://somemirror.org/sources/ \n \
    svn://.*/.*   http://somemirror.org/sources/ \n"

MIRRORS =+ "\
    ftp://.*/.*      http://somemirror.org/sources/ \n \
    http://.*/.*     http://somemirror.org/sources/ \n \
    https://.*/.*    http://somemirror.org/sources/ \n"
            </literallayout>
        </para>

        <para>
            Non-local downloaded output is placed
            into the directory specified by the
            <filename>DL_DIR</filename> variable.
            For non local archive downloads, the code can verify
            sha256 and md5 checksums for the download to ensure
            the file has been downloaded correctly.
            These can be specified in the following forms
            for md5 and sha256 checksums, respectively:
            <literallayout class='monospaced'>
     SRC_URI[md5sum]
     SRC_URI[sha256sum]
            </literallayout>
            You can also specify them as parameters on the
            <filename>SRC_URI</filename>:
            <literallayout class='monospaced'>
     SRC_URI="http://example.com/foobar.tar.bz2;md5sum=4a8e0f237e961fd7785d19d07fdb994d"
            </literallayout>
            If <filename>BB_STRICT_CHECKSUM</filename> is set, any download
            without a checksum will trigger an error message.
            In cases where multiple files are listed in
            <filename>SRC_URI</filename>, the name parameter is used
            assign names to the URLs and these are then specified
            in the checksums using the following form:
            <literallayout class='monospaced'>
     SRC_URI[name.sha256sum]
            </literallayout>
        </para>
    </section>

    <section id='local-file-fetcher'>
        <title>Local file fetcher</title>

        <para>
            The URN for the local file fetcher is file.
            The filename can be either absolute or relative.
            If the filename is relative,
            <filename>FILESPATH</filename> and failing that
            <filename>FILESDIR</filename> will be used to find the
            appropriate relative file.
            The metadata usually extend these variables to include
            variations of the values in <filename>OVERRIDES</filename>.
            Single files and complete directories can be specified.
            <literallayout class='monospaced'>
     SRC_URI = "file://relativefile.patch"
     SRC_URI = "file://relativefile.patch;this=ignored"
     SRC_URI = "file:///Users/ich/very_important_software"
            </literallayout>
        </para>
    </section>

    <section id='cvs-fetcher'>
        <title>CVS fetcher</title>

        <para>
            The URN for the CVS fetcher is cvs.
            This fetcher honors the variables <filename>CVSDIR</filename>,
            <filename>SRCDATE</filename>, <filename>FETCHCOMMAND_cvs</filename>,
            <filename>UPDATECOMMAND_cvs</filename>.
            <filename>DL_DIR</filename> specifies where a
            temporary checkout is saved.
            <filename>SRCDATE</filename> specifies which date to
            use when doing the fetching (the special value of "now"
            will cause the checkout to be updated on every build).
            <filename>FETCHCOMMAND</filename> and
            <filename>UPDATECOMMAND</filename> specify which executables
            to use for the CVS checkout or update.
        </para>

        <para>
            The supported parameters are module, tag, date,
            method, localdir, rshand scmdata.
            The module specifies which module to check out,
            the tag describes which CVS TAG should be used for
            the checkout.
            By default, the TAG is empty.
            A date can be specified to override the
            <filename>SRCDATE</filename> of the
            configuration to checkout a specific date.
            The special value of "now" will cause the checkout to be
            updated on every build.
            method is by default pserver.
            If ext is used the rsh parameter will be evaluated
            and <filename>CVS_RSH</filename> will be set.
            Finally, localdir is used to checkout into a special
            directory relative to <filename>CVSDIR</filename>.
            <literallayout class='monospaced'>
     SRC_URI = "cvs://CVSROOT;module=mymodule;tag=some-version;method=ext"
     SRC_URI = "cvs://CVSROOT;module=mymodule;date=20060126;localdir=usethat"
            </literallayout>
        </para>
    </section>

    <section id='http-ftp-fetcher'>
        <title>HTTP/FTP fetcher</title>

        <para>
            The URNs for the HTTP/FTP fetcher are http, https, and ftp.
            This fetcher honors the variables
            <filename>FETCHCOMMAND_wget</filename>.
            <filename>FETCHCOMMAND</filename> contains the command used
            for fetching.
            “${URI}” and “${FILES}” will be replaced by the URI and
            basename of the file to be fetched.
            <literallayout class='monospaced'>
     SRC_URI = "http://oe.handhelds.org/not_there.aac"
     SRC_URI = "ftp://oe.handhelds.org/not_there_as_well.aac"
     SRC_URI = "ftp://you@oe.handheld.sorg/home/you/secret.plan"
            </literallayout>
        </para>
    </section>

    <section id='svn-fetcher'>
        <title>SVN Fetcher</title>

        <para>
            The URN for the SVN fetcher is svn.
        </para>

        <para>
            This fetcher honors the variables
            <filename>FETCHCOMMAND_svn</filename>,
            <filename>SVNDIR</filename>,
            and <filename>SRCREV</filename>.
            <filename>FETCHCOMMAND</filename> contains the
            subversion command.
            <filename>SRCREV</filename> specifies which revision
            to use when doing the fetching.
        </para>

        <para>
            The supported parameters are proto, rev and scmdata.
            proto is the Subversion protocol, rev is the
            Subversion revision.
            If scmdata is set to “keep”, the “.svn” directories will
            be available during compile-time.
            <literallayout class='monospaced'>
     SRC_URI = "svn://svn.oe.handhelds.org/svn;module=vip;proto=http;rev=667"
     SRC_URI = "svn://svn.oe.handhelds.org/svn/;module=opie;proto=svn+ssh;date=20060126"
            </literallayout>
        </para>
    </section>

    <section id='git-fetcher'>
        <title>GIT Fetcher</title>

        <para>
            The URN for the GIT Fetcher is git.
        </para>

        <para>
            The variable <filename>GITDIR</filename> will be used as the
            base directory where the Git tree is cloned to.
        </para>

        <para>
            The parameters are tag, protocol, and scmdata.
            The tag parameter is a Git tag, the default is “master”.
            The protocol tag is the Git protocol to use and defaults to “git”
            if a hostname is set, otherwise it is “file”.
            If scmdata is set to “keep”, the “.git” directory will be available
            during compile-time.
            <literallayout class='monospaced'>
     SRC_URI = "git://git.oe.handhelds.org/git/vip.git;tag=version-1"
     SRC_URI = "git://git.oe.handhelds.org/git/vip.git;protocol=http"
            </literallayout>
        </para>
    </section>
</chapter>