summaryrefslogtreecommitdiff
path: root/rdiff-backup/dist
diff options
context:
space:
mode:
authorben <ben@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2002-06-25 18:02:55 +0000
committerben <ben@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2002-06-25 18:02:55 +0000
commita8e880f1ad9cf62dc8b02fa60543b8925c10a846 (patch)
tree2d065aaf54375616a194033bbff4f5cd900b6048 /rdiff-backup/dist
parent8bf34ec866466cacb7c5738ea9a6c522a56f0384 (diff)
downloadrdiff-backup-a8e880f1ad9cf62dc8b02fa60543b8925c10a846.tar.gz
Futher distribution file improvements
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@144 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
Diffstat (limited to 'rdiff-backup/dist')
-rwxr-xr-xrdiff-backup/dist/makedist90
-rw-r--r--rdiff-backup/dist/rdiff-backup.spec11
-rwxr-xr-xrdiff-backup/dist/setup.py33
3 files changed, 59 insertions, 75 deletions
diff --git a/rdiff-backup/dist/makedist b/rdiff-backup/dist/makedist
index b7430ab..3f57762 100755
--- a/rdiff-backup/dist/makedist
+++ b/rdiff-backup/dist/makedist
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-import os, re, shutil, time
+import os, re, shutil, time, sys
SourceDir = "src"
DistDir = "dist"
@@ -8,14 +8,7 @@ DistDir = "dist"
# Various details about the files must also be specified by the rpm
# spec template.
spec_template = "dist/rdiff-backup.spec"
-redhat_spec_template = "dist/rdiff-backup.rh7x.spec"
-
-def GetVersion():
- """Return version string by reading in ./rdiff-backup"""
- fp = open("rdiff-backup", "r")
- match = re.search("Version (.*?) ", fp.read())
- fp.close()
- return match.group(1)
+#redhat_spec_template = "dist/rdiff-backup.rh7x.spec"
def CopyMan(destination, version):
"""Create updated man page at the specified location"""
@@ -65,64 +58,77 @@ def MakeFAQ():
html_fp.write("\n</body></html>")
html_fp.close()
-def MakeTar(version):
+def VersionedCopy(source, dest):
+ """Copy source to dest, substituting $version with version"""
+ fin = open(source, "rb")
+ inbuf = fin.read()
+ assert not fin.close()
+
+ outbuf = re.sub("\$version", Version, inbuf, 1)
+ if outbuf == inbuf: assert 0, "No $version string replaced"
+ assert not re.search("\$version", outbuf), \
+ "Two $version strings found in the same file %s" % (source,)
+
+ fout = open(dest, "wb")
+ fout.write(outbuf)
+ assert not fout.close()
+
+def MakeTar():
"""Create rdiff-backup tar file"""
- tardir = "rdiff-backup-%s" % version
- tarfile = "rdiff-backup-%s.tar.gz" % version
+ tardir = "rdiff-backup-%s" % Version
+ tarfile = "rdiff-backup-%s.tar.gz" % Version
try:
os.lstat(tardir)
os.system("rm -rf " + tardir)
except OSError: pass
os.mkdir(tardir)
- for filename in ["rdiff-backup", "CHANGELOG", "COPYING",
- "README", "FAQ.html", SourceDir + "/cmodule.c",
- DistDir + "/setup.py"]:
+ for filename in ["CHANGELOG", "COPYING", "README", "FAQ.html",
+ SourceDir + "/cmodule.c", DistDir + "/setup.py"]:
assert not os.system("cp %s %s" % (filename, tardir)), filename
os.mkdir(tardir+"/rdiff_backup")
for filename in ["connection.py", "destructive_stepping.py",
- "FilenameMapping.py", "Globals.py", "Hardlink.py",
+ "FilenameMapping.py", "Hardlink.py",
"highlevel.py", "increment.py", "__init__.py",
"iterfile.py", "lazy.py", "log.py", "Main.py",
- "manage.py", "MiscStats.py", "Rdiff.py", "restore.py",
- "rlist.py", "robust.py", "rorpiter.py", "rpath.py",
- "selection.py", "SetConnections.py", "static.py",
+ "manage.py", "MiscStats.py", "Rdiff.py",
+ "restore.py", "rlist.py", "robust.py",
+ "rorpiter.py", "rpath.py", "selection.py",
+ "SetConnections.py", "static.py",
"statistics.py", "Time.py"]:
assert not os.system("cp %s/%s %s/rdiff_backup" %
(SourceDir, filename, tardir)), filename
+
+ VersionedCopy("%s/Globals.py" % (SourceDir,),
+ "%s/rdiff_backup/Globals.py" % (tardir,))
+ VersionedCopy("rdiff-backup", "%s/rdiff-backup" % (tardir,))
+
os.chmod(os.path.join(tardir, "setup.py"), 0755)
os.chmod(os.path.join(tardir, "rdiff-backup"), 0755)
- CopyMan(os.path.join(tardir, "rdiff-backup.1"), version)
+ CopyMan(os.path.join(tardir, "rdiff-backup.1"), Version)
os.system("tar -cvzf %s %s" % (tarfile, tardir))
shutil.rmtree(tardir)
return tarfile
-def MakeSpecFile(version):
+def MakeSpecFile():
"""Create spec file using spec template"""
- def helper(spec_template, specfile):
- """Added now that there are special redhat rpms"""
- outfp = open(specfile, "w")
- outfp.write("Version: %s\n" % version)
- infp = open(spec_template, "r")
- outfp.write(infp.read())
- infp.close()
- outfp.close()
-
- specfile = "rdiff-backup-%s-1.spec" % version
- redhat_specfile = "rdiff-backup-%s-1.rh7x.spec" % version
- helper(spec_template, specfile)
- helper(redhat_spec_template, redhat_specfile)
- return (specfile, redhat_specfile)
+ specfile = "rdiff-backup-%s-1.spec" % Version
+ VersionedCopy(spec_template, specfile)
+ return specfile
def Main():
- version = GetVersion()
print "Making FAQ"
MakeFAQ()
- print "Processing version " + version
- tarfile = MakeTar(version)
+ print "Processing version " + Version
+ tarfile = MakeTar()
print "Made tar file " + tarfile
- specfiles = MakeSpecFile(version)
- print "Made specfiles %s and %s" % specfiles
-
-if __name__ == "__main__": Main()
+ specfile = MakeSpecFile()
+ print "Made specfile ", specfile
+
+if __name__ == "__main__" and not globals().has_key('__no_execute__'):
+ if len(sys.argv) != 2:
+ print "Syntax: makedist [version_number]"
+ sys.exit(1)
+ Version = sys.argv[1]
+ Main()
diff --git a/rdiff-backup/dist/rdiff-backup.spec b/rdiff-backup/dist/rdiff-backup.spec
index b587ea9..5c73166 100644
--- a/rdiff-backup/dist/rdiff-backup.spec
+++ b/rdiff-backup/dist/rdiff-backup.spec
@@ -1,3 +1,4 @@
+Version: $version
Summary: Convenient and transparent local/remote incremental mirror/backup
Name: rdiff-backup
Release: 1
@@ -25,19 +26,17 @@ differences from the previous backup will be transmitted.
%setup
%build
-./setup.py build
+python2 setup.py build
%install
-./setup.py install --prefix=$RPM_BUILD_ROOT/usr
+python2 setup.py install --prefix=$RPM_BUILD_ROOT/usr
%clean
%files
%defattr(-,root,root)
-
-%doc CHANGELOG COPYING README FAQ.html
-/usr/lib/python2.2/site-packages/rdiff_backup
/usr/bin/rdiff-backup
-/usr/share/man/man1/rdiff-backup.1.gz
+/usr/share/doc/rdiff-backup-%{version}
+/usr/lib
%changelog
diff --git a/rdiff-backup/dist/setup.py b/rdiff-backup/dist/setup.py
index 934e0a6..7c9892d 100755
--- a/rdiff-backup/dist/setup.py
+++ b/rdiff-backup/dist/setup.py
@@ -3,17 +3,12 @@
import sys, os, getopt
from distutils.core import setup, Extension
-version_string = "0.9.0"
+version_string = "$version"
if sys.version_info[:2] < (2,2):
print "Sorry, rdiff-backup requires version 2.2 or later of python"
sys.exit(1)
-def install(cmd):
- if os.system("install " + cmd) != 0:
- print "Error running 'install %s'" % cmd
- sys.exit(1)
-
setup(name="rdiff-backup",
version=version_string,
description="Local/remote mirroring+incremental backup",
@@ -21,27 +16,11 @@ setup(name="rdiff-backup",
author_email="bescoto@stanford.edu",
url="http://rdiff-backup.stanford.edu",
packages = ['rdiff_backup'],
- ext_modules=[Extension("rdiff_backup.C", ["cmodule.c"])])
-
-copy_files = 0
-prefix = "/usr"
-for arg in sys.argv[1:]: # check for "install" and --prefix= arg
- if arg == "install": copy_files = 1
- elif arg.startswith("--prefix="): prefix = arg[len("--prefix="):]
-
-if copy_files:
- bindir = prefix + "/bin"
- print "Copying rdiff-backup to " + bindir
- install("-d " + bindir)
- install("-m0755 rdiff-backup " + bindir)
+ ext_modules = [Extension("rdiff_backup.C", ["cmodule.c"])],
+ scripts = ['rdiff-backup'],
+ data_files = [('share/man/man1', ['rdiff-backup.1']),
+ ('share/doc/rdiff-backup-%s' % version_string,
+ ['CHANGELOG', 'COPYING', 'README', 'FAQ.html'])])
- mandir = prefix + "/share/man/man1"
- print "Copying rdiff-backup.1 to " + mandir
- install("-d " + mandir)
- install("-m0644 rdiff-backup.1 " + mandir)
- docdir = "%s/share/doc/rdiff-backup-%s" % (prefix, version_string)
- print ("Copying CHANGELOG, COPYING, README, and FAQ.html to " + docdir)
- install("-d " + docdir)
- install("-m0644 CHANGELOG COPYING README FAQ.html " + docdir)