diff options
Diffstat (limited to 'debian/_buildscripts/local/build_module.sh')
-rwxr-xr-x | debian/_buildscripts/local/build_module.sh | 51 |
1 files changed, 28 insertions, 23 deletions
diff --git a/debian/_buildscripts/local/build_module.sh b/debian/_buildscripts/local/build_module.sh index 94fdab76a..c20661ad5 100755 --- a/debian/_buildscripts/local/build_module.sh +++ b/debian/_buildscripts/local/build_module.sh @@ -197,6 +197,7 @@ if [ "${bool_BUILD_FROM_PATH}" = "y" ]; then else MOD_NAME=`basename "${MOD_PATH}"` fi +echo "${MOD_NAME}" if [ "${MOD_NAME}" != "" -a "${MOD_NAME}" != "tde" -a "${MOD_NAME}" != ".git" ]; then # Valid git module if [[ "${MOD_PATH}" =~ ${TDE_BUILD_DIR} ]]; then @@ -309,6 +310,31 @@ if [ -d "$MOD_BUILD_PATH" ]; then $SUDO_CMD rm *.deb *.dsc *.changes *.tar.bz2 *.tar.gz *.tar.xz *.log *.buildinfo &>/dev/null fi +# calculate package version, if needed +if [ "$bool_EXTRADEP_MOD" != "y" ]; then + cd $MOD_GIT_PATH + 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|" | \ + while read t; do \ + git branch --contains $t | cut -c 3- | grep -x "$branch" >/dev/null && \ + echo "$t..HEAD" && break; done` + count=`git log $tag --pretty=oneline | wc -l` + pkgver=$TDE_RELEASE + if [[ "$count" -gt 0 ]] || [[ -z "$target_tag" ]]; then + pkgver=$pkgver~pre$count+$(git rev-parse HEAD | cut -c 1-8) + fi + 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` +fi + # copy main repo source files, if needed if [ "$bool_COPY_MOD_SRC" = "y" ]; then bool_COPY_PKGING_FILES="y" @@ -319,12 +345,7 @@ if [ "$bool_COPY_MOD_SRC" = "y" ]; then # Add GIT information echo "# TDE SCM module information" > "$MOD_BUILD_PATH/.tdescminfo" echo "Name: $MOD_NAME" >> "$MOD_BUILD_PATH/.tdescminfo" - cd "$MOD_GIT_PATH" - 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 "Version: R$pkgver" >> "$MOD_BUILD_PATH/.tdescminfo" 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" else @@ -355,23 +376,7 @@ if [ "$bool_EXTRADEP_MOD" != "y" -a "$bool_COPY_PKGING_FILES" = "y" ]; then cp -R "$MOD_GIT_PKGING_PATH" "$MOD_BUILD_PKGING_PATH" # Default package name - # Calculate package version - cd $MOD_GIT_PATH - 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|" | \ - while read t; do \ - git branch --contains $t | cut -c 3- | grep -x "$branch" >/dev/null && \ - echo "$t..HEAD" && break; done` - count=`git log $tag --pretty=oneline | wc -l` - package=$(basename $PWD)-trinity-$TDE_RELEASE - if [[ "$count" -gt 0 ]] || [[ -z "$target_tag" ]]; then - package=$package~pre$count+$(git rev-parse HEAD | cut -c 1-8) - fi + package=$(basename $PWD)-trinity-$pkgver REL=4:$TDE_RELEASE${package#*$TDE_RELEASE} REL=${REL%+*} REL=${REL/4:14.0.0/4:14.0.0-s} |