[libcamera-devel] [PATCH v2] libcamera: Add build time to version string for dirty builds

Laurent Pinchart laurent.pinchart at ideasonboard.com
Wed Aug 5 21:23:40 CEST 2020


Hi Niklas,

Thank you for the patch.

On Wed, Aug 05, 2020 at 08:47:38PM +0200, Niklas Söderlund wrote:
> Having the build time in the version string is useful when building from
> a dirty worktree and deploying to targets as a quick way to identify the
> binary have been deployed successfully.

s/have/has/

> 
> Before this change the version string is reported as
> 
>     libcamera v0.0.0+1692-aaff196a-dirty
> 
> While with this change the version string is reported as
> 
>     libcamera v0.0.0+1692-aaff196a-dirty 2020-08-05T12:55:11+00:00
> 
> Signed-off-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
> ---
>  utils/gen-version.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/utils/gen-version.sh b/utils/gen-version.sh
> index 7f7872ceba7b038a..7536429c25bf3f18 100755
> --- a/utils/gen-version.sh
> +++ b/utils/gen-version.sh
> @@ -26,7 +26,7 @@ if [ -z "$build_dir" ] || (echo "$build_dir" | grep -q "$src_dir")
>  then
>  	git update-index --refresh > /dev/null 2>&1
>  fi
> -git diff-index --quiet HEAD || version="$version-dirty"
> +git diff-index --quiet HEAD || version="$version-dirty $(date --iso-8601=seconds --utc)"

I'd go for

git diff-index --quiet HEAD || version="$version-dirty ($(date --iso-8601=seconds --utc))"

and maybe we should go for local timestamps as it makes it easier to
compare them to the wall clock without having to mentally handle the TZ
offset. Unless your wall clock is in UTC of course :-)

With or without the time zone change,

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

>  # Replace first '-' with a '+' to denote build metadata, strip the 'g' in from
>  # of the git SHA1 and remove the initial 'v'.

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list