diff options
author | Jason Stubbs <jstubbs@gentoo.org> | 2005-09-29 16:27:25 +0000 |
---|---|---|
committer | Jason Stubbs <jstubbs@gentoo.org> | 2005-09-29 16:27:25 +0000 |
commit | 978e47114acab8da50135f18ad0f75ff387a4e4d (patch) | |
tree | 37c543e5b845c1e2f6b2aa1381a1c99c7f2f9591 | |
parent | b7c3b2269acde1acf8ba3a7c1de866b8abfb1473 (diff) | |
download | portage-978e47114acab8da50135f18ad0f75ff387a4e4d.tar.gz portage-978e47114acab8da50135f18ad0f75ff387a4e4d.tar.bz2 portage-978e47114acab8da50135f18ad0f75ff387a4e4d.zip |
zmedico's prelink optimization
svn path=/main/branches/2.0/; revision=2044
-rw-r--r-- | pym/portage_checksum.py | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/pym/portage_checksum.py b/pym/portage_checksum.py index 001eed8ff..66f6f181d 100644 --- a/pym/portage_checksum.py +++ b/pym/portage_checksum.py @@ -111,24 +111,18 @@ def perform_checksum(filename, hash_function=md5hash, calc_prelink=0): if calc_prelink and prelink_capable: mylock = portage_locks.lockfile(prelink_tmpfile, wantnewlockfile=1) - # Create non-prelinked temporary file to md5sum. - # Raw data is returned on stdout, errors on stderr. - # Non-prelinks are just returned. - try: - shutil.copy2(filename,prelink_tmpfile) - except SystemExit, e: - raise - except Exception,e: - portage_util.writemsg("!!! Unable to copy file '"+str(filename)+"'.\n") - portage_util.writemsg("!!! "+str(e)+"\n") - raise - portage_exec.spawn(PRELINK_BINARY+" --undo "+prelink_tmpfile,fd_pipes={}) - myfilename=prelink_tmpfile + # Create non-prelinked temporary file to checksum. + # Files rejected by prelink are summed in place. + retval=portage_exec.spawn([PRELINK_BINARY,"--undo","-o",prelink_tmpfile,filename],fd_pipes={}) + if retval==0: + #portage_util.writemsg(">>> prelink checksum '"+str(filename)+"'.\n") + myfilename=prelink_tmpfile myhash, mysize = hash_function(myfilename) if calc_prelink and prelink_capable: - os.unlink(prelink_tmpfile) + if os.path.exists(prelink_tmpfile): + os.unlink(prelink_tmpfile) portage_locks.unlockfile(mylock) return (myhash,mysize) |