summaryrefslogtreecommitdiffstats
blob: d7e1f1b266f8726c96f7738f43da3e6b79650030 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env python

import sys, re, email.utils

assert(len(sys.argv) == 3)

version = sys.argv[2]

changelog = open(sys.argv[1])
last_version_line = changelog.readline()
changelog.close()

project = ""
last_version = ""
m = re.match("([\w-]+) \((.*)-\d+\)", last_version_line)
if m :
    project = m.group(1)
    last_version = m.group(2)

if project == "" :
    project="swift-im"

if "dev" in version or "alpha" in version :
    distribution = "development"
elif "beta" in version or "rc" in version :
    distribution = "beta development"
else :
    distribution = "release beta development"

if last_version != version :
    changelog = open(sys.argv[1])
    changelog_data = changelog.read()
    changelog.close()
    changelog = open(sys.argv[1], "w")
    changelog.write(project + " (" + version + "-1)" + " " + distribution + "; urgency=low\n\n")
    changelog.write("  * Upstream development snapshot\n\n")
    changelog.write(" -- Swift Package Maintainer <packages@swift.im>  " + email.utils.formatdate() + "\n")
    changelog.write("\n")
    changelog.write(changelog_data)
    changelog.close()