From ed3fbf8743f87ba702e152ec2ea2351970f37ad4 Mon Sep 17 00:00:00 2001 From: Peter Colledge Date: Wed, 15 Nov 2023 17:11:09 +0000 Subject: [PATCH] cleanup: Use short git digest in onload_mkdist --- scripts/lib/mkdist/preprocess_source | 2 +- scripts/onload_mkdist | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/lib/mkdist/preprocess_source b/scripts/lib/mkdist/preprocess_source index 2bc282784..57004137c 100644 --- a/scripts/lib/mkdist/preprocess_source +++ b/scripts/lib/mkdist/preprocess_source @@ -68,7 +68,7 @@ update_product_strings() { # This is a wrapper around the various preprocessing stages for environments # with appropriately-defined global variables. preprocess_source() { - [ -n "$src_rev" ] || src_rev=$(cd "$TOP" && "$git" rev-parse HEAD) + [ -n "$src_rev" ] || src_rev=$(cd "$TOP" && "$git" rev-parse --short=7 HEAD) copy_distfiles "$distfiles_d" update_readme_strings "$product" "$version" "$src_rev" diff --git a/scripts/onload_mkdist b/scripts/onload_mkdist index 6a7b8b78e..aa9385dc1 100755 --- a/scripts/onload_mkdist +++ b/scripts/onload_mkdist @@ -81,7 +81,7 @@ git=${GIT_PATH:-"git"} while [ $# -gt 0 ]; do case "$1" in --version) shift; version="$1";; - --srcrev) shift; src_rev="$1";; + --srcrev) shift; src_rev="${1:0:7}";; --release) release=true;; --product) shift; Product="$1";; --cloud) cloud=true;; @@ -107,8 +107,10 @@ TOP=$("$bin/mmaketool" --toppath) if [ -z "$version" ]; then if $release; then version=$(date '+%Y%m%d') + elif [ -n "$src_rev" ]; then + version="$src_rev" else - version=$(cd "$TOP" && "$git" rev-parse HEAD) + version=$(cd "$TOP" && "$git" rev-parse --short=7 HEAD) [ -z "$version" ] && fail "ERROR: Could not find HEAD revision" fi fi