[libcamera-devel] meson: Rewrite .replace usage
diff mbox series

Message ID 20221014164630.2847301-1-kieran.bingham@ideasonboard.com
State Accepted
Commit 02518e598e8f057b76a08940e1bc8a99d879fad6
Headers show
Series
  • [libcamera-devel] meson: Rewrite .replace usage
Related show

Commit Message

Kieran Bingham Oct. 14, 2022, 4:46 p.m. UTC
Meson introduces a .replace() method in version 0.58.0. However we aim
to restrict ourselves to 0.56 meson features, as released by Debian
stable.

The recent introduction of release management infrastructure makes use
of the .replace() method to fix up the version string when there is a
mis-match between the release version and any (lack) of tags in the git
version description. This breaks when built on systems with only meson
0.56.

Refactor this to use a concatenation of the project version and a
stripped git version to regenerate the full source version string that
will be reported by libcamera.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
---
 meson.build | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Laurent Pinchart Oct. 14, 2022, 5:34 p.m. UTC | #1
Hi Kieran,

Thank you for the patch.

On Fri, Oct 14, 2022 at 05:46:30PM +0100, Kieran Bingham via libcamera-devel wrote:
> Meson introduces a .replace() method in version 0.58.0. However we aim

s/introduces/introduced/

> to restrict ourselves to 0.56 meson features, as released by Debian
> stable.
> 
> The recent introduction of release management infrastructure makes use
> of the .replace() method to fix up the version string when there is a
> mis-match between the release version and any (lack) of tags in the git
> version description. This breaks when built on systems with only meson
> 0.56.
> 
> Refactor this to use a concatenation of the project version and a
> stripped git version to regenerate the full source version string that
> will be reported by libcamera.
> 
> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  meson.build | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/meson.build b/meson.build
> index 56910698988d..f218b8c2b296 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -38,8 +38,10 @@ if libcamera_version != meson.project_version()
>              },
>              bool_yn : true, section : 'Versions')
>  
> -    libcamera_git_version = libcamera_git_version.replace(libcamera_version,
> -                                                          meson.project_version())
> +    # Replace the version components reported by git with the release version,
> +    # but keep all trailing information supplied by git.
> +    libcamera_git_version = (meson.project_version() +
> +                             libcamera_git_version.strip(libcamera_version))
>      libcamera_version = meson.project_version()
>  
>      # Append a marker to show we have modified this version string

Patch
diff mbox series

diff --git a/meson.build b/meson.build
index 56910698988d..f218b8c2b296 100644
--- a/meson.build
+++ b/meson.build
@@ -38,8 +38,10 @@  if libcamera_version != meson.project_version()
             },
             bool_yn : true, section : 'Versions')
 
-    libcamera_git_version = libcamera_git_version.replace(libcamera_version,
-                                                          meson.project_version())
+    # Replace the version components reported by git with the release version,
+    # but keep all trailing information supplied by git.
+    libcamera_git_version = (meson.project_version() +
+                             libcamera_git_version.strip(libcamera_version))
     libcamera_version = meson.project_version()
 
     # Append a marker to show we have modified this version string