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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
#!/usr/bin/python
#
# makes a .discinfo file. if information isn't provided, prompts for it
#
# Copyright 2002 Red Hat, Inc.
#
# License: GPL
#
import os,sys,string
import getopt
import time
def usage():
args = ""
for key in data:
args = "%s [--%s=%s]" %(args, key, key)
print "%s: %s" % (sys.argv[0], args)
sys.exit(1)
data = {"timestamp": None,
"releasestr": None,
"arch": None,
"discNum": None,
"baseDir": None,
"packagesDir": None,
"pixmapsDir": None,
"outfile": None}
allDiscs = None
opts = []
for key in data.keys():
opts.append("%s=" % (key,))
opts.append("allDiscs")
(args, extra) = getopt.getopt(sys.argv[1:], '', opts)
if len(extra) > 0:
print "had extra args: %s" % extra
usage()
for (str, arg) in args:
if str[2:] in data.keys():
data[str[2:]] = arg
elif str == "--allDiscs":
allDiscs = 1
else:
print "unknown str of ", str
usage()
if data["timestamp"] is None:
print >> sys.stderr, "timestamp not specified; using the current time"
data["timestamp"] = time.time()
else:
data["timestamp"] = float(data["timestamp"])
if data["releasestr"] is None:
print "What should be the release name associated with this disc?"
data["releasestr"] = sys.stdin.readline()[:-1]
if data["arch"] is None:
print "What arch is this disc for?"
data["arch"] = sys.stdin.readline()[:-1]
if data["discNum"] is None and allDiscs is None:
print >> sys.stderr, "No disc number specified; assuming disc 1"
data["discNum"] = "1"
if data["baseDir"] is None:
print "Where is the comps file located?"
data["baseDir"] = sys.stdin.readline()[:-1]
if data["packagesDir"] is None:
print "Where are the packages located?"
data["packagesDir"] = sys.stdin.readline()[:-1]
if data["pixmapsDir"] is None:
print "Where are the images located?"
data["pixmapsDir"] = sys.stdin.readline()[:-1]
if data["outfile"] is None:
f = sys.stdout
else:
f = open(data["outfile"], "w")
f.write("%f\n" % data["timestamp"])
f.write("%s\n" % data["releasestr"])
f.write("%s\n" % data["arch"])
if allDiscs is None:
f.write("%s\n" % data["discNum"])
else:
f.write("0\n")
f.write("%s\n" % data["baseDir"])
f.write("%s\n" % data["packagesDir"])
f.write("%s\n" % data["pixmapsDir"])
|