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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
#!/usr/bin/env python3
import subprocess
import argparse
import sys
import os
parser = argparse.ArgumentParser()
parser.add_argument("--debemail", required = True)
parser.add_argument("--package", required = True)
parser.add_argument("--newversion", required = True)
parser.add_argument("--description", default = "Software and firmware for Cryptech Alpha development board.")
parser.add_argument("--conflicts", default = "")
args = parser.parse_args()
if os.path.exists("debian/control") and os.path.exists("debian/changelog"):
sys.exit(0)
control_template= '''\
Source: {args.package}
Maintainer: {args.debemail}
Section: misc
Priority: optional
Standards-Version: 3.9.6
Build-Depends: debhelper (>= 9),
dh-python,
python3-yaml,
python3
Homepage: http://trac.cryptech.is/wiki
Package: {args.package}
Architecture: any
Depends: python3,
python3-serial (>= 3.0),
python3-tornado (>= 4.0),
python3-pycryptodome,
${{misc:Depends}},
${{python3:Depends}},
${{shlibs:Depends}}
{conflicts}\
Description: Cryptech Project open-source cryptographic software and firmware.
{args.description}
'''
if args.conflicts:
conflicts = "Conflicts: {}\n".format(", ".join(args.conflicts.split()))
else:
conflicts = ""
subprocess.check_call(("dch", "--create", "--package", args.package, "--newversion", args.newversion, args.description),
env = dict(os.environ,
EDITOR = "/bin/true",
VISUAL = "/bin/true",
TZ = "UTC",
DEBEMAIL = args.debemail))
with open("debian/control", "w") as f:
f.write(control_template.format(args = args, conflicts = conflicts))
with open("cryptech_version.py", "w") as f:
f.write("VERSION = '{}'\n".format(args.newversion))
|