Lines 111-134
def perform_checksum(filename, hash_func
Link Here
|
111 |
|
111 |
|
112 |
if calc_prelink and prelink_capable: |
112 |
if calc_prelink and prelink_capable: |
113 |
mylock = portage_locks.lockfile(prelink_tmpfile, wantnewlockfile=1) |
113 |
mylock = portage_locks.lockfile(prelink_tmpfile, wantnewlockfile=1) |
114 |
# Create non-prelinked temporary file to md5sum. |
114 |
# Create non-prelinked temporary file to checksum. |
115 |
# Raw data is returned on stdout, errors on stderr. |
115 |
# Files rejected by prelink are summed in place. |
116 |
# Non-prelinks are just returned. |
116 |
retval=portage_exec.spawn([PRELINK_BINARY,"--undo","-o",prelink_tmpfile,filename],fd_pipes={}) |
117 |
try: |
117 |
if retval==0: |
118 |
shutil.copy2(filename,prelink_tmpfile) |
118 |
#portage_util.writemsg(">>> prelink checksum '"+str(filename)+"'.\n") |
119 |
except SystemExit, e: |
119 |
myfilename=prelink_tmpfile |
120 |
raise |
|
|
121 |
except Exception,e: |
122 |
portage_util.writemsg("!!! Unable to copy file '"+str(filename)+"'.\n") |
123 |
portage_util.writemsg("!!! "+str(e)+"\n") |
124 |
sys.exit(1) |
125 |
portage_exec.spawn(PRELINK_BINARY+" --undo "+prelink_tmpfile,fd_pipes={}) |
126 |
myfilename=prelink_tmpfile |
127 |
|
120 |
|
128 |
myhash, mysize = hash_function(myfilename) |
121 |
myhash, mysize = hash_function(myfilename) |
129 |
|
122 |
|
130 |
if calc_prelink and prelink_capable: |
123 |
if calc_prelink and prelink_capable: |
131 |
os.unlink(prelink_tmpfile) |
124 |
if os.path.exists(prelink_tmpfile): |
|
|
125 |
os.unlink(prelink_tmpfile) |
132 |
portage_locks.unlockfile(mylock) |
126 |
portage_locks.unlockfile(mylock) |
133 |
|
127 |
|
134 |
return (myhash,mysize) |
128 |
return (myhash,mysize) |