docs: update examples to add branch info to git URIs

Message ID 20220309141551.612610-1-michael.opdenacker@bootlin.com
State New, archived
Headers show
Series docs: update examples to add branch info to git URIs | expand

Commit Message

Michael Opdenacker March 9, 2022, 2:15 p.m. UTC
Branch information is now mandatory for git:// and gitsm:// URIs

Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
---
 documentation/dev-manual/common-tasks.rst | 56 +++++++++++------------
 documentation/ref-manual/classes.rst      |  5 +-
 documentation/ref-manual/variables.rst    |  2 +-
 3 files changed, 29 insertions(+), 34 deletions(-)

Comments

Quentin Schulz March 10, 2022, 11 a.m. UTC | #1
Hi Michael,

On 3/9/22 15:15, Michael Opdenacker via lists.yoctoproject.org wrote:
> Branch information is now mandatory for git:// and gitsm:// URIs
> 
> Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
> ---
>   documentation/dev-manual/common-tasks.rst | 56 +++++++++++------------
>   documentation/ref-manual/classes.rst      |  5 +-
>   documentation/ref-manual/variables.rst    |  2 +-
>   3 files changed, 29 insertions(+), 34 deletions(-)
> 
> diff --git a/documentation/dev-manual/common-tasks.rst b/documentation/dev-manual/common-tasks.rst
> index 1caf953901..34f086bf1f 100644
> --- a/documentation/dev-manual/common-tasks.rst
> +++ b/documentation/dev-manual/common-tasks.rst
> @@ -1402,13 +1402,11 @@ the revision with :term:`SRCPV`. Here
>   is an example from the recipe
>   ``meta/recipes-kernel/blktrace/blktrace_git.bb``::
>   
> -   SRCREV = "d6918c8832793b4205ed3bfede78c2f915c23385"
> +   SRCREV = "366d30b9cdb20345c5d064af850d686da79b89eb"
>   
> -   PR = "r6"
> -   PV = "1.0.5+git${SRCPV}"
> +   PV = "1.3.0+git${SRCPV}"
>   
> -   SRC_URI = "git://git.kernel.dk/blktrace.git \
> -              file://ldflags.patch"
> +   SRC_URI = "git://git.kernel.dk/blktrace.git;branch=master"
>   

Would be better if we had an example with a non-master branch? I see you 
rplaced mtd-utils with lz4 below so maybe a similar change can be made here?

