From 7e3e3feb5a5ed8055b481a72f3c349c2f4cd3255 Mon Sep 17 00:00:00 2001 From: Yi Zhao Date: Wed, 2 Jul 2025 15:28:52 +0800 Subject: [PATCH] gnupg: drop -unknown suffix from version number For gnupg and related packages, if autogen.sh is run outside of a git repo, the find-version function always assumes that the package is a beta version and adds the suffix '-unknown' to the version number. Add drop-unknow-suffix.inc file that can be included by gnupg and other recipes. This file is used to modify autogen.sh: 1. Replace beta=yes with beta=no. 2. Replace tmp="-unknown" with tmp="" Also remove 0004-autogen.sh-fix-find-version-for-beta-checking.patch as it is no longer needed. Befor the fix: $ gpg --version gpg (GnuPG) 2.5.5-unknown After the fix: $ gpg --version gpg (GnuPG) 2.5.5 (From OE-Core rev: f6efe56a8c73ae9f58cb70f1469c617ff0647b49) Signed-off-by: Yi Zhao Signed-off-by: Richard Purdie --- .../gnupg/drop-unknown-suffix.inc | 29 +++++++++++++++++ ...h-fix-find-version-for-beta-checking.patch | 31 ------------------- meta/recipes-support/gnupg/gnupg_2.5.5.bb | 3 +- 3 files changed, 31 insertions(+), 32 deletions(-) create mode 100644 meta/recipes-support/gnupg/drop-unknown-suffix.inc delete mode 100644 meta/recipes-support/gnupg/gnupg/0004-autogen.sh-fix-find-version-for-beta-checking.patch diff --git a/meta/recipes-support/gnupg/drop-unknown-suffix.inc b/meta/recipes-support/gnupg/drop-unknown-suffix.inc new file mode 100644 index 0000000000..dc8f31869c --- /dev/null +++ b/meta/recipes-support/gnupg/drop-unknown-suffix.inc @@ -0,0 +1,29 @@ +# +# Copyright OpenEmbedded Contributors +# +# SPDX-License-Identifier: MIT +# + +# +# This .inc file is used to remove unknown suffix in runtime version +# for gnupg and its related packages. +# +# In these packages, if autogen.sh is run outside of a git repo, +# the find-version function always assumes that the package is a +# beta version and adds the suffix '-unknown' to the version number. +# +# This .inc file modifies autogen.sh to: +# 1. Replace beta=yes with beta=no +# 2. Replace tmp="-unknown" with tmp="" +# + +do_configure:prepend() { + if [ -f ${S}/autogen.sh ]; then + sed -i \ + -e 's/^\([[:space:]]*\)beta=yes$/\1beta=no/' \ + -e 's/^\([[:space:]]*\)tmp="-unknown"$/\1tmp=""/' \ + ${S}/autogen.sh + else + bbwarn "autogen.sh not found in ${S}." + fi +} diff --git a/meta/recipes-support/gnupg/gnupg/0004-autogen.sh-fix-find-version-for-beta-checking.patch b/meta/recipes-support/gnupg/gnupg/0004-autogen.sh-fix-find-version-for-beta-checking.patch deleted file mode 100644 index fc7d964ec4..0000000000 --- a/meta/recipes-support/gnupg/gnupg/0004-autogen.sh-fix-find-version-for-beta-checking.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 4d8cc1982273d571b4e80fe981878d0fa5884236 Mon Sep 17 00:00:00 2001 -From: Wenzong Fan -Date: Wed, 16 Aug 2017 11:23:22 +0800 -Subject: [PATCH] autogen.sh: fix find-version for beta checking - -find-version always assumes that gnupg is beta if autogen.sh is run -out of git-repo. This doesn't work for users whom just take release -tarball and re-run autoconf in their local build dir. - -Upstream-Status: Pending - -Signed-off-by: Wenzong Fan - -Rebase to 2.1.23 -Signed-off-by: Hongxu Jia ---- - autogen.sh | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/autogen.sh b/autogen.sh -index 9f91297..116fb7f 100755 ---- a/autogen.sh -+++ b/autogen.sh -@@ -270,7 +270,6 @@ if [ "$myhost" = "find-version" ]; then - rvd=$((0x$(echo ${rev} | dd bs=1 count=4 2>/dev/null))) - else - ingit=no -- beta=yes - tmp="-unknown" - cid="0000000" - rev="0000000" diff --git a/meta/recipes-support/gnupg/gnupg_2.5.5.bb b/meta/recipes-support/gnupg/gnupg_2.5.5.bb index a30dbac62e..cbf0988953 100644 --- a/meta/recipes-support/gnupg/gnupg_2.5.5.bb +++ b/meta/recipes-support/gnupg/gnupg_2.5.5.bb @@ -13,10 +13,11 @@ DEPENDS = "npth libassuan libksba zlib bzip2 readline libgcrypt" inherit autotools gettext texinfo pkgconfig upstream-version-is-even +require drop-unknown-suffix.inc + UPSTREAM_CHECK_URI = "https://gnupg.org/ftp/gcrypt/gnupg/" SRC_URI = "${GNUPG_MIRROR}/${BPN}/${BPN}-${PV}.tar.bz2 \ file://0002-use-pkgconfig-instead-of-npth-config.patch \ - file://0004-autogen.sh-fix-find-version-for-beta-checking.patch \ file://0001-Woverride-init-is-not-needed-with-gcc-9.patch \ " SRC_URI:append:class-native = " file://0001-configure.ac-use-a-custom-value-for-the-location-of-.patch \