summaryrefslogtreecommitdiff
path: root/rdiff-backup/dist/makerpm
blob: 8f59f6596d635e67e509ccb8733554fa0cd6ea21 (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
#!/usr/bin/env python

import os, sys, re

SourceDir = "src"

if len(sys.argv) == 2:
	version = sys.argv[1]
	specfile = "rdiff-backup-%s-1.spec" % version
	print "Using specfile %s" % specfile
else:
	print "Syntax:  %s version_number" % sys.argv[0]
	sys.exit(1)

base = ".".join(specfile.split(".")[:-1])
srcrpm = base+".src.rpm"
i386rpm = base+".i386.rpm"
source_rpm = base+".src.rpm"
tarfile = "-".join(base.split("-")[:-1]) + ".tar.gz"

# These assume the rpm root directory $HOME/rpm.  The
# nonstandard location allows for building by non-root user.
assert not os.system("cp %s $HOME/rpm/SOURCES" % (tarfile,))
assert not os.system("rpm -ba --sign -vv --target i386 " + specfile)
assert not os.system("cp $HOME/rpm/RPMS/i386/%s ." % i386rpm)
assert not os.system("cp $HOME/rpm/SRPMS/%s ." % source_rpm)

# Old root RPM instructions
#assert not os.system("install -o root -g root -m 644 %s "
#					 "/usr/src/redhat/SOURCES" % (tarfile,))
#assert not os.system("install -o ben -g ben -m 644 "
#					 "/usr/src/redhat/RPMS/i386/%s ." % i386rpm)
#assert not os.system("install -o ben -g ben -m 644 "
#					 "/usr/src/redhat/SRPMS/%s ." % source_rpm)