* [gentoo-commits] proj/R_overlay:master commit in: roverlay/overlay/pkgdir/distroot/, roverlay/db/
@ 2013-09-04 9:13 André Erdmann
0 siblings, 0 replies; only message in thread
From: André Erdmann @ 2013-09-04 9:13 UTC (permalink / raw
To: gentoo-commits
commit: 6c0687e0cf6698ede306d6a7933687026cf21dd8
Author: André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Wed Sep 4 09:11:04 2013 +0000
Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Wed Sep 4 09:12:45 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=6c0687e0
distmap: properly remove entries
fixes an issue where volatile entries disappear due to try_remove(<key>) calls
in distroot.
Also, mark entries as "removed" when making them volatile so that the stats have
correct numbers.
---
roverlay/db/distmap.py | 43 ++++++++++++++++++++++++----
roverlay/overlay/pkgdir/distroot/distroot.py | 2 ++
2 files changed, 40 insertions(+), 5 deletions(-)
diff --git a/roverlay/db/distmap.py b/roverlay/db/distmap.py
index e297286..d683f24 100644
--- a/roverlay/db/distmap.py
+++ b/roverlay/db/distmap.py
@@ -308,6 +308,7 @@ class _DistMapBase ( object ):
# verify <>.repo, ...
#
entry.make_volatile ( p_info, package_dir.get_ref() )
+ self._file_removed ( distfile )
return 3
# --- end of get_distfile_slot (...) ---
@@ -383,30 +384,62 @@ class _DistMapBase ( object ):
)
# --- end of check_integrity (...) ---
- def remove ( self, key ):
- """Removes an entry from the distmap.
+ def delete ( self, key ):
+ """Removes an entry from the distmap, whether persistent or not.
arguments:
* key -- distfile path relative to the distroot
"""
del self._distmap [key]
self._file_removed ( key )
+ # --- end of delete (...) ---
+
+ def try_delete ( self, key ):
+ """Tries to remove an entry from the distmap.
+
+ arguments:
+ * key -- distfile path relative to the distroot
+ """
+ try:
+ del self._distmap [key]
+ self._file_removed ( key )
+ except KeyError:
+ pass
+ # --- end of try_delete (...) ---
+
+ def remove ( self, key ):
+ """Removes a persistent entry from the distmap.
+
+ arguments:
+ * key -- distfile path relative to the distroot
+ """
+ if self._distmap[key].is_persistent():
+ del self._distmap [key]
+ self._file_removed ( key )
# --- end of remove (...) ---
def try_remove ( self, key ):
- """Tries to remove an entry from the distfile.
+ """Tries to remove a persistent entry from the distfile.
Does nothing if no entry found.
arguments:
* key -- distfile path relative to the distroot
"""
try:
- del self._distmap [key]
- self._file_removed ( key )
+ if self._distmap[key].is_persistent():
+ del self._distmap [key]
+ self._file_removed ( key )
except KeyError:
pass
# --- end of try_remove (...) ---
+ def remove_volatiles ( self ):
+ """Removes all non-persistent entries from the distmap."""
+ volatiles = [ k for k, v in self._distmap.items() if v.is_volatile() ]
+ for key in volatiles:
+ del self._distmap [key]
+ # --- end of remove_volatiles (...) ---
+
def make_reverse_distmap ( self ):
"""Creates a reverse distmap that can be used to find repo files in the
distdir.
diff --git a/roverlay/overlay/pkgdir/distroot/distroot.py b/roverlay/overlay/pkgdir/distroot/distroot.py
index ad0e2b6..9be7c90 100644
--- a/roverlay/overlay/pkgdir/distroot/distroot.py
+++ b/roverlay/overlay/pkgdir/distroot/distroot.py
@@ -101,6 +101,8 @@ class DistrootBase ( object ):
self._cleanup()
if self.distmap is not None:
+ ## not necessary
+ #self.distmap.remove_volatiles()
if backup_distmap:
self.distmap.backup_and_write ( force=False )
else:
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2013-09-04 9:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-04 9:13 [gentoo-commits] proj/R_overlay:master commit in: roverlay/overlay/pkgdir/distroot/, roverlay/db/ André Erdmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox