[libcamera-devel] [PATCH] libcamera: Add build time to version string

Niklas Söderlund niklas.soderlund at ragnatech.se
Wed Aug 5 20:41:48 CEST 2020


Hi,

On 2020-08-05 17:47:05 +0300, Laurent Pinchart wrote:
> Hi Kieran,
> 
> On Wed, Aug 05, 2020 at 03:34:01PM +0100, Kieran Bingham wrote:
> > On 05/08/2020 15:29, Laurent Pinchart wrote:
> > > On Wed, Aug 05, 2020 at 02:57:00PM +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.
> > >>
> > >> 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>
> > > 
> > > This will get in the way of reproducible builds, especially for tagged
> > > releases. I would at least restrict this feature to dirty builds, and
> > > even then, I'll let Kieran comment on whether reproducible builds are
> > > important.
> > 
> > I think I recall determining that reproducible builds were already
> > broken due to the way meson handles RPATH/RUNPATH.
> > 
> > I too frequently use the version string to make sure I am running the
> > same code I expect, and having a build-time stamp in there (for debug)
> > builds would be quite nice.
> > 
> > Restricting this to DEBUG builds might be quite nice, then release
> > builds from packagers just get a clean version.
> > 
> > Adding only for release builds also removes any worries of reproducible
> > builds from the equation anyway ;-)
> 
> Would adding a timestamp for dirty builds be more generic ? Presumably
> if the working tree is clean you don't need to differentiate between
> different builds with the same commti sha1, as they should all be the
> same :-)

I like his, the timestamp is only really useful for dirty builds, will 
send a v2.

> 
> > >> ---
> > >>  utils/gen-version.sh | 4 +++-
> > >>  1 file changed, 3 insertions(+), 1 deletion(-)
> > >>
> > >> diff --git a/utils/gen-version.sh b/utils/gen-version.sh
> > >> index 7f7872ceba7b038a..93bc97d6d8a8a24a 100755
> > >> --- a/utils/gen-version.sh
> > >> +++ b/utils/gen-version.sh
> > >> @@ -32,4 +32,6 @@ git diff-index --quiet HEAD || version="$version-dirty"
> > >>  # of the git SHA1 and remove the initial 'v'.
> > >>  version=$(echo "$version" | sed -e 's/-/+/' | sed -e 's/-g/-/' | cut -c 2-)
> > >>  
> > >> -echo "$version"
> > >> +buildtime=$(date --iso-8601=seconds --utc)
> > >> +
> > >> +echo "$version $buildtime"
> 
> -- 
> Regards,
> 
> Laurent Pinchart

-- 
Regards,
Niklas Söderlund


More information about the libcamera-devel mailing list