Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 1 | .. SPDX-License-Identifier: CC-BY-2.5 |
| 2 | |
| 3 | ===================== |
| 4 | File Download Support |
| 5 | ===================== |
| 6 | |
| 7 | | |
| 8 | |
| 9 | BitBake's fetch module is a standalone piece of library code that deals |
| 10 | with the intricacies of downloading source code and files from remote |
| 11 | systems. Fetching source code is one of the cornerstones of building |
| 12 | software. As such, this module forms an important part of BitBake. |
| 13 | |
| 14 | The current fetch module is called "fetch2" and refers to the fact that |
| 15 | it is the second major version of the API. The original version is |
| 16 | obsolete and has been removed from the codebase. Thus, in all cases, |
| 17 | "fetch" refers to "fetch2" in this manual. |
| 18 | |
| 19 | The Download (Fetch) |
| 20 | ==================== |
| 21 | |
| 22 | BitBake takes several steps when fetching source code or files. The |
| 23 | fetcher codebase deals with two distinct processes in order: obtaining |
| 24 | the files from somewhere (cached or otherwise) and then unpacking those |
| 25 | files into a specific location and perhaps in a specific way. Getting |
| 26 | and unpacking the files is often optionally followed by patching. |
| 27 | Patching, however, is not covered by this module. |
| 28 | |
| 29 | The code to execute the first part of this process, a fetch, looks |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 30 | something like the following:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 31 | |
| 32 | src_uri = (d.getVar('SRC_URI') or "").split() |
| 33 | fetcher = bb.fetch2.Fetch(src_uri, d) |
| 34 | fetcher.download() |
| 35 | |
| 36 | This code sets up an instance of the fetch class. The instance uses a |
| 37 | space-separated list of URLs from the :term:`SRC_URI` |
| 38 | variable and then calls the ``download`` method to download the files. |
| 39 | |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 40 | The instantiation of the fetch class is usually followed by:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 41 | |
| 42 | rootdir = l.getVar('WORKDIR') |
| 43 | fetcher.unpack(rootdir) |
| 44 | |
| 45 | This code unpacks the downloaded files to the specified by ``WORKDIR``. |
| 46 | |
| 47 | .. note:: |
| 48 | |
| 49 | For convenience, the naming in these examples matches the variables |
| 50 | used by OpenEmbedded. If you want to see the above code in action, |
| 51 | examine the OpenEmbedded class file ``base.bbclass`` |
| 52 | . |
| 53 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 54 | The :term:`SRC_URI` and ``WORKDIR`` variables are not hardcoded into the |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 55 | fetcher, since those fetcher methods can be (and are) called with |
| 56 | different variable names. In OpenEmbedded for example, the shared state |
| 57 | (sstate) code uses the fetch module to fetch the sstate files. |
| 58 | |
| 59 | When the ``download()`` method is called, BitBake tries to resolve the |
| 60 | URLs by looking for source files in a specific search order: |
| 61 | |
| 62 | - *Pre-mirror Sites:* BitBake first uses pre-mirrors to try and find |
| 63 | source files. These locations are defined using the |
| 64 | :term:`PREMIRRORS` variable. |
| 65 | |
| 66 | - *Source URI:* If pre-mirrors fail, BitBake uses the original URL (e.g |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 67 | from :term:`SRC_URI`). |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 68 | |
| 69 | - *Mirror Sites:* If fetch failures occur, BitBake next uses mirror |
| 70 | locations as defined by the :term:`MIRRORS` variable. |
| 71 | |
| 72 | For each URL passed to the fetcher, the fetcher calls the submodule that |
| 73 | handles that particular URL type. This behavior can be the source of |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 74 | some confusion when you are providing URLs for the :term:`SRC_URI` variable. |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 75 | Consider the following two URLs:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 76 | |
Andrew Geissler | eff2747 | 2021-10-29 15:35:00 -0500 | [diff] [blame] | 77 | https://git.yoctoproject.org/git/poky;protocol=git |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 78 | git://git.yoctoproject.org/git/poky;protocol=http |
| 79 | |
| 80 | In the former case, the URL is passed to the ``wget`` fetcher, which does not |
| 81 | understand "git". Therefore, the latter case is the correct form since the Git |
| 82 | fetcher does know how to use HTTP as a transport. |
| 83 | |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 84 | Here are some examples that show commonly used mirror definitions:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 85 | |
| 86 | PREMIRRORS ?= "\ |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 87 | bzr://.*/.\* http://somemirror.org/sources/ \ |
| 88 | cvs://.*/.\* http://somemirror.org/sources/ \ |
| 89 | git://.*/.\* http://somemirror.org/sources/ \ |
| 90 | hg://.*/.\* http://somemirror.org/sources/ \ |
| 91 | osc://.*/.\* http://somemirror.org/sources/ \ |
| 92 | p4://.*/.\* http://somemirror.org/sources/ \ |
| 93 | svn://.*/.\* http://somemirror.org/sources/" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 94 | |
| 95 | MIRRORS =+ "\ |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 96 | ftp://.*/.\* http://somemirror.org/sources/ \ |
| 97 | http://.*/.\* http://somemirror.org/sources/ \ |
| 98 | https://.*/.\* http://somemirror.org/sources/" |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 99 | |
| 100 | It is useful to note that BitBake |
| 101 | supports cross-URLs. It is possible to mirror a Git repository on an |
| 102 | HTTP server as a tarball. This is what the ``git://`` mapping in the |
| 103 | previous example does. |
| 104 | |
| 105 | Since network accesses are slow, BitBake maintains a cache of files |
| 106 | downloaded from the network. Any source files that are not local (i.e. |
| 107 | downloaded from the Internet) are placed into the download directory, |
| 108 | which is specified by the :term:`DL_DIR` variable. |
| 109 | |
| 110 | File integrity is of key importance for reproducing builds. For |
| 111 | non-local archive downloads, the fetcher code can verify SHA-256 and MD5 |
| 112 | checksums to ensure the archives have been downloaded correctly. You can |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 113 | specify these checksums by using the :term:`SRC_URI` variable with the |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 114 | appropriate varflags as follows:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 115 | |
| 116 | SRC_URI[md5sum] = "value" |
| 117 | SRC_URI[sha256sum] = "value" |
| 118 | |
| 119 | You can also specify the checksums as |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 120 | parameters on the :term:`SRC_URI` as shown below:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 121 | |
| 122 | SRC_URI = "http://example.com/foobar.tar.bz2;md5sum=4a8e0f237e961fd7785d19d07fdb994d" |
| 123 | |
| 124 | If multiple URIs exist, you can specify the checksums either directly as |
| 125 | in the previous example, or you can name the URLs. The following syntax |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 126 | shows how you name the URIs:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 127 | |
| 128 | SRC_URI = "http://example.com/foobar.tar.bz2;name=foo" |
| 129 | SRC_URI[foo.md5sum] = 4a8e0f237e961fd7785d19d07fdb994d |
| 130 | |
| 131 | After a file has been downloaded and |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 132 | has had its checksum checked, a ".done" stamp is placed in :term:`DL_DIR`. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 133 | BitBake uses this stamp during subsequent builds to avoid downloading or |
| 134 | comparing a checksum for the file again. |
| 135 | |
| 136 | .. note:: |
| 137 | |
| 138 | It is assumed that local storage is safe from data corruption. If |
| 139 | this were not the case, there would be bigger issues to worry about. |
| 140 | |
| 141 | If :term:`BB_STRICT_CHECKSUM` is set, any |
| 142 | download without a checksum triggers an error message. The |
| 143 | :term:`BB_NO_NETWORK` variable can be used to |
| 144 | make any attempted network access a fatal error, which is useful for |
| 145 | checking that mirrors are complete as well as other things. |
| 146 | |
Patrick Williams | 0ca19cc | 2021-08-16 14:03:13 -0500 | [diff] [blame] | 147 | If :term:`BB_CHECK_SSL_CERTS` is set to ``0`` then SSL certificate checking will |
| 148 | be disabled. This variable defaults to ``1`` so SSL certificates are normally |
| 149 | checked. |
| 150 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 151 | .. _bb-the-unpack: |
| 152 | |
| 153 | The Unpack |
| 154 | ========== |
| 155 | |
| 156 | The unpack process usually immediately follows the download. For all |
| 157 | URLs except Git URLs, BitBake uses the common ``unpack`` method. |
| 158 | |
| 159 | A number of parameters exist that you can specify within the URL to |
| 160 | govern the behavior of the unpack stage: |
| 161 | |
| 162 | - *unpack:* Controls whether the URL components are unpacked. If set to |
| 163 | "1", which is the default, the components are unpacked. If set to |
| 164 | "0", the unpack stage leaves the file alone. This parameter is useful |
| 165 | when you want an archive to be copied in and not be unpacked. |
| 166 | |
| 167 | - *dos:* Applies to ``.zip`` and ``.jar`` files and specifies whether |
| 168 | to use DOS line ending conversion on text files. |
| 169 | |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 170 | - *striplevel:* Strip specified number of leading components (levels) |
| 171 | from file names on extraction |
| 172 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 173 | - *subdir:* Unpacks the specific URL to the specified subdirectory |
| 174 | within the root directory. |
| 175 | |
| 176 | The unpack call automatically decompresses and extracts files with ".Z", |
| 177 | ".z", ".gz", ".xz", ".zip", ".jar", ".ipk", ".rpm". ".srpm", ".deb" and |
| 178 | ".bz2" extensions as well as various combinations of tarball extensions. |
| 179 | |
| 180 | As mentioned, the Git fetcher has its own unpack method that is |
| 181 | optimized to work with Git trees. Basically, this method works by |
| 182 | cloning the tree into the final directory. The process is completed |
| 183 | using references so that there is only one central copy of the Git |
| 184 | metadata needed. |
| 185 | |
| 186 | .. _bb-fetchers: |
| 187 | |
| 188 | Fetchers |
| 189 | ======== |
| 190 | |
| 191 | As mentioned earlier, the URL prefix determines which fetcher submodule |
| 192 | BitBake uses. Each submodule can support different URL parameters, which |
| 193 | are described in the following sections. |
| 194 | |
| 195 | .. _local-file-fetcher: |
| 196 | |
| 197 | Local file fetcher (``file://``) |
| 198 | -------------------------------- |
| 199 | |
| 200 | This submodule handles URLs that begin with ``file://``. The filename |
| 201 | you specify within the URL can be either an absolute or relative path to |
| 202 | a file. If the filename is relative, the contents of the |
| 203 | :term:`FILESPATH` variable is used in the same way |
| 204 | ``PATH`` is used to find executables. If the file cannot be found, it is |
| 205 | assumed that it is available in :term:`DL_DIR` by the |
| 206 | time the ``download()`` method is called. |
| 207 | |
| 208 | If you specify a directory, the entire directory is unpacked. |
| 209 | |
| 210 | Here are a couple of example URLs, the first relative and the second |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 211 | absolute:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 212 | |
| 213 | SRC_URI = "file://relativefile.patch" |
| 214 | SRC_URI = "file:///Users/ich/very_important_software" |
| 215 | |
| 216 | .. _http-ftp-fetcher: |
| 217 | |
| 218 | HTTP/FTP wget fetcher (``http://``, ``ftp://``, ``https://``) |
| 219 | ------------------------------------------------------------- |
| 220 | |
| 221 | This fetcher obtains files from web and FTP servers. Internally, the |
| 222 | fetcher uses the wget utility. |
| 223 | |
| 224 | The executable and parameters used are specified by the |
| 225 | ``FETCHCMD_wget`` variable, which defaults to sensible values. The |
| 226 | fetcher supports a parameter "downloadfilename" that allows the name of |
| 227 | the downloaded file to be specified. Specifying the name of the |
| 228 | downloaded file is useful for avoiding collisions in |
| 229 | :term:`DL_DIR` when dealing with multiple files that |
| 230 | have the same name. |
| 231 | |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 232 | If a username and password are specified in the ``SRC_URI``, a Basic |
| 233 | Authorization header will be added to each request, including across redirects. |
| 234 | To instead limit the Authorization header to the first request, add |
| 235 | "redirectauth=0" to the list of parameters. |
| 236 | |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 237 | Some example URLs are as follows:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 238 | |
| 239 | SRC_URI = "http://oe.handhelds.org/not_there.aac" |
| 240 | SRC_URI = "ftp://oe.handhelds.org/not_there_as_well.aac" |
| 241 | SRC_URI = "ftp://you@oe.handhelds.org/home/you/secret.plan" |
| 242 | |
| 243 | .. note:: |
| 244 | |
| 245 | Because URL parameters are delimited by semi-colons, this can |
| 246 | introduce ambiguity when parsing URLs that also contain semi-colons, |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 247 | for example:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 248 | |
| 249 | SRC_URI = "http://abc123.org/git/?p=gcc/gcc.git;a=snapshot;h=a5dd47" |
| 250 | |
| 251 | |
| 252 | Such URLs should should be modified by replacing semi-colons with '&' |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 253 | characters:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 254 | |
| 255 | SRC_URI = "http://abc123.org/git/?p=gcc/gcc.git&a=snapshot&h=a5dd47" |
| 256 | |
| 257 | |
| 258 | In most cases this should work. Treating semi-colons and '&' in |
| 259 | queries identically is recommended by the World Wide Web Consortium |
| 260 | (W3C). Note that due to the nature of the URL, you may have to |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 261 | specify the name of the downloaded file as well:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 262 | |
| 263 | SRC_URI = "http://abc123.org/git/?p=gcc/gcc.git&a=snapshot&h=a5dd47;downloadfilename=myfile.bz2" |
| 264 | |
| 265 | |
| 266 | .. _cvs-fetcher: |
| 267 | |
| 268 | CVS fetcher (``(cvs://``) |
| 269 | ------------------------- |
| 270 | |
| 271 | This submodule handles checking out files from the CVS version control |
| 272 | system. You can configure it using a number of different variables: |
| 273 | |
| 274 | - :term:`FETCHCMD_cvs <FETCHCMD>`: The name of the executable to use when running |
| 275 | the ``cvs`` command. This name is usually "cvs". |
| 276 | |
| 277 | - :term:`SRCDATE`: The date to use when fetching the CVS source code. A |
| 278 | special value of "now" causes the checkout to be updated on every |
| 279 | build. |
| 280 | |
| 281 | - :term:`CVSDIR`: Specifies where a temporary |
| 282 | checkout is saved. The location is often ``DL_DIR/cvs``. |
| 283 | |
| 284 | - CVS_PROXY_HOST: The name to use as a "proxy=" parameter to the |
| 285 | ``cvs`` command. |
| 286 | |
| 287 | - CVS_PROXY_PORT: The port number to use as a "proxyport=" |
| 288 | parameter to the ``cvs`` command. |
| 289 | |
| 290 | As well as the standard username and password URL syntax, you can also |
| 291 | configure the fetcher with various URL parameters: |
| 292 | |
| 293 | The supported parameters are as follows: |
| 294 | |
| 295 | - *"method":* The protocol over which to communicate with the CVS |
| 296 | server. By default, this protocol is "pserver". If "method" is set to |
| 297 | "ext", BitBake examines the "rsh" parameter and sets ``CVS_RSH``. You |
| 298 | can use "dir" for local directories. |
| 299 | |
| 300 | - *"module":* Specifies the module to check out. You must supply this |
| 301 | parameter. |
| 302 | |
| 303 | - *"tag":* Describes which CVS TAG should be used for the checkout. By |
| 304 | default, the TAG is empty. |
| 305 | |
| 306 | - *"date":* Specifies a date. If no "date" is specified, the |
| 307 | :term:`SRCDATE` of the configuration is used to |
| 308 | checkout a specific date. The special value of "now" causes the |
| 309 | checkout to be updated on every build. |
| 310 | |
| 311 | - *"localdir":* Used to rename the module. Effectively, you are |
| 312 | renaming the output directory to which the module is unpacked. You |
| 313 | are forcing the module into a special directory relative to |
| 314 | :term:`CVSDIR`. |
| 315 | |
| 316 | - *"rsh":* Used in conjunction with the "method" parameter. |
| 317 | |
| 318 | - *"scmdata":* Causes the CVS metadata to be maintained in the tarball |
| 319 | the fetcher creates when set to "keep". The tarball is expanded into |
| 320 | the work directory. By default, the CVS metadata is removed. |
| 321 | |
| 322 | - *"fullpath":* Controls whether the resulting checkout is at the |
| 323 | module level, which is the default, or is at deeper paths. |
| 324 | |
| 325 | - *"norecurse":* Causes the fetcher to only checkout the specified |
| 326 | directory with no recurse into any subdirectories. |
| 327 | |
| 328 | - *"port":* The port to which the CVS server connects. |
| 329 | |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 330 | Some example URLs are as follows:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 331 | |
| 332 | SRC_URI = "cvs://CVSROOT;module=mymodule;tag=some-version;method=ext" |
| 333 | SRC_URI = "cvs://CVSROOT;module=mymodule;date=20060126;localdir=usethat" |
| 334 | |
| 335 | .. _svn-fetcher: |
| 336 | |
| 337 | Subversion (SVN) Fetcher (``svn://``) |
| 338 | ------------------------------------- |
| 339 | |
| 340 | This fetcher submodule fetches code from the Subversion source control |
| 341 | system. The executable used is specified by ``FETCHCMD_svn``, which |
| 342 | defaults to "svn". The fetcher's temporary working directory is set by |
| 343 | :term:`SVNDIR`, which is usually ``DL_DIR/svn``. |
| 344 | |
| 345 | The supported parameters are as follows: |
| 346 | |
| 347 | - *"module":* The name of the svn module to checkout. You must provide |
| 348 | this parameter. You can think of this parameter as the top-level |
| 349 | directory of the repository data you want. |
| 350 | |
| 351 | - *"path_spec":* A specific directory in which to checkout the |
| 352 | specified svn module. |
| 353 | |
| 354 | - *"protocol":* The protocol to use, which defaults to "svn". If |
| 355 | "protocol" is set to "svn+ssh", the "ssh" parameter is also used. |
| 356 | |
| 357 | - *"rev":* The revision of the source code to checkout. |
| 358 | |
Andrew Geissler | f034379 | 2020-11-18 10:42:21 -0600 | [diff] [blame] | 359 | - *"scmdata":* Causes the ".svn" directories to be available during |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 360 | compile-time when set to "keep". By default, these directories are |
| 361 | removed. |
| 362 | |
| 363 | - *"ssh":* An optional parameter used when "protocol" is set to |
| 364 | "svn+ssh". You can use this parameter to specify the ssh program used |
| 365 | by svn. |
| 366 | |
| 367 | - *"transportuser":* When required, sets the username for the |
| 368 | transport. By default, this parameter is empty. The transport |
| 369 | username is different than the username used in the main URL, which |
| 370 | is passed to the subversion command. |
| 371 | |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 372 | Following are three examples using svn:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 373 | |
| 374 | SRC_URI = "svn://myrepos/proj1;module=vip;protocol=http;rev=667" |
| 375 | SRC_URI = "svn://myrepos/proj1;module=opie;protocol=svn+ssh" |
| 376 | SRC_URI = "svn://myrepos/proj1;module=trunk;protocol=http;path_spec=${MY_DIR}/proj1" |
| 377 | |
| 378 | .. _git-fetcher: |
| 379 | |
| 380 | Git Fetcher (``git://``) |
| 381 | ------------------------ |
| 382 | |
| 383 | This fetcher submodule fetches code from the Git source control system. |
| 384 | The fetcher works by creating a bare clone of the remote into |
| 385 | :term:`GITDIR`, which is usually ``DL_DIR/git2``. This |
| 386 | bare clone is then cloned into the work directory during the unpack |
| 387 | stage when a specific tree is checked out. This is done using alternates |
| 388 | and by reference to minimize the amount of duplicate data on the disk |
| 389 | and make the unpack process fast. The executable used can be set with |
| 390 | ``FETCHCMD_git``. |
| 391 | |
| 392 | This fetcher supports the following parameters: |
| 393 | |
| 394 | - *"protocol":* The protocol used to fetch the files. The default is |
| 395 | "git" when a hostname is set. If a hostname is not set, the Git |
| 396 | protocol is "file". You can also use "http", "https", "ssh" and |
| 397 | "rsync". |
| 398 | |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 399 | .. note:: |
| 400 | |
| 401 | When ``protocol`` is "ssh", the URL expected in :term:`SRC_URI` differs |
| 402 | from the one that is typically passed to ``git clone`` command and provided |
| 403 | by the Git server to fetch from. For example, the URL returned by GitLab |
| 404 | server for ``mesa`` when cloning over SSH is |
| 405 | ``git@gitlab.freedesktop.org:mesa/mesa.git``, however the expected URL in |
| 406 | :term:`SRC_URI` is the following:: |
| 407 | |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 408 | SRC_URI = "git://git@gitlab.freedesktop.org/mesa/mesa.git;branch=main;protocol=ssh;..." |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 409 | |
| 410 | Note the ``:`` character changed for a ``/`` before the path to the project. |
| 411 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 412 | - *"nocheckout":* Tells the fetcher to not checkout source code when |
| 413 | unpacking when set to "1". Set this option for the URL where there is |
| 414 | a custom routine to checkout code. The default is "0". |
| 415 | |
| 416 | - *"rebaseable":* Indicates that the upstream Git repository can be |
| 417 | rebased. You should set this parameter to "1" if revisions can become |
| 418 | detached from branches. In this case, the source mirror tarball is |
| 419 | done per revision, which has a loss of efficiency. Rebasing the |
| 420 | upstream Git repository could cause the current revision to disappear |
| 421 | from the upstream repository. This option reminds the fetcher to |
| 422 | preserve the local cache carefully for future use. The default value |
| 423 | for this parameter is "0". |
| 424 | |
| 425 | - *"nobranch":* Tells the fetcher to not check the SHA validation for |
| 426 | the branch when set to "1". The default is "0". Set this option for |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 427 | the recipe that refers to the commit that is valid for any namespace |
| 428 | (branch, tag, ...) instead of the branch. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 429 | |
| 430 | - *"bareclone":* Tells the fetcher to clone a bare clone into the |
| 431 | destination directory without checking out a working tree. Only the |
| 432 | raw Git metadata is provided. This parameter implies the "nocheckout" |
| 433 | parameter as well. |
| 434 | |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 435 | - *"branch":* The branch(es) of the Git tree to clone. Unless |
| 436 | "nobranch" is set to "1", this is a mandatory parameter. The number of |
| 437 | branch parameters must match the number of name parameters. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 438 | |
| 439 | - *"rev":* The revision to use for the checkout. The default is |
| 440 | "master". |
| 441 | |
| 442 | - *"tag":* Specifies a tag to use for the checkout. To correctly |
| 443 | resolve tags, BitBake must access the network. For that reason, tags |
| 444 | are often not used. As far as Git is concerned, the "tag" parameter |
| 445 | behaves effectively the same as the "rev" parameter. |
| 446 | |
| 447 | - *"subpath":* Limits the checkout to a specific subpath of the tree. |
| 448 | By default, the whole tree is checked out. |
| 449 | |
| 450 | - *"destsuffix":* The name of the path in which to place the checkout. |
| 451 | By default, the path is ``git/``. |
| 452 | |
| 453 | - *"usehead":* Enables local ``git://`` URLs to use the current branch |
| 454 | HEAD as the revision for use with ``AUTOREV``. The "usehead" |
| 455 | parameter implies no branch and only works when the transfer protocol |
| 456 | is ``file://``. |
| 457 | |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 458 | Here are some example URLs:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 459 | |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 460 | SRC_URI = "git://github.com/fronteed/icheck.git;protocol=https;branch=${PV};tag=${PV}" |
| 461 | SRC_URI = "git://github.com/asciidoc/asciidoc-py;protocol=https;branch=main" |
| 462 | SRC_URI = "git://git@gitlab.freedesktop.org/mesa/mesa.git;branch=main;protocol=ssh;..." |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 463 | |
Andrew Geissler | 3b8a17c | 2021-04-15 15:55:55 -0500 | [diff] [blame] | 464 | .. note:: |
| 465 | |
Andrew Geissler | 5199d83 | 2021-09-24 16:47:35 -0500 | [diff] [blame] | 466 | When using ``git`` as the fetcher of the main source code of your software, |
| 467 | ``S`` should be set accordingly:: |
| 468 | |
| 469 | S = "${WORKDIR}/git" |
| 470 | |
| 471 | .. note:: |
| 472 | |
Andrew Geissler | 3b8a17c | 2021-04-15 15:55:55 -0500 | [diff] [blame] | 473 | Specifying passwords directly in ``git://`` urls is not supported. |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 474 | There are several reasons: :term:`SRC_URI` is often written out to logs and |
Andrew Geissler | 3b8a17c | 2021-04-15 15:55:55 -0500 | [diff] [blame] | 475 | other places, and that could easily leak passwords; it is also all too |
| 476 | easy to share metadata without removing passwords. SSH keys, ``~/.netrc`` |
| 477 | and ``~/.ssh/config`` files can be used as alternatives. |
| 478 | |
Andrew Geissler | 5082cc7 | 2023-09-11 08:41:39 -0400 | [diff] [blame] | 479 | Using tags with the git fetcher may cause surprising behaviour. Bitbake needs to |
| 480 | resolve the tag to a specific revision and to do that, it has to connect to and use |
| 481 | the upstream repository. This is because the revision the tags point at can change and |
| 482 | we've seen cases of this happening in well known public repositories. This can mean |
| 483 | many more network connections than expected and recipes may be reparsed at every build. |
| 484 | Source mirrors will also be bypassed as the upstream repository is the only source |
| 485 | of truth to resolve the revision accurately. For these reasons, whilst the fetcher |
| 486 | can support tags, we recommend being specific about revisions in recipes. |
Andrew Geissler | 3b8a17c | 2021-04-15 15:55:55 -0500 | [diff] [blame] | 487 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 488 | .. _gitsm-fetcher: |
| 489 | |
| 490 | Git Submodule Fetcher (``gitsm://``) |
| 491 | ------------------------------------ |
| 492 | |
| 493 | This fetcher submodule inherits from the :ref:`Git |
| 494 | fetcher<bitbake-user-manual/bitbake-user-manual-fetching:git fetcher |
| 495 | (\`\`git://\`\`)>` and extends that fetcher's behavior by fetching a |
| 496 | repository's submodules. :term:`SRC_URI` is passed to the Git fetcher as |
| 497 | described in the :ref:`bitbake-user-manual/bitbake-user-manual-fetching:git |
| 498 | fetcher (\`\`git://\`\`)` section. |
| 499 | |
| 500 | .. note:: |
| 501 | |
| 502 | You must clean a recipe when switching between '``git://``' and |
| 503 | '``gitsm://``' URLs. |
| 504 | |
| 505 | The Git Submodules fetcher is not a complete fetcher implementation. |
| 506 | The fetcher has known issues where it does not use the normal source |
| 507 | mirroring infrastructure properly. Further, the submodule sources it |
| 508 | fetches are not visible to the licensing and source archiving |
| 509 | infrastructures. |
| 510 | |
| 511 | .. _clearcase-fetcher: |
| 512 | |
| 513 | ClearCase Fetcher (``ccrc://``) |
| 514 | ------------------------------- |
| 515 | |
| 516 | This fetcher submodule fetches code from a |
| 517 | `ClearCase <http://en.wikipedia.org/wiki/Rational_ClearCase>`__ |
| 518 | repository. |
| 519 | |
| 520 | To use this fetcher, make sure your recipe has proper |
| 521 | :term:`SRC_URI`, :term:`SRCREV`, and |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 522 | :term:`PV` settings. Here is an example:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 523 | |
| 524 | SRC_URI = "ccrc://cc.example.org/ccrc;vob=/example_vob;module=/example_module" |
| 525 | SRCREV = "EXAMPLE_CLEARCASE_TAG" |
| 526 | PV = "${@d.getVar("SRCREV", False).replace("/", "+")}" |
| 527 | |
| 528 | The fetcher uses the ``rcleartool`` or |
| 529 | ``cleartool`` remote client, depending on which one is available. |
| 530 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 531 | Following are options for the :term:`SRC_URI` statement: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 532 | |
| 533 | - *vob*: The name, which must include the prepending "/" character, |
| 534 | of the ClearCase VOB. This option is required. |
| 535 | |
| 536 | - *module*: The module, which must include the prepending "/" |
| 537 | character, in the selected VOB. |
| 538 | |
| 539 | .. note:: |
| 540 | |
| 541 | The module and vob options are combined to create the load rule in the |
| 542 | view config spec. As an example, consider the vob and module values from |
| 543 | the SRC_URI statement at the start of this section. Combining those values |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 544 | results in the following:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 545 | |
| 546 | load /example_vob/example_module |
| 547 | |
| 548 | - *proto*: The protocol, which can be either ``http`` or ``https``. |
| 549 | |
| 550 | By default, the fetcher creates a configuration specification. If you |
| 551 | want this specification written to an area other than the default, use |
| 552 | the ``CCASE_CUSTOM_CONFIG_SPEC`` variable in your recipe to define where |
| 553 | the specification is written. |
| 554 | |
| 555 | .. note:: |
| 556 | |
| 557 | the SRCREV loses its functionality if you specify this variable. However, |
| 558 | SRCREV is still used to label the archive after a fetch even though it does |
| 559 | not define what is fetched. |
| 560 | |
| 561 | Here are a couple of other behaviors worth mentioning: |
| 562 | |
| 563 | - When using ``cleartool``, the login of ``cleartool`` is handled by |
| 564 | the system. The login require no special steps. |
| 565 | |
| 566 | - In order to use ``rcleartool`` with authenticated users, an |
| 567 | "rcleartool login" is necessary before using the fetcher. |
| 568 | |
| 569 | .. _perforce-fetcher: |
| 570 | |
| 571 | Perforce Fetcher (``p4://``) |
| 572 | ---------------------------- |
| 573 | |
| 574 | This fetcher submodule fetches code from the |
| 575 | `Perforce <https://www.perforce.com/>`__ source control system. The |
| 576 | executable used is specified by ``FETCHCMD_p4``, which defaults to "p4". |
| 577 | The fetcher's temporary working directory is set by |
| 578 | :term:`P4DIR`, which defaults to "DL_DIR/p4". |
| 579 | The fetcher does not make use of a perforce client, instead it |
| 580 | relies on ``p4 files`` to retrieve a list of |
| 581 | files and ``p4 print`` to transfer the content |
| 582 | of those files locally. |
| 583 | |
| 584 | To use this fetcher, make sure your recipe has proper |
| 585 | :term:`SRC_URI`, :term:`SRCREV`, and |
| 586 | :term:`PV` values. The p4 executable is able to use the |
| 587 | config file defined by your system's ``P4CONFIG`` environment variable |
| 588 | in order to define the Perforce server URL and port, username, and |
| 589 | password if you do not wish to keep those values in a recipe itself. If |
| 590 | you choose not to use ``P4CONFIG``, or to explicitly set variables that |
| 591 | ``P4CONFIG`` can contain, you can specify the ``P4PORT`` value, which is |
| 592 | the server's URL and port number, and you can specify a username and |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 593 | password directly in your recipe within :term:`SRC_URI`. |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 594 | |
| 595 | Here is an example that relies on ``P4CONFIG`` to specify the server URL |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 596 | and port, username, and password, and fetches the Head Revision:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 597 | |
| 598 | SRC_URI = "p4://example-depot/main/source/..." |
| 599 | SRCREV = "${AUTOREV}" |
| 600 | PV = "p4-${SRCPV}" |
| 601 | S = "${WORKDIR}/p4" |
| 602 | |
| 603 | Here is an example that specifies the server URL and port, username, and |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 604 | password, and fetches a Revision based on a Label:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 605 | |
| 606 | P4PORT = "tcp:p4server.example.net:1666" |
| 607 | SRC_URI = "p4://user:passwd@example-depot/main/source/..." |
| 608 | SRCREV = "release-1.0" |
| 609 | PV = "p4-${SRCPV}" |
| 610 | S = "${WORKDIR}/p4" |
| 611 | |
| 612 | .. note:: |
| 613 | |
| 614 | You should always set S to "${WORKDIR}/p4" in your recipe. |
| 615 | |
| 616 | By default, the fetcher strips the depot location from the local file paths. In |
| 617 | the above example, the content of ``example-depot/main/source/`` will be placed |
| 618 | in ``${WORKDIR}/p4``. For situations where preserving parts of the remote depot |
| 619 | paths locally is desirable, the fetcher supports two parameters: |
| 620 | |
| 621 | - *"module":* |
| 622 | The top-level depot location or directory to fetch. The value of this |
| 623 | parameter can also point to a single file within the depot, in which case |
| 624 | the local file path will include the module path. |
| 625 | - *"remotepath":* |
| 626 | When used with the value "``keep``", the fetcher will mirror the full depot |
| 627 | paths locally for the specified location, even in combination with the |
| 628 | ``module`` parameter. |
| 629 | |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 630 | Here is an example use of the the ``module`` parameter:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 631 | |
| 632 | SRC_URI = "p4://user:passwd@example-depot/main;module=source/..." |
| 633 | |
| 634 | In this case, the content of the top-level directory ``source/`` will be fetched |
| 635 | to ``${P4DIR}``, including the directory itself. The top-level directory will |
| 636 | be accesible at ``${P4DIR}/source/``. |
| 637 | |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 638 | Here is an example use of the the ``remotepath`` parameter:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 639 | |
| 640 | SRC_URI = "p4://user:passwd@example-depot/main;module=source/...;remotepath=keep" |
| 641 | |
| 642 | In this case, the content of the top-level directory ``source/`` will be fetched |
| 643 | to ``${P4DIR}``, but the complete depot paths will be mirrored locally. The |
| 644 | top-level directory will be accessible at |
| 645 | ``${P4DIR}/example-depot/main/source/``. |
| 646 | |
| 647 | .. _repo-fetcher: |
| 648 | |
| 649 | Repo Fetcher (``repo://``) |
| 650 | -------------------------- |
| 651 | |
| 652 | This fetcher submodule fetches code from ``google-repo`` source control |
| 653 | system. The fetcher works by initiating and syncing sources of the |
| 654 | repository into :term:`REPODIR`, which is usually |
| 655 | ``${DL_DIR}/repo``. |
| 656 | |
| 657 | This fetcher supports the following parameters: |
| 658 | |
| 659 | - *"protocol":* Protocol to fetch the repository manifest (default: |
| 660 | git). |
| 661 | |
| 662 | - *"branch":* Branch or tag of repository to get (default: master). |
| 663 | |
| 664 | - *"manifest":* Name of the manifest file (default: ``default.xml``). |
| 665 | |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 666 | Here are some example URLs:: |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 667 | |
| 668 | SRC_URI = "repo://REPOROOT;protocol=git;branch=some_branch;manifest=my_manifest.xml" |
| 669 | SRC_URI = "repo://REPOROOT;protocol=file;branch=some_branch;manifest=my_manifest.xml" |
| 670 | |
Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame] | 671 | .. _az-fetcher: |
| 672 | |
| 673 | Az Fetcher (``az://``) |
| 674 | -------------------------- |
| 675 | |
| 676 | This submodule fetches data from an |
| 677 | `Azure Storage account <https://docs.microsoft.com/en-us/azure/storage/>`__ , |
| 678 | it inherits its functionality from the HTTP wget fetcher, but modifies its |
| 679 | behavior to accomodate the usage of a |
| 680 | `Shared Access Signature (SAS) <https://docs.microsoft.com/en-us/azure/storage/common/storage-sas-overview>`__ |
| 681 | for non-public data. |
| 682 | |
| 683 | Such functionality is set by the variable: |
| 684 | |
| 685 | - :term:`AZ_SAS`: The Azure Storage Shared Access Signature provides secure |
| 686 | delegate access to resources, if this variable is set, the Az Fetcher will |
| 687 | use it when fetching artifacts from the cloud. |
| 688 | |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 689 | You can specify the AZ_SAS variable as shown below:: |
Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame] | 690 | |
| 691 | AZ_SAS = "se=2021-01-01&sp=r&sv=2018-11-09&sr=c&skoid=<skoid>&sig=<signature>" |
| 692 | |
Andrew Geissler | c926e17 | 2021-05-07 16:11:35 -0500 | [diff] [blame] | 693 | Here is an example URL:: |
Andrew Geissler | 95ac1b8 | 2021-03-31 14:34:31 -0500 | [diff] [blame] | 694 | |
| 695 | SRC_URI = "az://<azure-storage-account>.blob.core.windows.net/<foo_container>/<bar_file>" |
| 696 | |
| 697 | It can also be used when setting mirrors definitions using the :term:`PREMIRRORS` variable. |
| 698 | |
Andrew Geissler | 5082cc7 | 2023-09-11 08:41:39 -0400 | [diff] [blame] | 699 | .. _gcp-fetcher: |
| 700 | |
| 701 | GCP Fetcher (``gs://``) |
| 702 | -------------------------- |
| 703 | |
| 704 | This submodule fetches data from a |
| 705 | `Google Cloud Storage Bucket <https://cloud.google.com/storage/docs/buckets>`__. |
| 706 | It uses the `Google Cloud Storage Python Client <https://cloud.google.com/python/docs/reference/storage/latest>`__ |
| 707 | to check the status of objects in the bucket and download them. |
| 708 | The use of the Python client makes it substantially faster than using command |
| 709 | line tools such as gsutil. |
| 710 | |
| 711 | The fetcher requires the Google Cloud Storage Python Client to be installed, along |
| 712 | with the gsutil tool. |
| 713 | |
| 714 | The fetcher requires that the machine has valid credentials for accessing the |
| 715 | chosen bucket. Instructions for authentication can be found in the |
| 716 | `Google Cloud documentation <https://cloud.google.com/docs/authentication/provide-credentials-adc#local-dev>`__. |
| 717 | |
| 718 | If it used from the OpenEmbedded build system, the fetcher can be used for |
| 719 | fetching sstate artifacts from a GCS bucket by specifying the |
| 720 | ``SSTATE_MIRRORS`` variable as shown below:: |
| 721 | |
| 722 | SSTATE_MIRRORS ?= "\ |
| 723 | file://.* gs://<bucket name>/PATH \ |
| 724 | " |
| 725 | |
| 726 | The fetcher can also be used in recipes:: |
| 727 | |
| 728 | SRC_URI = "gs://<bucket name>/<foo_container>/<bar_file>" |
| 729 | |
| 730 | However, the checksum of the file should be also be provided:: |
| 731 | |
| 732 | SRC_URI[sha256sum] = "<sha256 string>" |
| 733 | |
Andrew Geissler | 615f2f1 | 2022-07-15 14:00:58 -0500 | [diff] [blame] | 734 | .. _crate-fetcher: |
| 735 | |
Andrew Geissler | 9aee500 | 2022-03-30 16:27:02 +0000 | [diff] [blame] | 736 | Crate Fetcher (``crate://``) |
| 737 | ---------------------------- |
| 738 | |
| 739 | This submodule fetches code for |
| 740 | `Rust language "crates" <https://doc.rust-lang.org/reference/glossary.html?highlight=crate#crate>`__ |
| 741 | corresponding to Rust libraries and programs to compile. Such crates are typically shared |
| 742 | on https://crates.io/ but this fetcher supports other crate registries too. |
| 743 | |
| 744 | The format for the :term:`SRC_URI` setting must be:: |
| 745 | |
| 746 | SRC_URI = "crate://REGISTRY/NAME/VERSION" |
| 747 | |
| 748 | Here is an example URL:: |
| 749 | |
| 750 | SRC_URI = "crate://crates.io/glob/0.2.11" |
| 751 | |
Andrew Geissler | 615f2f1 | 2022-07-15 14:00:58 -0500 | [diff] [blame] | 752 | .. _npm-fetcher: |
| 753 | |
| 754 | NPM Fetcher (``npm://``) |
| 755 | ------------------------ |
| 756 | |
| 757 | This submodule fetches source code from an |
| 758 | `NPM <https://en.wikipedia.org/wiki/Npm_(software)>`__ |
| 759 | Javascript package registry. |
| 760 | |
| 761 | The format for the :term:`SRC_URI` setting must be:: |
| 762 | |
Patrick Williams | db4c27e | 2022-08-05 08:10:29 -0500 | [diff] [blame] | 763 | SRC_URI = "npm://some.registry.url;ParameterA=xxx;ParameterB=xxx;..." |
Andrew Geissler | 615f2f1 | 2022-07-15 14:00:58 -0500 | [diff] [blame] | 764 | |
| 765 | This fetcher supports the following parameters: |
| 766 | |
| 767 | - *"package":* The NPM package name. This is a mandatory parameter. |
| 768 | |
| 769 | - *"version":* The NPM package version. This is a mandatory parameter. |
| 770 | |
| 771 | - *"downloadfilename":* Specifies the filename used when storing the downloaded file. |
| 772 | |
| 773 | - *"destsuffix":* Specifies the directory to use to unpack the package (default: ``npm``). |
| 774 | |
| 775 | Note that NPM fetcher only fetches the package source itself. The dependencies |
| 776 | can be fetched through the `npmsw-fetcher`_. |
| 777 | |
| 778 | Here is an example URL with both fetchers:: |
| 779 | |
| 780 | SRC_URI = " \ |
| 781 | npm://registry.npmjs.org/;package=cute-files;version=${PV} \ |
| 782 | npmsw://${THISDIR}/${BPN}/npm-shrinkwrap.json \ |
| 783 | " |
| 784 | |
| 785 | See :yocto_docs:`Creating Node Package Manager (NPM) Packages |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 786 | </dev-manual/packages.html#creating-node-package-manager-npm-packages>` |
Andrew Geissler | 615f2f1 | 2022-07-15 14:00:58 -0500 | [diff] [blame] | 787 | in the Yocto Project manual for details about using |
| 788 | :yocto_docs:`devtool <https://docs.yoctoproject.org/ref-manual/devtool-reference.html>` |
| 789 | to automatically create a recipe from an NPM URL. |
| 790 | |
| 791 | .. _npmsw-fetcher: |
| 792 | |
| 793 | NPM shrinkwrap Fetcher (``npmsw://``) |
| 794 | ------------------------------------- |
| 795 | |
| 796 | This submodule fetches source code from an |
| 797 | `NPM shrinkwrap <https://docs.npmjs.com/cli/v8/commands/npm-shrinkwrap>`__ |
| 798 | description file, which lists the dependencies |
| 799 | of an NPM package while locking their versions. |
| 800 | |
| 801 | The format for the :term:`SRC_URI` setting must be:: |
| 802 | |
Patrick Williams | db4c27e | 2022-08-05 08:10:29 -0500 | [diff] [blame] | 803 | SRC_URI = "npmsw://some.registry.url;ParameterA=xxx;ParameterB=xxx;..." |
Andrew Geissler | 615f2f1 | 2022-07-15 14:00:58 -0500 | [diff] [blame] | 804 | |
| 805 | This fetcher supports the following parameters: |
| 806 | |
| 807 | - *"dev":* Set this parameter to ``1`` to install "devDependencies". |
| 808 | |
| 809 | - *"destsuffix":* Specifies the directory to use to unpack the dependencies |
| 810 | (``${S}`` by default). |
| 811 | |
| 812 | Note that the shrinkwrap file can also be provided by the recipe for |
| 813 | the package which has such dependencies, for example:: |
| 814 | |
| 815 | SRC_URI = " \ |
| 816 | npm://registry.npmjs.org/;package=cute-files;version=${PV} \ |
| 817 | npmsw://${THISDIR}/${BPN}/npm-shrinkwrap.json \ |
| 818 | " |
| 819 | |
| 820 | Such a file can automatically be generated using |
| 821 | :yocto_docs:`devtool <https://docs.yoctoproject.org/ref-manual/devtool-reference.html>` |
| 822 | as described in the :yocto_docs:`Creating Node Package Manager (NPM) Packages |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame] | 823 | </dev-manual/packages.html#creating-node-package-manager-npm-packages>` |
Andrew Geissler | 615f2f1 | 2022-07-15 14:00:58 -0500 | [diff] [blame] | 824 | section of the Yocto Project. |
| 825 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 826 | Other Fetchers |
| 827 | -------------- |
| 828 | |
| 829 | Fetch submodules also exist for the following: |
| 830 | |
| 831 | - Bazaar (``bzr://``) |
| 832 | |
| 833 | - Mercurial (``hg://``) |
| 834 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 835 | - OSC (``osc://``) |
| 836 | |
Andrew Geissler | 5082cc7 | 2023-09-11 08:41:39 -0400 | [diff] [blame] | 837 | - S3 (``s3://``) |
| 838 | |
Andrew Geissler | c9f7865 | 2020-09-18 14:11:35 -0500 | [diff] [blame] | 839 | - Secure FTP (``sftp://``) |
| 840 | |
| 841 | - Secure Shell (``ssh://``) |
| 842 | |
| 843 | - Trees using Git Annex (``gitannex://``) |
| 844 | |
| 845 | No documentation currently exists for these lesser used fetcher |
| 846 | submodules. However, you might find the code helpful and readable. |
| 847 | |
| 848 | Auto Revisions |
| 849 | ============== |
| 850 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 851 | We need to document ``AUTOREV`` and :term:`SRCREV_FORMAT` here. |