Lines 6-11
Link Here
|
6 |
import os,string,sys |
6 |
import os,string,sys |
7 |
sys.path.insert(0, "/usr/lib/gentoolkit/pym") |
7 |
sys.path.insert(0, "/usr/lib/gentoolkit/pym") |
8 |
sys.path.insert(0, "/usr/lib/portage/pym") |
8 |
sys.path.insert(0, "/usr/lib/portage/pym") |
|
|
9 |
from portage_util import grabfile |
9 |
from output import * |
10 |
from output import * |
10 |
from getopt import getopt,GetoptError |
11 |
from getopt import getopt,GetoptError |
11 |
|
12 |
|
Lines 41-47
Link Here
|
41 |
args, params = getopt(sys.argv[1:], "dplfchinvt", \ |
42 |
args, params = getopt(sys.argv[1:], "dplfchinvt", \ |
42 |
["dump", "print", "list", "pretend", "fix", "inject", "help", "info", "version", "test", "nocolor"]) |
43 |
["dump", "print", "list", "pretend", "fix", "inject", "help", "info", "version", "test", "nocolor"]) |
43 |
args = [a for a,b in args] |
44 |
args = [a for a,b in args] |
44 |
|
45 |
|
45 |
for option in ["--nocolor", "-n"]: |
46 |
for option in ["--nocolor", "-n"]: |
46 |
if option in args: |
47 |
if option in args: |
47 |
nocolor() |
48 |
nocolor() |
Lines 60-72
Link Here
|
60 |
elif len(args) > 1: |
61 |
elif len(args) > 1: |
61 |
print "please use only one command per call" |
62 |
print "please use only one command per call" |
62 |
mode = "help" |
63 |
mode = "help" |
|
|
64 |
|
65 |
|
63 |
else: |
66 |
else: |
64 |
# in what mode are we ? |
67 |
# in what mode are we ? |
65 |
args = args[0] |
68 |
args = args[0] |
66 |
for m in optionmap: |
69 |
for m in optionmap: |
67 |
if args in [o for o in m[:-1]]: |
70 |
if args in [o for o in m[:-1]]: |
68 |
mode = m[1][2:] |
71 |
mode = m[1][2:] |
69 |
|
72 |
|
70 |
except GetoptError, e: |
73 |
except GetoptError, e: |
71 |
print "unknown option given:", e |
74 |
print "unknown option given:", e |
72 |
mode = "help" |
75 |
mode = "help" |
Lines 98-103
Link Here
|
98 |
print |
101 |
print |
99 |
sys.exit(1) |
102 |
sys.exit(1) |
100 |
|
103 |
|
|
|
104 |
|
101 |
# we need root priviledges for write access |
105 |
# we need root priviledges for write access |
102 |
if mode in ["fix", "inject"] and os.geteuid() != 0: |
106 |
if mode in ["fix", "inject"] and os.geteuid() != 0: |
103 |
print |
107 |
print |
Lines 119-124
Link Here
|
119 |
|
123 |
|
120 |
glsaconfig = checkconfig(portage.config(clone=portage.settings)) |
124 |
glsaconfig = checkconfig(portage.config(clone=portage.settings)) |
121 |
|
125 |
|
|
|
126 |
# check that there is a glsa list |
127 |
glsatimestampfile = glsaconfig["GLSA_DIR"]+"/timestamp.chk" |
128 |
if os.path.exists(glsatimestampfile): |
129 |
content=portage.grabfile(glsatimestampfile) |
130 |
else : |
131 |
print |
132 |
print red("This tool needs to have a current GLSA list.") |
133 |
print "Please emerge sync to obtain the latest list" |
134 |
print |
135 |
sys.exit(0) |
136 |
|
122 |
# build glsa lists |
137 |
# build glsa lists |
123 |
completelist = get_glsa_list(glsaconfig["GLSA_DIR"], glsaconfig) |
138 |
completelist = get_glsa_list(glsaconfig["GLSA_DIR"], glsaconfig) |
124 |
|
139 |
|