/[gentoo-x86]/sys-apps/policycoreutils/files/policycoreutils-extra-1.21-fix-python3.patch
Gentoo

Contents of /sys-apps/policycoreutils/files/policycoreutils-extra-1.21-fix-python3.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Mon Jun 25 20:08:44 2012 UTC (2 years, 2 months ago) by swift
Branch: MAIN
Fix python 3 and audit2allow support, needed for bugs #408179 and #415091

(Portage version: 2.1.10.49/cvs/Linux x86_64)

1 diff -ur policycoreutils-extra.orig/scripts/rlpkg policycoreutils-extra/scripts/rlpkg
2 --- policycoreutils-extra.orig/scripts/rlpkg 2012-05-01 16:01:43.321023704 +0200
3 +++ policycoreutils-extra/scripts/rlpkg 2012-05-01 16:01:53.192023725 +0200
4 @@ -86,7 +86,7 @@
5 t = portage.db["/"]["vartree"].dbapi.match(search_key)
6 # catch the "amgigous package" Exception
7 except ValueError as e:
8 - if type(e[0]) == types.ListType:
9 + if type(e[0]) == list:
10 t = []
11 for cp in e[0]:
12 t += portage.db["/"]["vartree"].dbapi.match(cp)
13 @@ -112,7 +112,7 @@
14
15 def find_xattr_mounts():
16 """Find mounted xattr filesystems"""
17 - print("Relabeling filesystem types: "+" ".join(xattrfs))
18 + print(("Relabeling filesystem types: "+" ".join(xattrfs)))
19 mounts=open("/etc/mtab", "r")
20
21 fs_matches=[]
22 @@ -158,29 +158,29 @@
23
24 (ret,context) = selinux.getfilecon(filename)
25 if ret < 0:
26 - print("Error getting context of "+filename)
27 + print(("Error getting context of "+filename))
28 continue
29
30 ctx = string.split(context,":")
31
32 if len(ctx) < 3:
33 - print("Debug: getfilecon on \""+filename+"\" returned a context of \""+context+"\" which split incorrectly ("+ctx+").")
34 + print(("Debug: getfilecon on \""+filename+"\" returned a context of \""+context+"\" which split incorrectly ("+ctx+")."))
35 continue
36
37 if ctx[2] in textrel_ok_relabelfrom:
38 if verbose:
39 - print("Relabeling "+filename+" to "+textrel_type+".")
40 + print(("Relabeling "+filename+" to "+textrel_type+"."))
41 ctx[2] = textrel_type
42 if selinux.setfilecon(filename,string.join(ctx,":")) < 0:
43 - print("Failed to relabel "+filename)
44 + print(("Failed to relabel "+filename))
45 elif ctx[2] == textrel_type:
46 if verbose:
47 - print("Skipping "+filename+" because it is already "+textrel_type+".")
48 + print(("Skipping "+filename+" because it is already "+textrel_type+"."))
49 else:
50 - print("Not relabeling "+filename+" because it is "+ctx[2]+".")
51 + print(("Not relabeling "+filename+" because it is "+ctx[2]+"."))
52 notok += 1
53
54 - print("%(a)d libraries with text relocations, %(b)d not relabeled." % {"a":textrel_libs, "b":notok})
55 + print(("%(a)d libraries with text relocations, %(b)d not relabeled." % {"a":textrel_libs, "b":notok}))
56
57 if notok > 0:
58 print("\nSome files were not relabeled! This is not necessarily bad,")
59 @@ -197,10 +197,10 @@
60
61 textrel_bins = 0
62 for line in tb.stdout.readline():
63 - print("PIE executable "+line.split()[1]+" has text relocations!")
64 + print(("PIE executable "+line.split()[1]+" has text relocations!"))
65 textrel_bins += 1
66
67 - print("%d binaries with text relocations detected." % (textrel_bins))
68 + print(("%d binaries with text relocations detected." % (textrel_bins)))
69
70 if textrel_bins > 0:
71 print("\nPIE binaries with text relocations have been detected!")
72 @@ -234,8 +234,8 @@
73 childin = os.popen(string.join(cmdline),'w')
74
75 for i in pkglist:
76 - print("Relabeling: "+i.get_cpv())
77 - for j in i.get_contents().keys():
78 + print(("Relabeling: "+i.get_cpv()))
79 + for j in list(i.get_contents().keys()):
80 childin.write(j+'\n')
81
82 rc = childin.close()
83 @@ -245,14 +245,14 @@
84 if rc == None:
85 rc = 0
86 else:
87 - print("Error relabeling: %d" % (rc))
88 + print(("Error relabeling: %d" % (rc)))
89
90 return rc
91
92 def usage(message=""):
93 pgmname = os.path.basename(sys.argv[0])
94
95 - print("Usage: %s [OPTIONS] {<pkg1> [<pkg2> ...]}" % (pgmname))
96 + print(("Usage: %s [OPTIONS] {<pkg1> [<pkg2> ...]}" % (pgmname)))
97 print("\n\
98 -a, --all Relabel the entire filesystem instead of individual packages.\n\
99 -r, --reset Force reset of context if the file's selinux identity is\n\
100 @@ -266,7 +266,7 @@
101 \"policycoreutils\" or \">=sys-apps/policycoreutils-1.30\".\n\
102 ")
103 if message != "":
104 - print(pgmname+": "+message)
105 + print((pgmname+": "+message))
106 sys.exit(1)
107 else:
108 sys.exit(0)

  ViewVC Help
Powered by ViewVC 1.1.20