diff mbox series

[1/9] drop-unknown-suffix.bbclass: add class for removing unknown suffix in version

Message ID 20250701154731.1465906-2-yi.zhao@windriver.com
State New
Headers show
Series fix runtime versions | expand

Commit Message

Yi Zhao July 1, 2025, 3:47 p.m. UTC
This class 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 calss modifies autogen.sh to:
1. Replace beta=yes with beta=no
2. Replace tmp="-unknown" with tmp=""

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
---
 .../drop-unknown-suffix.bbclass               | 29 +++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 meta/classes-recipe/drop-unknown-suffix.bbclass

Comments

Richard Purdie July 1, 2025, 6:19 p.m. UTC | #1
On Tue, 2025-07-01 at 23:47 +0800, Yi Zhao via lists.openembedded.org
wrote:
> This class 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 calss modifies autogen.sh to:
> 1. Replace beta=yes with beta=no
> 2. Replace tmp="-unknown" with tmp=""
> 
> Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
> ---
>  .../drop-unknown-suffix.bbclass               | 29
> +++++++++++++++++++
>  1 file changed, 29 insertions(+)
>  create mode 100644 meta/classes-recipe/drop-unknown-suffix.bbclass
> 
> diff --git a/meta/classes-recipe/drop-unknown-suffix.bbclass
> b/meta/classes-recipe/drop-unknown-suffix.bbclass
> new file mode 100644
> index 0000000000..78707adecb
> --- /dev/null
> +++ b/meta/classes-recipe/drop-unknown-suffix.bbclass
> @@ -0,0 +1,29 @@
> +#
> +# Copyright OpenEmbedded Contributors
> +#
> +# SPDX-License-Identifier: MIT
> +#
> +
> +#
> +# This class 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 calss 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
> +}

This is the right direction, my only question was on naming and
location. A bbclass is meant to be fairly generic and I'd suggest this
just be a .inc file, probably as something like meta/recipes-
support/gnupg/drop-unknown-suffix.inc which the other recipes could
then require?

Cheers,

Richard
diff mbox series

Patch

diff --git a/meta/classes-recipe/drop-unknown-suffix.bbclass b/meta/classes-recipe/drop-unknown-suffix.bbclass
new file mode 100644
index 0000000000..78707adecb
--- /dev/null
+++ b/meta/classes-recipe/drop-unknown-suffix.bbclass
@@ -0,0 +1,29 @@ 
+#
+# Copyright OpenEmbedded Contributors
+#
+# SPDX-License-Identifier: MIT
+#
+
+#
+# This class 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 calss 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
+}