summaryrefslogtreecommitdiffstats
blob: c98863db42b628cf16681bad62f2f8afb94cd32f (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
#!/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 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)" + " unstable; 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()