-
Notifications
You must be signed in to change notification settings - Fork 0
/
makerpms.py
50 lines (37 loc) · 1.23 KB
/
makerpms.py
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
#!/usr/bin/env python
# makerpms.py
# Copy files all over the place build RPMs and copy to top level directory
# Contributed file - not tested before releases made.
import os
import shutil
srcRoot = "../../"
rpmRoot = "/usr/src/redhat/SOURCES/"
rpmBin = "/usr/src/redhat/RPMS/i386/"
rpmSource = "/usr/src/redhat/SRPMS/"
verFileName = srcRoot + "scintilla/version.txt"
vers = open(verFileName)
#139
vFull = vers.read().strip()
vers.close()
#1.39
vPoint = vFull[0] + "." + vFull[1:]
#1, 3, 9, 0
vComma = vFull[0] + ", " + vFull[1] + ", " + vFull[2] + ", 0"
print("[ %s | %s | %s ]" % (vFull, vPoint, vComma))
tgzV = "scite" + vFull + ".tgz"
tgzFileName = srcRoot + "scite.tgz"
tgzVFileName = srcRoot + tgzV
print("[ %s | %s ]" % (tgzFileName, tgzVFileName))
if not os.access(tgzFileName, os.F_OK):
print("Base file '" + tgzFileName + "' does not exist.")
else:
shutil.copyfile(tgzFileName, tgzVFileName)
os.unlink(tgzFileName)
rpmVFileName = rpmRoot + tgzV
shutil.copyfile(tgzVFileName, rpmVFileName)
# Run the rpm build command
os.system("rpm -ba scite.spec")
rpmB = "scite-" + vPoint + "-1.i386.rpm"
shutil.copyfile(rpmBin + rpmB, srcRoot + rpmB)
rpmS = "scite-" + vPoint + "-1.src.rpm"
shutil.copyfile(rpmSource + rpmS, srcRoot + rpmS)