From: Yann E. MORIN <yann.morin.1998@free.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] package/librtlsdr: fix version fetching when code is extracted from tarball
Date: Tue, 11 Aug 2020 23:54:51 +0200 [thread overview]
Message-ID: <20200811215451.GH13263@scaer> (raw)
In-Reply-To: <20200811213644.514004-1-thomas.petazzoni@bootlin.com>
Thomas, All,
On 2020-08-11 23:36 +0200, Thomas Petazzoni spake thusly:
> librtlsdr currently fails to build on the autobuilders, as it fails
> for out of tree builds. Indeed, there is some CMake logic in librtlsdr
> that determines the version using Git. This works fine when librtlsdr
> is fetched from Git of course. But in the context of Buildroot,
> librtlsdr is extracted from a tarball.
>
> For an in-tree build, the "git describe" invocation goes all the way
> up to the Buildroot .git/ metadata, and uses that as the librtlsdr
> version (it's of course wrong, but the build works). In an out-of-tree
> build, there is no parent directory with .git/ metadata, so Git fails,
> the VERSION variable is empty and later CMake aborts the build because
> of that.
>
> We fix that by adjusting the version retrieving logic to only use Git
> if a .git/ metadata folder is found at the root of the librtlsdr
> source tree. The patch has been submitted upstream.
>
> Fixes:
>
> http://autobuild.buildroot.net/results/ea52be1da8ed03272db06679d5a0a441ffe6ea0c/
>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Applied to master, thanks.
Also applied, the patch that adds Gwenhael as developper to librtlsdr.
Regards,
Yann E. MORIN.
> ---
> ...rsion.cmake-don-t-use-Git-version-if.patch | 47 +++++++++++++++++++
> 1 file changed, 47 insertions(+)
> create mode 100644 package/librtlsdr/0002-cmake-Modules-Version.cmake-don-t-use-Git-version-if.patch
>
> diff --git a/package/librtlsdr/0002-cmake-Modules-Version.cmake-don-t-use-Git-version-if.patch b/package/librtlsdr/0002-cmake-Modules-Version.cmake-don-t-use-Git-version-if.patch
> new file mode 100644
> index 0000000000..9c808edd41
> --- /dev/null
> +++ b/package/librtlsdr/0002-cmake-Modules-Version.cmake-don-t-use-Git-version-if.patch
> @@ -0,0 +1,47 @@
> +From feb5d9c6b7bcec788f9b01781c205e31fff260e7 Mon Sep 17 00:00:00 2001
> +From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> +Date: Tue, 11 Aug 2020 23:07:08 +0200
> +Subject: [PATCH] cmake/Modules/Version.cmake: don't use Git version if not in
> + a Git repo
> +
> +If the librtlsdr code comes from a tarball, it doesn't have any .git/
> +metadata, and therefore even if Git (as a tool) is found, the logic in
> +cmake/Modules/Version.cmake fails finding a version through Git:
> +
> +-- Extracting version information from git describe...
> +fatal: Not a git repository (or any of the parent directories): .git
> +
> +As a consequence, the VERSION variable is empty, which later causes
> +cmake to bail out with:
> +
> +CMake Error at /home/test/autobuild/run/instance-1/output-1/host/share/cmake-3.15/Modules/WriteBasicConfigVersionFile.cmake:43 (message):
> + No VERSION specified for WRITE_BASIC_CONFIG_VERSION_FILE()
> +Call Stack (most recent call first):
> + /home/test/autobuild/run/instance-1/output-1/host/share/cmake-3.15/Modules/CMakePackageConfigHelpers.cmake:225 (write_basic_config_version_file)
> + CMakeLists.txt:173 (write_basic_package_version_file)
> +
> +To avoid this, we only use Git to determine the version if the cmake
> +project top-level source directory has a .git/ folder.
> +
> +Upstream: https://github.com/librtlsdr/librtlsdr/pull/75
> +Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> +---
> + cmake/Modules/Version.cmake | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/cmake/Modules/Version.cmake b/cmake/Modules/Version.cmake
> +index 2d4e76d..6f67fa4 100644
> +--- a/cmake/Modules/Version.cmake
> ++++ b/cmake/Modules/Version.cmake
> +@@ -32,7 +32,7 @@ set(PATCH_VERSION ${VERSION_INFO_PATCH_VERSION})
> + ########################################################################
> + find_package(Git QUIET)
> +
> +-if(GIT_FOUND)
> ++if(GIT_FOUND AND EXISTS ${CMAKE_SOURCE_DIR}/.git)
> + message(STATUS "Extracting version information from git describe...")
> + execute_process(
> + COMMAND ${GIT_EXECUTABLE} describe --always --abbrev=4 --long
> +--
> +2.26.2
> +
> --
> 2.26.2
>
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
prev parent reply other threads:[~2020-08-11 21:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-11 21:36 [Buildroot] [PATCH] package/librtlsdr: fix version fetching when code is extracted from tarball Thomas Petazzoni
2020-08-11 21:54 ` Yann E. MORIN [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200811215451.GH13263@scaer \
--to=yann.morin.1998@free.fr \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.