From: "André Erdmann" <dywi@mailerd.de>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/overlay/pkgdir/distroot/, roverlay/db/
Date: Wed, 4 Sep 2013 09:13:10 +0000 (UTC) [thread overview]
Message-ID: <1378285965.6c0687e0cf6698ede306d6a7933687026cf21dd8.dywi@gentoo> (raw)
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:
reply other threads:[~2013-09-04 9:13 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1378285965.6c0687e0cf6698ede306d6a7933687026cf21dd8.dywi@gentoo \
--to=dywi@mailerd.de \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox