summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-09-14 19:36:54 -0700
committerZac Medico <zmedico@gentoo.org>2011-09-14 19:36:54 -0700
commit7a216218968dc1d00f2881121870611bc1b5dd33 (patch)
treef6a875c08f379674d1236f49deaed34e7cb27203
parentd1f3fdfb943a9021d454c12b3418e44e5275ad69 (diff)
downloadportage-7a216218968dc1d00f2881121870611bc1b5dd33.tar.gz
portage-7a216218968dc1d00f2881121870611bc1b5dd33.tar.bz2
portage-7a216218968dc1d00f2881121870611bc1b5dd33.zip
Remove Manifest if it is not needed.
With thin manifest, there's no need to have a Manifest file if there are no DIST entries.
-rw-r--r--pym/portage/manifest.py22
1 files changed, 15 insertions, 7 deletions
diff --git a/pym/portage/manifest.py b/pym/portage/manifest.py
index 32cc2c025..449f9fdf4 100644
--- a/pym/portage/manifest.py
+++ b/pym/portage/manifest.py
@@ -241,7 +241,7 @@ class Manifest(object):
try:
myentries = list(self._createManifestEntries())
update_manifest = True
- if not force:
+ if myentries and not force:
try:
f = io.open(_unicode_encode(self.getFullname(),
encoding=_encodings['fs'], errors='strict'),
@@ -257,15 +257,23 @@ class Manifest(object):
break
except (IOError, OSError) as e:
if e.errno == errno.ENOENT:
- if not myentries:
- # With thin manifest, there's no need to have
- # a Manifest file if there are no DIST entries.
- update_manifest = False
+ pass
else:
raise
+
if update_manifest:
- write_atomic(self.getFullname(),
- "".join("%s\n" % str(myentry) for myentry in myentries))
+ if myentries:
+ write_atomic(self.getFullname(), "".join("%s\n" %
+ str(myentry) for myentry in myentries))
+ else:
+ # With thin manifest, there's no need to have
+ # a Manifest file if there are no DIST entries.
+ try:
+ os.unlink(self.getFullname())
+ except OSError as e:
+ if e.errno != errno.ENOENT:
+ raise
+
if sign:
self.sign()
except (IOError, OSError) as e: