Imported Upstream version 15.0.0
[platform/upstream/libzypp.git] / mkChangelog
index 79476b9..82ba368 100755 (executable)
@@ -84,10 +84,18 @@ function getversion() {
     printf "LAST_COMPAT='%s'\n", lastcompat
     printf "THIS_RELEASE='%s'\n", major"."minor"."patch
     printf "THIS_COMPAT='%s'\n", compatminor
+    printf "THIS_MINOR='%s'\n", minor
+    printf "THIS_PATCH='%s'\n", patch
   }
   '
 }
 
+function setversion() {
+  local KEY="$1"
+  local VAL="$2"
+  sed -i "s/^ *SET *( *${KEY} .*/SET(${KEY} \"${VAL}\")/" "$VERSIONFILE"
+}
+
 function sameVersion() {
   test "$LAST_RELEASE" == "$THIS_RELEASE" -a "$LAST_COMPAT" == "$THIS_COMPAT"
 }
@@ -127,7 +135,7 @@ git status --porcelain | grep '^[^ ?]' | grep -v "$VERSIONFILE\|$CHANGESFILE" &&
 
 # A tag for $LAST_RELEASE must exist!
 eval $(getversion)
-test -e ".git/refs/tags/$LAST_RELEASE" || {
+git rev-parse -q --verify "$LAST_RELEASE" >/dev/null || {
   Recho "!!!"
   Recho "!!! There is no LAST_RELEASE tag '$LAST_RELEASE'. Check manually. "
   Recho "!!! (git tag -m 'tagging $LAST_RELEASE' '$LAST_RELEASE' ?commit?)"
@@ -153,7 +161,7 @@ while true; do
   sameVersion && {
     newchangesentry
     Becho "!!! Version is unchanged at $LAST_RELEASE ($LAST_COMPAT)."
-    read -n 1 -p "$(Gecho "(a)bort, (c)ontinue, (e)dit version [e]: ")" RES
+    read -n 1 -p "$(Gecho "(a)bort, (c)ontinue, (P) patch, (M) minor, (I) incompat minor, (e)dit version [e]: ")" RES
     echo
     case "${RES:-e}" in
       [eE]*)
@@ -165,6 +173,24 @@ while true; do
        Becho "!!! Leave $VERSIONFILE untouched"
        break
        ;;
+      [P])
+       setversion LIBZYPP_PATCH $(($THIS_PATCH + 1))
+       eval $(getversion)
+       continue
+       ;;
+      [M])
+       setversion LIBZYPP_MINOR $(($THIS_MINOR + 1))
+       setversion LIBZYPP_PATCH 0
+       eval $(getversion)
+       continue
+       ;;
+      [I])
+       setversion LIBZYPP_COMPATMINOR $(($THIS_MINOR + 1))
+       setversion LIBZYPP_MINOR $(($THIS_MINOR + 1))
+       setversion LIBZYPP_PATCH 0
+       eval $(getversion)
+       continue
+       ;;
       *)
        errexit "aborted"
        ;;