>   If your :term:`SRC_URI` statement includes URLs pointing to individual files
>   fetched from a remote server other than a version control system,
> @@ -2372,41 +2370,39 @@ following example shows this::
>   
>      CFLAGS:prepend = "-I ${S}/include "
>   
> -In the following example, ``mtd-utils`` is a makefile-based package::
> +In the following example, ``lz4`` is a makefile-based package::
>   
> -   SUMMARY = "Tools for managing memory technology devices"
> -   SECTION = "base"
> -   DEPENDS = "zlib lzo e2fsprogs util-linux"
> -   HOMEPAGE = "https://urldefense.proofpoint.com/v2/url?u=http-3A__www.linux-2Dmtd.infradead.org_&d=DwIDAg&c=_sEr5x9kUWhuk4_nFwjJtA&r=LYjLexDn7rXIzVmkNPvw5ymA1XTSqHGq8yBP6m6qZZ4njZguQhZhkI_-172IIy1t&m=QMieOh9nbIBS9SSii-FPQIjYKRoWkrrMH0lHC0zUBQjeE5CyvQvLCW2AnhdDjkp6&s=IH9Cg3SGu1_z_nLHAc0T0gK1IVKNgx1qioonvcMd5DY&e= "
> -   LICENSE = "GPL-2.0-or-later"
> -   LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3 \
> -       file://include/common.h;beginline=1;endline=17;md5=ba05b07912a44ea2bf81ce409380049c"
> +   SUMMARY = "Extremely Fast Compression algorithm"
> +   DESCRIPTION = "LZ4 is a very fast lossless compression algorithm, providing compression speed at 400 MB/s per core, scalable with multi-cores CPU. It also features an extremely fast decoder, with speed in multiple GB/s per core, typically reaching RAM speed limits on multi-core systems."
> +   HOMEPAGE = "https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_lz4_lz4&d=DwIDAg&c=_sEr5x9kUWhuk4_nFwjJtA&r=LYjLexDn7rXIzVmkNPvw5ymA1XTSqHGq8yBP6m6qZZ4njZguQhZhkI_-172IIy1t&m=QMieOh9nbIBS9SSii-FPQIjYKRoWkrrMH0lHC0zUBQjeE5CyvQvLCW2AnhdDjkp6&s=cFqbOb6M8UnVlEYErAMywY0qGo0oMtoZndqi1ZeQwfQ&e= "
>   
> -   # Use the latest version at 26 Oct, 2013
> -   SRCREV = "9f107132a6a073cce37434ca9cda6917dd8d866b"
> -   SRC_URI = "git://git.infradead.org/mtd-utils.git \
> -       file://add-exclusion-to-mkfs-jffs2-git-2.patch \
> -       "
> +   LICENSE = "BSD-2-Clause | GPL-2.0-only"
> +   LIC_FILES_CHKSUM = "file://lib/LICENSE;md5=ebc2ea4814a64de7708f1571904b32cc \
> +                       file://programs/COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
> +                       file://LICENSE;md5=d57c0d21cb917fb4e0af2454aa48b956 \
> +                       "
>   
> -   PV = "1.5.1+git${SRCPV}"
> +   PE = "1"
>   
> -   S = "${WORKDIR}/git"
> +   SRCREV = "d44371841a2f1728a3f36839fd4b7e872d0927d3"
>   
> -   EXTRA_OEMAKE = "'CC=${CC}' 'RANLIB=${RANLIB}' 'AR=${AR}' 'CFLAGS=${CFLAGS} -I${S}/include -DWITHOUT_XATTR' 'BUILDDIR=${S}'"
> +   SRC_URI = "git://github.com/lz4/lz4.git;branch=release;protocol=https \
> +              file://CVE-2021-3520.patch \
> +              "
> +   UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>.*)"
>   
> -   do_install () {
> -       oe_runmake install DESTDIR=${D} SBINDIR=${sbindir} MANDIR=${mandir} INCLUDEDIR=${includedir}
> -   }
> +   S = "${WORKDIR}/git"
>   
> -   PACKAGES =+ "mtd-utils-jffs2 mtd-utils-ubifs mtd-utils-misc"
> +   # Fixed in r118, which is larger than the current version.
> +   CVE_CHECK_IGNORE += "CVE-2014-4715"
>   
> -   FILES:mtd-utils-jffs2 = "${sbindir}/mkfs.jffs2 ${sbindir}/jffs2dump ${sbindir}/jffs2reader ${sbindir}/sumtool"
> -   FILES:mtd-utils-ubifs = "${sbindir}/mkfs.ubifs ${sbindir}/ubi*"
> -   FILES:mtd-utils-misc = "${sbindir}/nftl* ${sbindir}/ftl* ${sbindir}/rfd* ${sbindir}/doc* ${sbindir}/serve_image ${sbindir}/recv_image"
> +   EXTRA_OEMAKE = "PREFIX=${prefix} CC='${CC}' CFLAGS='${CFLAGS}' DESTDIR=${D} LIBDIR=${libdir} INCLUDEDIR=${includedir} BUILD_STATIC=no"
>   
> -   PARALLEL_MAKE = ""
> +   do_install() {
> +           oe_runmake install
> +   }
>   
> -   BBCLASSEXTEND = "native"
> +   BBCLASSEXTEND = "native nativesdk"
>   
>   Splitting an Application into Multiple Packages
>   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> diff --git a/documentation/ref-manual/classes.rst b/documentation/ref-manual/classes.rst
> index cba9793332..ffb2176e43 100644
> --- a/documentation/ref-manual/classes.rst
> +++ b/documentation/ref-manual/classes.rst
> @@ -170,8 +170,7 @@ example use for this class.
>      are extracted into the subdirectory expected by the default value of
>      :term:`S`::
>   
> -           SRC_URI = "git://example.com/downloads/somepackage.rpm;subpath=${BP}"
> -
> +      SRC_URI = "git://example.com/downloads/somepackage.rpm;branch=master;subpath=${BP}"
>   

s/master/main/ (or devel)

