3
import os, re, shutil, time, sys
8
# Various details about the files must also be specified by the rpm
10
spec_template = "dist/duplicity.spec"
12
def CopyMan(input_name, destination, version):
13
"""Create updated man page at the specified location"""
14
fp = open(destination, "w")
15
date = time.strftime("%B %Y", time.localtime(time.time()))
16
version = "Version "+version
17
firstline = ('.TH RDIFFDIR 1 "%s" "%s" "User Manuals"\n' %
20
infp = open(input_name, "r")
27
"""Create FAQ.html and FAQ.wml files from FAQ-body.html"""
28
faqbody_fp = open("FAQ-body.html", "r")
29
faqbody_string = faqbody_fp.read()
32
wml_fp = open("FAQ.wml", "w")
34
"""#include 'template.wml' curpage=faq title="rdiff-backup: FAQ"
40
wml_fp.write(faqbody_string)
41
wml_fp.write("\n</divert>\n")
44
html_fp = open("FAQ.html", "w")
46
"""<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
50
<title>rdiff-backup FAQ</title>
54
<h1>rdiff-backup FAQ</h1>
56
html_fp.write(faqbody_string)
57
html_fp.write("\n</body></html>")
60
def VersionedCopy(source, dest):
61
"""Copy source to dest, substituting $version with version"""
62
fin = open(source, "rb")
64
assert not fin.close()
66
outbuf = re.sub("\$version", Version, inbuf, 1)
67
if outbuf == inbuf: assert 0, "No $version string replaced"
68
assert not re.search("\$version", outbuf), \
69
"Two $version strings found in the same file %s" % (source,)
71
fout = open(dest, "wb")
73
assert not fout.close()
76
"""Create rdiff-backup tar file"""
77
tardir = "duplicity-%s" % Version
78
tarfile = "duplicity-%s.tar.gz" % Version
81
os.system("rm -rf " + tardir)
84
for filename in ["COPYING", "README", "CHANGELOG",
85
SourceDir + "/_librsyncmodule.c",
86
DistDir + "/setup.py"]:
87
assert not os.system("cp %s %s" % (filename, tardir)), filename
89
os.mkdir(tardir+"/src")
91
for filename in ["backends.py", "collections.py", "commandline.py",
92
"diffdir.py", "dup_temp.py", "dup_time.py",
93
"file_naming.py", "globals.py",
94
"GnuPGInterface.py", "gpg.py", "__init__.py",
95
"lazy.py", "librsync.py", "log.py",
96
"manifest.py", "misc.py", "patchdir.py",
97
"path.py", "robust.py", "selection.py",
98
"static.py", "tarfile.py"]:
99
assert not os.system("cp %s/%s %s/src" %
100
(SourceDir, filename, tardir)), filename
102
VersionedCopy("%s/globals.py" % (SourceDir,),
103
"%s/src/globals.py" % (tardir,))
104
VersionedCopy("duplicity-bin", "%s/duplicity" % (tardir,))
105
VersionedCopy("rdiffdir", "%s/rdiffdir" % (tardir,))
106
VersionedCopy(DistDir + "/setup.py", "%s/setup.py" % (tardir,))
108
os.chmod(os.path.join(tardir, "setup.py"), 0755)
109
os.chmod(os.path.join(tardir, "rdiffdir"), 0644)
110
CopyMan("rdiffdir.1", os.path.join(tardir, "rdiffdir.1"), Version)
111
CopyMan("duplicity.1", os.path.join(tardir, "duplicity.1"), Version)
112
os.system("tar -cvzf %s %s" % (tarfile, tardir))
113
shutil.rmtree(tardir)
117
"""Create spec file using spec template"""
118
specfile = "duplicity-%s-1.spec" % Version
119
VersionedCopy(spec_template, specfile)
125
print "Processing version " + Version
127
print "Made tar file " + tarfile
128
specfile = MakeSpecFile()
129
print "Made specfile ", specfile
131
if __name__ == "__main__" and not globals().has_key('__no_execute__'):
132
if len(sys.argv) != 2:
133
print "Syntax: makedist [version_number]"
135
Version = sys.argv[1]