[PATCH v3 0/3] Version fixes and cleanups

STALE3736d

Revision v3 of 2 in this series.

4 messages, 1 author, 2016-06-15 · open the first message on its own page

[PATCH v3 0/3] Version fixes and cleanups

From: Felipe Contreras <hidden>
Date: 2016-06-15 22:58:45

Felipe Contreras (3):
  version-gen: cleanup
  version-gen: avoid messing the version
  build: fix rpm versioning

 GIT-VERSION-GEN | 36 +++++++++++++++++++-----------------
 Makefile        |  2 +-
 2 files changed, 20 insertions(+), 18 deletions(-)

-- 
1.8.4-fc

[PATCH v3 1/3] version-gen: cleanup

From: Felipe Contreras <hidden>
Date: 2016-06-15 22:58:45

No functional changes.

Signed-off-by: Felipe Contreras <redacted>
---
 GIT-VERSION-GEN | 36 ++++++++++++++++++++----------------
 1 file changed, 20 insertions(+), 16 deletions(-)
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index 06026ea..e96538d 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -6,22 +6,29 @@ DEF_VER=v1.8.4
 LF='
 '
 
-# First see if there is a version file (included in release tarballs),
-# then try git-describe, then default.
-if test -f version
-then
-	VN=$(cat version) || VN="$DEF_VER"
-elif test -d ${GIT_DIR:-.git} -o -f .git &&
-	VN=$(git describe --match "v[0-9]*" --abbrev=7 HEAD 2>/dev/null) &&
+describe () {
+	VN=$(git describe --match "v[0-9]*" --abbrev=7 HEAD 2>/dev/null) || return 1
 	case "$VN" in
-	*$LF*) (exit 1) ;;
+	*$LF*)
+		return 1
+		;;
 	v[0-9]*)
 		git update-index -q --refresh
 		test -z "$(git diff-index --name-only HEAD --)" ||
-		VN="$VN-dirty" ;;
+		VN="$VN-dirty"
+		return 0
+		;;
 	esac
+}
+
+# First see if there is a version file (included in release tarballs),
+# then try 'git describe', then default.
+if test -f version
+then
+	VN=$(cat version) || VN="$DEF_VER"
+elif test -d ${GIT_DIR:-.git} -o -f .git && describe
 then
-	VN=$(echo "$VN" | sed -e 's/-/./g');
+	VN=$(echo "$VN" | sed -e 's/-/./g')
 else
 	VN="$DEF_VER"
 fi
@@ -34,9 +41,6 @@ then
 else
 	VC=unset
 fi
-test "$VN" = "$VC" || {
-	echo >&2 "GIT_VERSION = $VN"
-	echo "GIT_VERSION = $VN" >$GVF
-}
-
-
+test "$VN" = "$VC" && exit
+echo >&2 "GIT_VERSION = $VN"
+echo "GIT_VERSION = $VN" >$GVF
-- 
1.8.4-fc

[PATCH v3 3/3] build: fix rpm versioning

From: Felipe Contreras <hidden>
Date: 2016-06-15 22:58:45

The current versioning scheme doesn't work properly:

  git-1.8.4 < git-1.8.4.rc1
  git-1.8.4 < git-1.8.4-rc1
  git-1.8.4 > git-1.8.4~rc1

Since v1.8.4 final is obviously greater than v1.8.4-rc1, we need to use
a tilde so RPM detects it properly as a greater version number.

This works in rpm-4.10, in older versions, a tilde would work as bad as
anything else.

Signed-off-by: Felipe Contreras <redacted>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 3588ca1..7a8bee7 100644
--- a/Makefile
+++ b/Makefile
@@ -2426,7 +2426,7 @@ quick-install-html:
 ### Maintainer's dist rules
 
 git.spec: git.spec.in GIT-VERSION-FILE
-	sed -e 's/@@VERSION@@/$(GIT_VERSION)/g' < $< > $@+
+	sed -e 's/@@VERSION@@/$(subst -,~,$(GIT_VERSION))/g' < $< > $@+
 	mv $@+ $@
 
 GIT_TARNAME = git-$(GIT_VERSION)
-- 
1.8.4-fc

[PATCH v3 2/3] version-gen: avoid messing the version

From: Felipe Contreras <hidden>
Date: 2016-06-15 22:58:46

If the version is 'v1.8.4-rc1' that is the version, and there's no need
to change it to anything else, like 'v1.8.4.rc1'.

If RedHat, or somebody else, needs a specific version, they can use the
'version' file, like everybody else.

Signed-off-by: Felipe Contreras <redacted>
---
 GIT-VERSION-GEN | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index e96538d..19902e9 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -26,10 +26,8 @@ describe () {
 if test -f version
 then
 	VN=$(cat version) || VN="$DEF_VER"
-elif test -d ${GIT_DIR:-.git} -o -f .git && describe
+elif test ! -d ${GIT_DIR:-.git} -a ! -f .git || ! describe
 then
-	VN=$(echo "$VN" | sed -e 's/-/./g')
-else
 	VN="$DEF_VER"
 fi
 
-- 
1.8.4-fc
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help