>      See the ":ref:`bitbake-user-manual/bitbake-user-manual-fetching:fetchers`" section in the BitBake User Manual for
>      more information on supported BitBake Fetchers.
> @@ -477,7 +476,7 @@ recipe that fetches from an alternative URI (e.g. Git) instead of a
>   tarball. Following is an example::
>   
>      BBCLASSEXTEND = "devupstream:target"
> -   SRC_URI:class-devupstream = "git://git.example.com/example"
> +   SRC_URI:class-devupstream = "git://git.example.com/example;branch=master"

s/master/main/ (or devel)

>      SRCREV:class-devupstream = "abcd1234"
>   
>   Adding the above statements to your recipe creates a variant that has
> diff --git a/documentation/ref-manual/variables.rst b/documentation/ref-manual/variables.rst
> index 005456f0c4..efc3fcf8d4 100644
> --- a/documentation/ref-manual/variables.rst
> +++ b/documentation/ref-manual/variables.rst
> @@ -6455,7 +6455,7 @@ system and gives an overview of their function and contents.
>         from the default value of :term:`S`, you must set it specifically so the
>         source can be located::
>   
> -         SRC_URI = "git://path/to/repo.git"
> +         SRC_URI = "git://path/to/repo.git;branch=master"

s/master/main/ (or devel)

Cheers,
Quentin
Michael Opdenacker March 10, 2022, 2:43 p.m. UTC | #2
Hi again Quentin,

On 3/10/22 15:31, Michael Opdenacker via lists.yoctoproject.org wrote:
> I agree this is an issue. We never know when this upstream will change.
>
> The challenge though is to find a suitable example which also includes
> an EXTRA_OEMAKE, because that's what the corresponding paragraph is about.


Oops, I was actually talking about the lz4 package, which is just fine
here as it doesn't use the "master" branch.
I'll do my best to remove "branch=master" from the patch.

Michael.

Patch

diff --git a/documentation/dev-manual/common-tasks.rst b/documentation/dev-manual/common-tasks.rst
index 1caf953901..34f086bf1f 100644
--- a/documentation/dev-manual/common-tasks.rst
+++ b/documentation/dev-manual/common-tasks.rst
@@ -1402,13 +1402,11 @@  the revision with :term:`SRCPV`. Here
 is an example from the recipe
 ``meta/recipes-kernel/blktrace/blktrace_git.bb``::
 
-   SRCREV = "d6918c8832793b4205ed3bfede78c2f915c23385"
+   SRCREV = "366d30b9cdb20345c5d064af850d686da79b89eb"
 
-   PR = "r6"
-   PV = "1.0.5+git${SRCPV}"
+   PV = "1.3.0+git${SRCPV}"
 
-   SRC_URI = "git://git.kernel.dk/blktrace.git \
-              file://ldflags.patch"
+   SRC_URI = "git://git.kernel.dk/blktrace.git;branch=master"
 
 If your :term:`SRC_URI` statement includes URLs pointing to individual files
 fetched from a remote server other than a version control system,
@@ -2372,41 +2370,39 @@  following example shows this::
 
    CFLAGS:prepend = "-I ${S}/include "
 
-In the following example, ``mtd-utils`` is a makefile-based package::
+In the following example, ``lz4`` is a makefile-based package::
 
-   SUMMARY = "Tools for managing memory technology devices"
-   SECTION = "base"
-   DEPENDS = "zlib lzo e2fsprogs util-linux"
-   HOMEPAGE = "http://www.linux-mtd.infradead.org/"
-   LICENSE = "GPL-2.0-or-later"
-   LIC_FILES_CHKSUM = "file://COPYING;md5=0636e73ff0215e8d672dc4c32c317bb3 \
-       file://include/common.h;beginline=1;endline=17;md5=ba05b07912a44ea2bf81ce409380049c"
+   SUMMARY = "Extremely Fast Compression algorithm"
+   DESCRIPTION = "LZ4 is a very fast lossless compression algorithm, providing compression speed at 400 MB/s per core, scalable with multi-cores CPU. It also features an extremely fast decoder, with speed in multiple GB/s per core, typically reaching RAM speed limits on multi-core systems."
+   HOMEPAGE = "https://github.com/lz4/lz4"
 
-   # Use the latest version at 26 Oct, 2013
-   SRCREV = "9f107132a6a073cce37434ca9cda6917dd8d866b"
-   SRC_URI = "git://git.infradead.org/mtd-utils.git \
-       file://add-exclusion-to-mkfs-jffs2-git-2.patch \
-       "
+   LICENSE = "BSD-2-Clause | GPL-2.0-only"
+   LIC_FILES_CHKSUM = "file://lib/LICENSE;md5=ebc2ea4814a64de7708f1571904b32cc \
+                       file://programs/COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
+                       file://LICENSE;md5=d57c0d21cb917fb4e0af2454aa48b956 \
+                       "
 
