Allow specifying the base commit and version in the configuration file
authorIstván Váradi <ivaradi@varadiistvan.hu>
Wed, 25 Mar 2020 18:13:07 +0000 (19:13 +0100)
committerIstván Váradi <ivaradi@varadiistvan.hu>
Mon, 27 Apr 2020 17:20:30 +0000 (19:20 +0200)
Signed-off-by: István Váradi <ivaradi@varadiistvan.hu>
admin/linux/debian/drone-build.sh
admin/linux/debian/scripts/git2changelog.cfg
admin/linux/debian/scripts/git2changelog.py

index 209bb20161bcf6a99b7034bb9f77eb874585c890..f141ef93816a27e1c7832661d9ccbffd9f2d2f95 100755 (executable)
@@ -71,7 +71,8 @@ for distribution in ${UBUNTU_DISTRIBUTIONS} ${DEBIAN_DISTRIBUTIONS}; do
     git merge ${DRONE_COMMIT}
 
     admin/linux/debian/scripts/git2changelog.py /tmp/tmpchangelog ${distribution} ${revdate}
-    cp /tmp/tmpchangelog debian/changelog
+    cat /tmp/tmpchangelog debian/changelog > debian/changelog.new
+    mv debian/changelog.new debian/changelog
 
     fullver=`head -1 debian/changelog | sed "s:nextcloud-desktop (\([^)]*\)).*:\1:"`
 
index 3a5158cc38e8d11789366ef89645dbc5f154942b..0ba49ea968fc1ac3b6049f407a152f321b9c143d 100644 (file)
@@ -6,3 +6,7 @@
 [versionhack]
 commit = bc7e65b39552ac458b2adacf76cbf98735ec29a0
 tag = v2.4.0-beta
+
+[base]
+commit = 56222de768e3def4d504b3f9832d8598b1ec2043
+version = 2.7.0
index 3cc9c41517fbc1f24529ba415c866c23e9aeb291..c2b9114dc5f3de93e7840a644b36a2497ee4782a 100755 (executable)
@@ -48,22 +48,17 @@ def getCommitVersion(commit):
     except:
         return None
 
-def collectEntries(baseCommit, baseVersion, kind, finalRevDate):
-    scriptdir = os.path.dirname(__file__)
-    configPath = os.path.join(scriptdir, "git2changelog.cfg")
+def collectEntries(baseCommit, baseVersion, kind, finalRevDate, config):
 
     newVersionCommit = None
     newVersionTag = None
     newVersionOrigTag = None
 
-    if os.path.exists(configPath):
-        config = ConfigParser.SafeConfigParser()
-        config.read(configPath)
-        if config.has_section("versionhack"):
-            if config.has_option("versionhack", "commit") and \
-               config.has_option("versionhack", "tag"):
-                newVersionCommit = config.get("versionhack", "commit")
-                newVersionTag = config.get("versionhack", "tag")
+    if config is not None and config.has_section("versionhack"):
+        if config.has_option("versionhack", "commit") and \
+           config.has_option("versionhack", "tag"):
+            newVersionCommit = config.get("versionhack", "commit")
+            newVersionTag = config.get("versionhack", "tag")
 
     entries = []
 
@@ -153,13 +148,27 @@ def genChangeLogEntries(f, entries, distribution):
     return (latestBaseVersion, latestRevDate, latestKind)
 
 if __name__ == "__main__":
+    scriptdir = os.path.dirname(__file__)
+    configPath = os.path.join(scriptdir, "git2changelog.cfg")
+
+    baseCommit = "f9b1c724d6ab5431e0cd56b7cd834f2dd48cebb1"
+    baseVersion = "2.4.0"
+
+    config = None
+    if os.path.exists(configPath):
+        config = ConfigParser.SafeConfigParser()
+        config.read(configPath)
+
+        if config.has_section("base"):
+            if config.has_option("base", "commit") and \
+               config.has_option("base", "version"):
+                baseCommit = config.get("base", "commit")
+                baseVersion = config.get("base", "version")
 
     distribution = sys.argv[2]
     finalRevDate = sys.argv[3] if len(sys.argv)>3 else None
 
-    #entries = collectEntries("8aade24147b5313f8241a8b42331442b7f40eef9", "2.2.4", "release")
-    entries = collectEntries("f9b1c724d6ab5431e0cd56b7cd834f2dd48cebb1",
-                             "2.4.0", "beta", finalRevDate)
+    entries = collectEntries(baseCommit, baseVersion, "alpha", finalRevDate, config)
 
     with open(sys.argv[1], "wt") as f:
         (baseVersion, revdate, kind) = genChangeLogEntries(f, entries, distribution)