summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZach DeCook <zachdecook@librem.one>2024-06-15 07:12:43 -0400
committerKieran Bingham <kieran.bingham@ideasonboard.com>2024-07-25 09:57:54 +0100
commita61241eb8b9ff583d8c04773927f5460b3e83a01 (patch)
treeafde7b5da5335b10472870dec75f28a3795ccdef
parent04f1f2033724f038ab1152e8135292770a33f97a (diff)
utils: gen-version: Use posix compliant date
The version string of libcamera is presently appended with a date/time argument in the case of a dirty tree to show further detail of when it was built. This string is generated with the iso-8601 parameter to 'date' and produces a date string in the form: "2024-06-17T22:15:30+01:00" Strict posix shells or implementations of 'date' which may be optimised for size such as the one provided by busybox or Alpine Linux may not support the '--iso-8601' flag. To support builds on those platforms, use a direct POSIX-compliant date-format string instead matching as closely as possible to the iso-8601 definition. An exact match is not possible with those restrictions so 'date %Y-%m-%dT%H:%M:%S%Z' is used which produces 2024-06-17T22:15:30BST. The use of the human readable timezone identifier provides a friendlier output for the string than a timezone offset at the expense of being less sortable in the exceptionally low risk and unlikely event of two custom builds being compared at the same time of different timezones. Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Zach DeCook <zachdecook@librem.one> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
-rwxr-xr-xutils/gen-version.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/utils/gen-version.sh b/utils/gen-version.sh
index e1f7ca7b..1b818e9e 100755
--- a/utils/gen-version.sh
+++ b/utils/gen-version.sh
@@ -42,7 +42,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 ($(date --iso-8601=seconds))"
+git diff-index --quiet HEAD || version="$version-dirty ($(date +%Y-%m-%dT%H:%M:%S%Z))"
# If a project version is provided, use it to replace the version number.
if [ -n "$project_version" ]