-   PV = "1.5.1+git${SRCPV}"
+   PE = "1"
 
-   S = "${WORKDIR}/git"
+   SRCREV = "d44371841a2f1728a3f36839fd4b7e872d0927d3"
 
-   EXTRA_OEMAKE = "'CC=${CC}' 'RANLIB=${RANLIB}' 'AR=${AR}' 'CFLAGS=${CFLAGS} -I${S}/include -DWITHOUT_XATTR' 'BUILDDIR=${S}'"
+   SRC_URI = "git://github.com/lz4/lz4.git;branch=release;protocol=https \
+              file://CVE-2021-3520.patch \
+              "
+   UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>.*)"
 
-   do_install () {
-       oe_runmake install DESTDIR=${D} SBINDIR=${sbindir} MANDIR=${mandir} INCLUDEDIR=${includedir}
-   }
+   S = "${WORKDIR}/git"
 
-   PACKAGES =+ "mtd-utils-jffs2 mtd-utils-ubifs mtd-utils-misc"
+   # Fixed in r118, which is larger than the current version.
+   CVE_CHECK_IGNORE += "CVE-2014-4715"
 
-   FILES:mtd-utils-jffs2 = "${sbindir}/mkfs.jffs2 ${sbindir}/jffs2dump ${sbindir}/jffs2reader ${sbindir}/sumtool"
-   FILES:mtd-utils-ubifs = "${sbindir}/mkfs.ubifs ${sbindir}/ubi*"
-   FILES:mtd-utils-misc = "${sbindir}/nftl* ${sbindir}/ftl* ${sbindir}/rfd* ${sbindir}/doc* ${sbindir}/serve_image ${sbindir}/recv_image"
+   EXTRA_OEMAKE = "PREFIX=${prefix} CC='${CC}' CFLAGS='${CFLAGS}' DESTDIR=${D} LIBDIR=${libdir} INCLUDEDIR=${includedir} BUILD_STATIC=no"
 
-   PARALLEL_MAKE = ""
+   do_install() {
+           oe_runmake install
+   }
 
-   BBCLASSEXTEND = "native"
+   BBCLASSEXTEND = "native nativesdk"
 
 Splitting an Application into Multiple Packages
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/documentation/ref-manual/classes.rst b/documentation/ref-manual/classes.rst
index cba9793332..ffb2176e43 100644
--- a/documentation/ref-manual/classes.rst
+++ b/documentation/ref-manual/classes.rst
@@ -170,8 +170,7 @@  example use for this class.
    are extracted into the subdirectory expected by the default value of
    :term:`S`::
 
-           SRC_URI = "git://example.com/downloads/somepackage.rpm;subpath=${BP}"
-
+      SRC_URI = "git://example.com/downloads/somepackage.rpm;branch=master;subpath=${BP}"
 
    See the ":ref:`bitbake-user-manual/bitbake-user-manual-fetching:fetchers`" section in the BitBake User Manual for
    more information on supported BitBake Fetchers.
@@ -477,7 +476,7 @@  recipe that fetches from an alternative URI (e.g. Git) instead of a
 tarball. Following is an example::
 
    BBCLASSEXTEND = "devupstream:target"
-   SRC_URI:class-devupstream = "git://git.example.com/example"
+   SRC_URI:class-devupstream = "git://git.example.com/example;branch=master"
    SRCREV:class-devupstream = "abcd1234"
 
 Adding the above statements to your recipe creates a variant that has
diff --git a/documentation/ref-manual/variables.rst b/documentation/ref-manual/variables.rst
index 005456f0c4..efc3fcf8d4 100644
--- a/documentation/ref-manual/variables.rst
+++ b/documentation/ref-manual/variables.rst
@@ -6455,7 +6455,7 @@  system and gives an overview of their function and contents.
       from the default value of :term:`S`, you must set it specifically so the
       source can be located::
 
-         SRC_URI = "git://path/to/repo.git"
+         SRC_URI = "git://path/to/repo.git;branch=master"
          S = "${WORKDIR}/git"
 
    :term:`SANITY_REQUIRED_UTILITIES`