diff options
author | Michele Calgaro <michele.calgaro@yahoo.it> | 2020-05-04 23:23:46 +0900 |
---|---|---|
committer | Michele Calgaro <michele.calgaro@yahoo.it> | 2020-05-04 23:23:46 +0900 |
commit | c6530389dc31c77360e1b34ef772d956d9c79ad8 (patch) | |
tree | e4e79e407d49bd232d570920a961e090e60c2886 | |
parent | eb3700be2a32c737346b3cc19cce3b50e6a16700 (diff) | |
download | tde-packaging-c6530389dc31c77360e1b34ef772d956d9c79ad8.tar.gz tde-packaging-c6530389dc31c77360e1b34ef772d956d9c79ad8.zip |
DEB build scripts: further improvement to detection of correct scm info when working on detached HEAD.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
-rwxr-xr-x | debian/_buildscripts/local/build_module.sh | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/debian/_buildscripts/local/build_module.sh b/debian/_buildscripts/local/build_module.sh index b037b7d09..f999da0eb 100755 --- a/debian/_buildscripts/local/build_module.sh +++ b/debian/_buildscripts/local/build_module.sh @@ -275,7 +275,10 @@ if [ "$bool_COPY_MOD_SRC" = "y" ]; then echo "# TDE SCM module information" > "$MOD_BUILD_PATH/.tdescminfo" echo "Name: $MOD_NAME" >> "$MOD_BUILD_PATH/.tdescminfo" cd "$MOD_GIT_PATH" - MOD_BRANCH=`git rev-parse --abbrev-ref HEAD | grep -v "no branch" | head -n1` + MOD_BRANCH=`git symbolic-ref -q HEAD | sed "s|^refs/heads/||"` + if [[ -z "$MOD_BRANCH" ]]; then + MOD_BRANCH=`git branch --contains HEAD | egrep -v "no branch|detached" | head -n1 | cut -c 3-` + fi COMMIT_HASH=`git rev-parse HEAD` echo "Revision: $MOD_BRANCH-$COMMIT_HASH" >> "$MOD_BUILD_PATH/.tdescminfo" git log -1 --pretty=format:"DateTime: %cd%n" --date=format:"%m/%d/%Y %H:%M" >> "$MOD_BUILD_PATH/.tdescminfo" @@ -310,7 +313,10 @@ if [ "$bool_EXTRADEP_MOD" != "y" -a "$bool_COPY_PKGING_FILES" = "y" ]; then # Default package name # Calculate package version cd $MOD_GIT_PATH - branch=`git rev-parse --abbrev-ref HEAD | egrep -v "no branch|detached" | head -n1` + branch=`git symbolic-ref -q HEAD | sed "s|^refs/heads/||"` + if [[ -z "$branch" ]]; then + branch=`git branch --contains HEAD | egrep -v "no branch|detached" | head -n1 | cut -c 3-` + fi target_tag=`git tag | grep -F "$TDE_RELEASE" | head -n1` tag=`git tag | \ sed "s|^\([^0-9]\)|\1.|" | sort -t. -k 1,1nr -k 2,2nr -k 3,3nr -k 4,4nr -k 5,5nr | sed "s|^\([^0-9]\)\.|\1|" | \ |