summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-03-19 04:48:02 +0000
committerZac Medico <zmedico@gentoo.org>2006-03-19 04:48:02 +0000
commit0ddfa4466b6e88749493eda2481da3bd5e798bdc (patch)
tree1c3afce6889a2d76ac82ab5184dffca2584292d2
parentb8f12667b49a5994e0258b8ab88361aceb54bb3b (diff)
downloadportage-0ddfa4466b6e88749493eda2481da3bd5e798bdc.tar.gz
portage-0ddfa4466b6e88749493eda2481da3bd5e798bdc.tar.bz2
portage-0ddfa4466b6e88749493eda2481da3bd5e798bdc.zip
Compare new digest data with old digest data and rewrite the new digest only if they differ. Thanks to AllanonJL for reporting this issue.
svn path=/main/trunk/; revision=2951
-rw-r--r--pym/portage.py34
1 files changed, 16 insertions, 18 deletions
diff --git a/pym/portage.py b/pym/portage.py
index c67a23981..6a84c925a 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -2115,24 +2115,22 @@ def digestgen(myarchives,mysettings,overwrite=1,manifestonly=0):
if mydigests==None: # There was a problem, exit with an errorcode.
return 0
- try:
- outfile=open(digestfn, "w+")
- except SystemExit, e:
- raise
- except Exception, e:
- print "!!! Filesystem error skipping generation. (Read-Only?)"
- print "!!!",e
- return 0
- for x in digestCreateLines(myarchives, mydigests):
- outfile.write(x+"\n")
- outfile.close()
- try:
- os.chown(digestfn,os.getuid(),portage_gid)
- os.chmod(digestfn,0664)
- except SystemExit, e:
- raise
- except Exception,e:
- print e
+ if mydigests != myolddigest:
+ digest_lines = digestCreateLines(myarchives, mydigests)
+ digest_success = True
+ try:
+ write_atomic(digestfn, "\n".join(digest_lines) + "\n")
+ digest_success = apply_secpass_permissions(
+ digestfn, gid=portage_gid, mode=0664)
+ except (IOError, OSError), e:
+ writemsg("!!! %s\n" % str(e))
+ digest_success = False
+ except portage_exception.PortageException:
+ writemsg("!!! %s\n" % str(e))
+ digest_success = False
+ if not digest_success:
+ writemsg("!!! Filesystem error, skipping generation.\n")
+ return 0
print green(">>> Generating the manifest file...")
mypfiles=listdir(pbasedir,recursive=1,filesonly=1,ignorecvs=1,EmptyOnError=1)