summaryrefslogtreecommitdiffstats
path: root/bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst')
-rw-r--r--bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst309
1 files changed, 254 insertions, 55 deletions
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst
index 6760b10828..fb4f0a23d7 100644
--- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst
+++ b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-fetching.rst
@@ -27,7 +27,7 @@ and unpacking the files is often optionally followed by patching.
27Patching, however, is not covered by this module. 27Patching, however, is not covered by this module.
28 28
29The code to execute the first part of this process, a fetch, looks 29The code to execute the first part of this process, a fetch, looks
30something like the following: :: 30something like the following::
31 31
32 src_uri = (d.getVar('SRC_URI') or "").split() 32 src_uri = (d.getVar('SRC_URI') or "").split()
33 fetcher = bb.fetch2.Fetch(src_uri, d) 33 fetcher = bb.fetch2.Fetch(src_uri, d)
@@ -37,7 +37,7 @@ This code sets up an instance of the fetch class. The instance uses a
37space-separated list of URLs from the :term:`SRC_URI` 37space-separated list of URLs from the :term:`SRC_URI`
38variable and then calls the ``download`` method to download the files. 38variable and then calls the ``download`` method to download the files.
39 39
40The instantiation of the fetch class is usually followed by: :: 40The instantiation of the fetch class is usually followed by::
41 41
42 rootdir = l.getVar('WORKDIR') 42 rootdir = l.getVar('WORKDIR')
43 fetcher.unpack(rootdir) 43 fetcher.unpack(rootdir)
@@ -51,7 +51,7 @@ This code unpacks the downloaded files to the specified by ``WORKDIR``.
51 examine the OpenEmbedded class file ``base.bbclass`` 51 examine the OpenEmbedded class file ``base.bbclass``
52 . 52 .
53 53
54The ``SRC_URI`` and ``WORKDIR`` variables are not hardcoded into the 54The :term:`SRC_URI` and ``WORKDIR`` variables are not hardcoded into the
55fetcher, since those fetcher methods can be (and are) called with 55fetcher, since those fetcher methods can be (and are) called with
56different variable names. In OpenEmbedded for example, the shared state 56different variable names. In OpenEmbedded for example, the shared state
57(sstate) code uses the fetch module to fetch the sstate files. 57(sstate) code uses the fetch module to fetch the sstate files.
@@ -64,38 +64,38 @@ URLs by looking for source files in a specific search order:
64 :term:`PREMIRRORS` variable. 64 :term:`PREMIRRORS` variable.
65 65
66- *Source URI:* If pre-mirrors fail, BitBake uses the original URL (e.g 66- *Source URI:* If pre-mirrors fail, BitBake uses the original URL (e.g
67 from ``SRC_URI``). 67 from :term:`SRC_URI`).
68 68
69- *Mirror Sites:* If fetch failures occur, BitBake next uses mirror 69- *Mirror Sites:* If fetch failures occur, BitBake next uses mirror
70 locations as defined by the :term:`MIRRORS` variable. 70 locations as defined by the :term:`MIRRORS` variable.
71 71
72For each URL passed to the fetcher, the fetcher calls the submodule that 72For each URL passed to the fetcher, the fetcher calls the submodule that
73handles that particular URL type. This behavior can be the source of 73handles that particular URL type. This behavior can be the source of
74some confusion when you are providing URLs for the ``SRC_URI`` variable. 74some confusion when you are providing URLs for the :term:`SRC_URI` variable.
75Consider the following two URLs: :: 75Consider the following two URLs::
76 76
77 http://git.yoctoproject.org/git/poky;protocol=git 77 https://git.yoctoproject.org/git/poky;protocol=git
78 git://git.yoctoproject.org/git/poky;protocol=http 78 git://git.yoctoproject.org/git/poky;protocol=http
79 79
80In the former case, the URL is passed to the ``wget`` fetcher, which does not 80In the former case, the URL is passed to the ``wget`` fetcher, which does not
81understand "git". Therefore, the latter case is the correct form since the Git 81understand "git". Therefore, the latter case is the correct form since the Git
82fetcher does know how to use HTTP as a transport. 82fetcher does know how to use HTTP as a transport.
83 83
84Here are some examples that show commonly used mirror definitions: :: 84Here are some examples that show commonly used mirror definitions::
85 85
86 PREMIRRORS ?= "\ 86 PREMIRRORS ?= "\
87 bzr://.*/.\* http://somemirror.org/sources/ \\n \ 87 bzr://.*/.\* http://somemirror.org/sources/ \
88 cvs://.*/.\* http://somemirror.org/sources/ \\n \ 88 cvs://.*/.\* http://somemirror.org/sources/ \
89 git://.*/.\* http://somemirror.org/sources/ \\n \ 89 git://.*/.\* http://somemirror.org/sources/ \
90 hg://.*/.\* http://somemirror.org/sources/ \\n \ 90 hg://.*/.\* http://somemirror.org/sources/ \
91 osc://.*/.\* http://somemirror.org/sources/ \\n \ 91 osc://.*/.\* http://somemirror.org/sources/ \
92 p4://.*/.\* http://somemirror.org/sources/ \\n \ 92 p4://.*/.\* http://somemirror.org/sources/ \
93 svn://.*/.\* http://somemirror.org/sources/ \\n" 93 svn://.*/.\* http://somemirror.org/sources/"
94 94
95 MIRRORS =+ "\ 95 MIRRORS =+ "\
96 ftp://.*/.\* http://somemirror.org/sources/ \\n \ 96 ftp://.*/.\* http://somemirror.org/sources/ \
97 http://.*/.\* http://somemirror.org/sources/ \\n \ 97 http://.*/.\* http://somemirror.org/sources/ \
98 https://.*/.\* http://somemirror.org/sources/ \\n" 98 https://.*/.\* http://somemirror.org/sources/"
99 99
100It is useful to note that BitBake 100It is useful to note that BitBake
101supports cross-URLs. It is possible to mirror a Git repository on an 101supports cross-URLs. It is possible to mirror a Git repository on an
@@ -110,26 +110,26 @@ which is specified by the :term:`DL_DIR` variable.
110File integrity is of key importance for reproducing builds. For 110File integrity is of key importance for reproducing builds. For
111non-local archive downloads, the fetcher code can verify SHA-256 and MD5 111non-local archive downloads, the fetcher code can verify SHA-256 and MD5
112checksums to ensure the archives have been downloaded correctly. You can 112checksums to ensure the archives have been downloaded correctly. You can
113specify these checksums by using the ``SRC_URI`` variable with the 113specify these checksums by using the :term:`SRC_URI` variable with the
114appropriate varflags as follows: :: 114appropriate varflags as follows::
115 115
116 SRC_URI[md5sum] = "value" 116 SRC_URI[md5sum] = "value"
117 SRC_URI[sha256sum] = "value" 117 SRC_URI[sha256sum] = "value"
118 118
119You can also specify the checksums as 119You can also specify the checksums as
120parameters on the ``SRC_URI`` as shown below: :: 120parameters on the :term:`SRC_URI` as shown below::
121 121
122 SRC_URI = "http://example.com/foobar.tar.bz2;md5sum=4a8e0f237e961fd7785d19d07fdb994d" 122 SRC_URI = "http://example.com/foobar.tar.bz2;md5sum=4a8e0f237e961fd7785d19d07fdb994d"
123 123
124If multiple URIs exist, you can specify the checksums either directly as 124If multiple URIs exist, you can specify the checksums either directly as
125in the previous example, or you can name the URLs. The following syntax 125in the previous example, or you can name the URLs. The following syntax
126shows how you name the URIs: :: 126shows how you name the URIs::
127 127
128 SRC_URI = "http://example.com/foobar.tar.bz2;name=foo" 128 SRC_URI = "http://example.com/foobar.tar.bz2;name=foo"
129 SRC_URI[foo.md5sum] = 4a8e0f237e961fd7785d19d07fdb994d 129 SRC_URI[foo.md5sum] = 4a8e0f237e961fd7785d19d07fdb994d
130 130
131After a file has been downloaded and 131After a file has been downloaded and
132has had its checksum checked, a ".done" stamp is placed in ``DL_DIR``. 132has had its checksum checked, a ".done" stamp is placed in :term:`DL_DIR`.
133BitBake uses this stamp during subsequent builds to avoid downloading or 133BitBake uses this stamp during subsequent builds to avoid downloading or
134comparing a checksum for the file again. 134comparing a checksum for the file again.
135 135
@@ -144,6 +144,10 @@ download without a checksum triggers an error message. The
144make any attempted network access a fatal error, which is useful for 144make any attempted network access a fatal error, which is useful for
145checking that mirrors are complete as well as other things. 145checking that mirrors are complete as well as other things.
146 146
147If :term:`BB_CHECK_SSL_CERTS` is set to ``0`` then SSL certificate checking will
148be disabled. This variable defaults to ``1`` so SSL certificates are normally
149checked.
150
147.. _bb-the-unpack: 151.. _bb-the-unpack:
148 152
149The Unpack 153The Unpack
@@ -163,8 +167,8 @@ govern the behavior of the unpack stage:
163- *dos:* Applies to ``.zip`` and ``.jar`` files and specifies whether 167- *dos:* Applies to ``.zip`` and ``.jar`` files and specifies whether
164 to use DOS line ending conversion on text files. 168 to use DOS line ending conversion on text files.
165 169
166- *basepath:* Instructs the unpack stage to strip the specified 170- *striplevel:* Strip specified number of leading components (levels)
167 directories from the source path when unpacking. 171 from file names on extraction
168 172
169- *subdir:* Unpacks the specific URL to the specified subdirectory 173- *subdir:* Unpacks the specific URL to the specified subdirectory
170 within the root directory. 174 within the root directory.
@@ -204,7 +208,7 @@ time the ``download()`` method is called.
204If you specify a directory, the entire directory is unpacked. 208If you specify a directory, the entire directory is unpacked.
205 209
206Here are a couple of example URLs, the first relative and the second 210Here are a couple of example URLs, the first relative and the second
207absolute: :: 211absolute::
208 212
209 SRC_URI = "file://relativefile.patch" 213 SRC_URI = "file://relativefile.patch"
210 SRC_URI = "file:///Users/ich/very_important_software" 214 SRC_URI = "file:///Users/ich/very_important_software"
@@ -225,7 +229,12 @@ downloaded file is useful for avoiding collisions in
225:term:`DL_DIR` when dealing with multiple files that 229:term:`DL_DIR` when dealing with multiple files that
226have the same name. 230have the same name.
227 231
228Some example URLs are as follows: :: 232If a username and password are specified in the ``SRC_URI``, a Basic
233Authorization header will be added to each request, including across redirects.
234To instead limit the Authorization header to the first request, add
235"redirectauth=0" to the list of parameters.
236
237Some example URLs are as follows::
229 238
230 SRC_URI = "http://oe.handhelds.org/not_there.aac" 239 SRC_URI = "http://oe.handhelds.org/not_there.aac"
231 SRC_URI = "ftp://oe.handhelds.org/not_there_as_well.aac" 240 SRC_URI = "ftp://oe.handhelds.org/not_there_as_well.aac"
@@ -235,15 +244,13 @@ Some example URLs are as follows: ::
235 244
236 Because URL parameters are delimited by semi-colons, this can 245 Because URL parameters are delimited by semi-colons, this can
237 introduce ambiguity when parsing URLs that also contain semi-colons, 246 introduce ambiguity when parsing URLs that also contain semi-colons,
238 for example: 247 for example::
239 ::
240 248
241 SRC_URI = "http://abc123.org/git/?p=gcc/gcc.git;a=snapshot;h=a5dd47" 249 SRC_URI = "http://abc123.org/git/?p=gcc/gcc.git;a=snapshot;h=a5dd47"
242 250
243 251
244 Such URLs should should be modified by replacing semi-colons with '&' 252 Such URLs should should be modified by replacing semi-colons with '&'
245 characters: 253 characters::
246 ::
247 254
248 SRC_URI = "http://abc123.org/git/?p=gcc/gcc.git&a=snapshot&h=a5dd47" 255 SRC_URI = "http://abc123.org/git/?p=gcc/gcc.git&a=snapshot&h=a5dd47"
249 256
@@ -251,8 +258,7 @@ Some example URLs are as follows: ::
251 In most cases this should work. Treating semi-colons and '&' in 258 In most cases this should work. Treating semi-colons and '&' in
252 queries identically is recommended by the World Wide Web Consortium 259 queries identically is recommended by the World Wide Web Consortium
253 (W3C). Note that due to the nature of the URL, you may have to 260 (W3C). Note that due to the nature of the URL, you may have to
254 specify the name of the downloaded file as well: 261 specify the name of the downloaded file as well::
255 ::
256 262
257 SRC_URI = "http://abc123.org/git/?p=gcc/gcc.git&a=snapshot&h=a5dd47;downloadfilename=myfile.bz2" 263 SRC_URI = "http://abc123.org/git/?p=gcc/gcc.git&a=snapshot&h=a5dd47;downloadfilename=myfile.bz2"
258 264
@@ -321,7 +327,7 @@ The supported parameters are as follows:
321 327
322- *"port":* The port to which the CVS server connects. 328- *"port":* The port to which the CVS server connects.
323 329
324Some example URLs are as follows: :: 330Some example URLs are as follows::
325 331
326 SRC_URI = "cvs://CVSROOT;module=mymodule;tag=some-version;method=ext" 332 SRC_URI = "cvs://CVSROOT;module=mymodule;tag=some-version;method=ext"
327 SRC_URI = "cvs://CVSROOT;module=mymodule;date=20060126;localdir=usethat" 333 SRC_URI = "cvs://CVSROOT;module=mymodule;date=20060126;localdir=usethat"
@@ -363,7 +369,7 @@ The supported parameters are as follows:
363 username is different than the username used in the main URL, which 369 username is different than the username used in the main URL, which
364 is passed to the subversion command. 370 is passed to the subversion command.
365 371
366Following are three examples using svn: :: 372Following are three examples using svn::
367 373
368 SRC_URI = "svn://myrepos/proj1;module=vip;protocol=http;rev=667" 374 SRC_URI = "svn://myrepos/proj1;module=vip;protocol=http;rev=667"
369 SRC_URI = "svn://myrepos/proj1;module=opie;protocol=svn+ssh" 375 SRC_URI = "svn://myrepos/proj1;module=opie;protocol=svn+ssh"
@@ -390,6 +396,19 @@ This fetcher supports the following parameters:
390 protocol is "file". You can also use "http", "https", "ssh" and 396 protocol is "file". You can also use "http", "https", "ssh" and
391 "rsync". 397 "rsync".
392 398
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
408 SRC_URI = "git://git@gitlab.freedesktop.org/mesa/mesa.git;branch=main;protocol=ssh;..."
409
410 Note the ``:`` character changed for a ``/`` before the path to the project.
411
393- *"nocheckout":* Tells the fetcher to not checkout source code when 412- *"nocheckout":* Tells the fetcher to not checkout source code when
394 unpacking when set to "1". Set this option for the URL where there is 413 unpacking when set to "1". Set this option for the URL where there is
395 a custom routine to checkout code. The default is "0". 414 a custom routine to checkout code. The default is "0".
@@ -405,17 +424,17 @@ This fetcher supports the following parameters:
405 424
406- *"nobranch":* Tells the fetcher to not check the SHA validation for 425- *"nobranch":* Tells the fetcher to not check the SHA validation for
407 the branch when set to "1". The default is "0". Set this option for 426 the branch when set to "1". The default is "0". Set this option for
408 the recipe that refers to the commit that is valid for a tag instead 427 the recipe that refers to the commit that is valid for any namespace
409 of the branch. 428 (branch, tag, ...) instead of the branch.
410 429
411- *"bareclone":* Tells the fetcher to clone a bare clone into the 430- *"bareclone":* Tells the fetcher to clone a bare clone into the
412 destination directory without checking out a working tree. Only the 431 destination directory without checking out a working tree. Only the
413 raw Git metadata is provided. This parameter implies the "nocheckout" 432 raw Git metadata is provided. This parameter implies the "nocheckout"
414 parameter as well. 433 parameter as well.
415 434
416- *"branch":* The branch(es) of the Git tree to clone. If unset, this 435- *"branch":* The branch(es) of the Git tree to clone. Unless
417 is assumed to be "master". The number of branch parameters much match 436 "nobranch" is set to "1", this is a mandatory parameter. The number of
418 the number of name parameters. 437 branch parameters must match the number of name parameters.
419 438
420- *"rev":* The revision to use for the checkout. The default is 439- *"rev":* The revision to use for the checkout. The default is
421 "master". 440 "master".
@@ -436,10 +455,35 @@ This fetcher supports the following parameters:
436 parameter implies no branch and only works when the transfer protocol 455 parameter implies no branch and only works when the transfer protocol
437 is ``file://``. 456 is ``file://``.
438 457
439Here are some example URLs: :: 458Here are some example URLs::
459
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;..."
463
464.. note::
440 465
441 SRC_URI = "git://git.oe.handhelds.org/git/vip.git;tag=version-1" 466 When using ``git`` as the fetcher of the main source code of your software,
442 SRC_URI = "git://git.oe.handhelds.org/git/vip.git;protocol=http" 467 ``S`` should be set accordingly::
468
469 S = "${WORKDIR}/git"
470
471.. note::
472
473 Specifying passwords directly in ``git://`` urls is not supported.
474 There are several reasons: :term:`SRC_URI` is often written out to logs and
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
479Using tags with the git fetcher may cause surprising behaviour. Bitbake needs to
480resolve the tag to a specific revision and to do that, it has to connect to and use
481the upstream repository. This is because the revision the tags point at can change and
482we've seen cases of this happening in well known public repositories. This can mean
483many more network connections than expected and recipes may be reparsed at every build.
484Source mirrors will also be bypassed as the upstream repository is the only source
485of truth to resolve the revision accurately. For these reasons, whilst the fetcher
486can support tags, we recommend being specific about revisions in recipes.
443 487
444.. _gitsm-fetcher: 488.. _gitsm-fetcher:
445 489
@@ -475,7 +519,7 @@ repository.
475 519
476To use this fetcher, make sure your recipe has proper 520To use this fetcher, make sure your recipe has proper
477:term:`SRC_URI`, :term:`SRCREV`, and 521:term:`SRC_URI`, :term:`SRCREV`, and
478:term:`PV` settings. Here is an example: :: 522:term:`PV` settings. Here is an example::
479 523
480 SRC_URI = "ccrc://cc.example.org/ccrc;vob=/example_vob;module=/example_module" 524 SRC_URI = "ccrc://cc.example.org/ccrc;vob=/example_vob;module=/example_module"
481 SRCREV = "EXAMPLE_CLEARCASE_TAG" 525 SRCREV = "EXAMPLE_CLEARCASE_TAG"
@@ -484,7 +528,7 @@ To use this fetcher, make sure your recipe has proper
484The fetcher uses the ``rcleartool`` or 528The fetcher uses the ``rcleartool`` or
485``cleartool`` remote client, depending on which one is available. 529``cleartool`` remote client, depending on which one is available.
486 530
487Following are options for the ``SRC_URI`` statement: 531Following are options for the :term:`SRC_URI` statement:
488 532
489- *vob*: The name, which must include the prepending "/" character, 533- *vob*: The name, which must include the prepending "/" character,
490 of the ClearCase VOB. This option is required. 534 of the ClearCase VOB. This option is required.
@@ -497,7 +541,7 @@ Following are options for the ``SRC_URI`` statement:
497 The module and vob options are combined to create the load rule in the 541 The module and vob options are combined to create the load rule in the
498 view config spec. As an example, consider the vob and module values from 542 view config spec. As an example, consider the vob and module values from
499 the SRC_URI statement at the start of this section. Combining those values 543 the SRC_URI statement at the start of this section. Combining those values
500 results in the following: :: 544 results in the following::
501 545
502 load /example_vob/example_module 546 load /example_vob/example_module
503 547
@@ -546,10 +590,10 @@ password if you do not wish to keep those values in a recipe itself. If
546you choose not to use ``P4CONFIG``, or to explicitly set variables that 590you choose not to use ``P4CONFIG``, or to explicitly set variables that
547``P4CONFIG`` can contain, you can specify the ``P4PORT`` value, which is 591``P4CONFIG`` can contain, you can specify the ``P4PORT`` value, which is
548the server's URL and port number, and you can specify a username and 592the server's URL and port number, and you can specify a username and
549password directly in your recipe within ``SRC_URI``. 593password directly in your recipe within :term:`SRC_URI`.
550 594
551Here is an example that relies on ``P4CONFIG`` to specify the server URL 595Here is an example that relies on ``P4CONFIG`` to specify the server URL
552and port, username, and password, and fetches the Head Revision: :: 596and port, username, and password, and fetches the Head Revision::
553 597
554 SRC_URI = "p4://example-depot/main/source/..." 598 SRC_URI = "p4://example-depot/main/source/..."
555 SRCREV = "${AUTOREV}" 599 SRCREV = "${AUTOREV}"
@@ -557,7 +601,7 @@ and port, username, and password, and fetches the Head Revision: ::
557 S = "${WORKDIR}/p4" 601 S = "${WORKDIR}/p4"
558 602
559Here is an example that specifies the server URL and port, username, and 603Here is an example that specifies the server URL and port, username, and
560password, and fetches a Revision based on a Label: :: 604password, and fetches a Revision based on a Label::
561 605
562 P4PORT = "tcp:p4server.example.net:1666" 606 P4PORT = "tcp:p4server.example.net:1666"
563 SRC_URI = "p4://user:passwd@example-depot/main/source/..." 607 SRC_URI = "p4://user:passwd@example-depot/main/source/..."
@@ -583,7 +627,7 @@ paths locally is desirable, the fetcher supports two parameters:
583 paths locally for the specified location, even in combination with the 627 paths locally for the specified location, even in combination with the
584 ``module`` parameter. 628 ``module`` parameter.
585 629
586Here is an example use of the the ``module`` parameter: :: 630Here is an example use of the the ``module`` parameter::
587 631
588 SRC_URI = "p4://user:passwd@example-depot/main;module=source/..." 632 SRC_URI = "p4://user:passwd@example-depot/main;module=source/..."
589 633
@@ -591,7 +635,7 @@ In this case, the content of the top-level directory ``source/`` will be fetched
591to ``${P4DIR}``, including the directory itself. The top-level directory will 635to ``${P4DIR}``, including the directory itself. The top-level directory will
592be accesible at ``${P4DIR}/source/``. 636be accesible at ``${P4DIR}/source/``.
593 637
594Here is an example use of the the ``remotepath`` parameter: :: 638Here is an example use of the the ``remotepath`` parameter::
595 639
596 SRC_URI = "p4://user:passwd@example-depot/main;module=source/...;remotepath=keep" 640 SRC_URI = "p4://user:passwd@example-depot/main;module=source/...;remotepath=keep"
597 641
@@ -619,11 +663,166 @@ This fetcher supports the following parameters:
619 663
620- *"manifest":* Name of the manifest file (default: ``default.xml``). 664- *"manifest":* Name of the manifest file (default: ``default.xml``).
621 665
622Here are some example URLs: :: 666Here are some example URLs::
623 667
624 SRC_URI = "repo://REPOROOT;protocol=git;branch=some_branch;manifest=my_manifest.xml" 668 SRC_URI = "repo://REPOROOT;protocol=git;branch=some_branch;manifest=my_manifest.xml"
625 SRC_URI = "repo://REPOROOT;protocol=file;branch=some_branch;manifest=my_manifest.xml" 669 SRC_URI = "repo://REPOROOT;protocol=file;branch=some_branch;manifest=my_manifest.xml"
626 670
671.. _az-fetcher:
672
673Az Fetcher (``az://``)
674--------------------------
675
676This submodule fetches data from an
677`Azure Storage account <https://docs.microsoft.com/en-us/azure/storage/>`__ ,
678it inherits its functionality from the HTTP wget fetcher, but modifies its
679behavior to accomodate the usage of a
680`Shared Access Signature (SAS) <https://docs.microsoft.com/en-us/azure/storage/common/storage-sas-overview>`__
681for non-public data.
682
683Such 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
689You can specify the AZ_SAS variable as shown below::
690
691 AZ_SAS = "se=2021-01-01&sp=r&sv=2018-11-09&sr=c&skoid=<skoid>&sig=<signature>"
692
693Here is an example URL::
694
695 SRC_URI = "az://<azure-storage-account>.blob.core.windows.net/<foo_container>/<bar_file>"
696
697It can also be used when setting mirrors definitions using the :term:`PREMIRRORS` variable.
698
699.. _gcp-fetcher:
700
701GCP Fetcher (``gs://``)
702--------------------------
703
704This submodule fetches data from a
705`Google Cloud Storage Bucket <https://cloud.google.com/storage/docs/buckets>`__.
706It uses the `Google Cloud Storage Python Client <https://cloud.google.com/python/docs/reference/storage/latest>`__
707to check the status of objects in the bucket and download them.
708The use of the Python client makes it substantially faster than using command
709line tools such as gsutil.
710
711The fetcher requires the Google Cloud Storage Python Client to be installed, along
712with the gsutil tool.
713
714The fetcher requires that the machine has valid credentials for accessing the
715chosen 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
718If it used from the OpenEmbedded build system, the fetcher can be used for
719fetching 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
726The fetcher can also be used in recipes::
727
728 SRC_URI = "gs://<bucket name>/<foo_container>/<bar_file>"
729
730However, the checksum of the file should be also be provided::
731
732 SRC_URI[sha256sum] = "<sha256 string>"
733
734.. _crate-fetcher:
735
736Crate Fetcher (``crate://``)
737----------------------------
738
739This submodule fetches code for
740`Rust language "crates" <https://doc.rust-lang.org/reference/glossary.html?highlight=crate#crate>`__
741corresponding to Rust libraries and programs to compile. Such crates are typically shared
742on https://crates.io/ but this fetcher supports other crate registries too.
743
744The format for the :term:`SRC_URI` setting must be::
745
746 SRC_URI = "crate://REGISTRY/NAME/VERSION"
747
748Here is an example URL::
749
750 SRC_URI = "crate://crates.io/glob/0.2.11"
751
752.. _npm-fetcher:
753
754NPM Fetcher (``npm://``)
755------------------------
756
757This submodule fetches source code from an
758`NPM <https://en.wikipedia.org/wiki/Npm_(software)>`__
759Javascript package registry.
760
761The format for the :term:`SRC_URI` setting must be::
762
763 SRC_URI = "npm://some.registry.url;ParameterA=xxx;ParameterB=xxx;..."
764
765This 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
775Note that NPM fetcher only fetches the package source itself. The dependencies
776can be fetched through the `npmsw-fetcher`_.
777
778Here 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
785See :yocto_docs:`Creating Node Package Manager (NPM) Packages
786</dev-manual/packages.html#creating-node-package-manager-npm-packages>`
787in the Yocto Project manual for details about using
788:yocto_docs:`devtool <https://docs.yoctoproject.org/ref-manual/devtool-reference.html>`
789to automatically create a recipe from an NPM URL.
790
791.. _npmsw-fetcher:
792
793NPM shrinkwrap Fetcher (``npmsw://``)
794-------------------------------------
795
796This submodule fetches source code from an
797`NPM shrinkwrap <https://docs.npmjs.com/cli/v8/commands/npm-shrinkwrap>`__
798description file, which lists the dependencies
799of an NPM package while locking their versions.
800
801The format for the :term:`SRC_URI` setting must be::
802
803 SRC_URI = "npmsw://some.registry.url;ParameterA=xxx;ParameterB=xxx;..."
804
805This 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
812Note that the shrinkwrap file can also be provided by the recipe for
813the 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
820Such a file can automatically be generated using
821:yocto_docs:`devtool <https://docs.yoctoproject.org/ref-manual/devtool-reference.html>`
822as described in the :yocto_docs:`Creating Node Package Manager (NPM) Packages
823</dev-manual/packages.html#creating-node-package-manager-npm-packages>`
824section of the Yocto Project.
825
627Other Fetchers 826Other Fetchers
628-------------- 827--------------
629 828
@@ -633,10 +832,10 @@ Fetch submodules also exist for the following:
633 832
634- Mercurial (``hg://``) 833- Mercurial (``hg://``)
635 834
636- npm (``npm://``)
637
638- OSC (``osc://``) 835- OSC (``osc://``)
639 836
837- S3 (``s3://``)
838
640- Secure FTP (``sftp://``) 839- Secure FTP (``sftp://``)
641 840
642- Secure Shell (``ssh://``) 841- Secure Shell (``ssh://``)
@@ -649,4 +848,4 @@ submodules. However, you might find the code helpful and readable.
649Auto Revisions 848Auto Revisions
650============== 849==============
651 850
652We need to document ``AUTOREV`` and ``SRCREV_FORMAT`` here. 851We need to document ``AUTOREV`` and :term:`SRCREV_FORMAT` here.