1 |
I have a crappy but functional solution to this problem. I changed the |
2 |
portage.py code to use the prelink --verify option to get the input for |
3 |
the MD5 checksum. This probably incurres a substantial performance |
4 |
hit. In addition prelink is used to help calculate all MD5 checksums |
5 |
which is pointless. On the other hand, I essentally deleted 5 lines and |
6 |
changed 1 to get it to work. Heres the patch. |
7 |
|
8 |
--- /usr/lib/python2.2/site-packages/portage.py 2002-09-25 20:17:44.000000000 -0600 |
9 |
+++ /mnt/gentoo/usr/lib/python2.2/site-packages/portage.py 2002-10-05 16:05:22.000000000 -0600 |
10 |
@@ -47,33 +47,28 @@ |
11 |
if mtime != cached_mtime: |
12 |
list = os.listdir(path) |
13 |
dircache[path] = mtime, list |
14 |
return list |
15 |
|
16 |
-try: |
17 |
- import fchksum |
18 |
- def perform_checksum(filename): |
19 |
- return fchksum.fmd5t(filename) |
20 |
-except ImportError: |
21 |
- import md5 |
22 |
- def md5_to_hex(md5sum): |
23 |
- hexform = "" |
24 |
- for ix in xrange(len(md5sum)): |
25 |
- hexform = hexform + "%02x" % ord(md5sum[ix]) |
26 |
- return(string.lower(hexform)) |
27 |
- |
28 |
- def perform_checksum(filename): |
29 |
- f = open(filename, 'rb') |
30 |
- blocksize=32768 |
31 |
+import md5 |
32 |
+def md5_to_hex(md5sum): |
33 |
+ hexform = "" |
34 |
+ for ix in xrange(len(md5sum)): |
35 |
+ hexform = hexform + "%02x" % ord(md5sum[ix]) |
36 |
+ return(string.lower(hexform)) |
37 |
+ |
38 |
+def perform_checksum(filename): |
39 |
+ f = os.popen3("/usr/sbin/prelink --verify " + filename, 'r')[1] |
40 |
+ blocksize=32768 |
41 |
+ data = f.read(blocksize) |
42 |
+ size = 0L |
43 |
+ sum = md5.new() |
44 |
+ while data: |
45 |
+ sum.update(data) |
46 |
+ size = size + len(data) |
47 |
data = f.read(blocksize) |
48 |
- size = 0L |
49 |
- sum = md5.new() |
50 |
- while data: |
51 |
- sum.update(data) |
52 |
- size = size + len(data) |
53 |
- data = f.read(blocksize) |
54 |
- return (md5_to_hex(sum.digest()),size) |
55 |
+ return (md5_to_hex(sum.digest()),size) |
56 |
|
57 |
starttime=int(time.time()) |
58 |
|
59 |
features=[] |
60 |
|
61 |
|
62 |
|
63 |
On Sat, 2002-10-05 at 00:22, Quinn Harris wrote: |
64 |
> I have started to build a system with glibc-2.3 primarily to use |
65 |
> prelinking. But I just realized that prelinking and portage aren't |
66 |
> going to get along. |
67 |
> |
68 |
> The prelink tool will change binaries and shared libraries on the system |
69 |
> and therefor the modify time and the MD5 checksum. I expect portage |
70 |
> will no longer properly unmerge these changed files. |
71 |
> |
72 |
> The prelink tool can be changed to update the portage db probably by |
73 |
> using a wrapper script. Or, portage could be modified to utilize |
74 |
> prelink to determine if the file was modified by prelink. This is |
75 |
> explained in |
76 |
> http://sources.redhat.com/ml/libc-alpha/2002-10/msg00089.html |
77 |
> |
78 |
> What would be the best solution? |
79 |
> |
80 |
> |
81 |
> Some info about prelinking |
82 |
> http://dforce.sh.cvut.cz/~seli/en/linking2/ |
83 |
> |
84 |
> |
85 |
> On a side note. gcc-3.2 won't compile right with glibc-2.3. It looks |
86 |
> like the gcc-3.2-branch cvs has the problem fixed. |
87 |
> http://gcc.gnu.org/ml/gcc/2002-10/msg00333.html |
88 |
> |
89 |
> _______________________________________________ |
90 |
> gentoo-dev mailing list |
91 |
> gentoo-dev@g.o |
92 |
> http://lists.gentoo.org/mailman/listinfo/gentoo-dev |
93 |
> |