public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "André Erdmann" <dywi@mailerd.de>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/db/
Date: Thu,  5 Sep 2013 14:43:12 +0000 (UTC)	[thread overview]
Message-ID: <1378385259.35d3fa6d99e964cddb256813ef786c66becdbe61.dywi@gentoo> (raw)

commit:     35d3fa6d99e964cddb256813ef786c66becdbe61
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Thu Sep  5 12:47:39 2013 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Thu Sep  5 12:47:39 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=35d3fa6d

distmap: use exactly one virtual entry

use one virtual entry for all distfiles that do not exist

---
 roverlay/db/distmap.py | 32 +++++++++++++++++---------------
 1 file changed, 17 insertions(+), 15 deletions(-)

diff --git a/roverlay/db/distmap.py b/roverlay/db/distmap.py
index 66ed838..0a3ee64 100644
--- a/roverlay/db/distmap.py
+++ b/roverlay/db/distmap.py
@@ -44,16 +44,6 @@ class DistMapInfo ( object ):
       return instance.make_volatile ( p_info, backref=backref )
    # --- end of volatile_from_package_info (...) ---
 
-   @classmethod
-   def volatile_from_distfile ( cls, distfile, backref=None ):
-      # COULDFIX
-      #  a static instance should suffice for this entry "type"
-      instance = cls ( distfile, None, None, None, volatile=True )
-      if backref is not None:
-         instance.add_backref ( backref )
-      return instance
-   # --- end of volatile_from_distfile (...) ---
-
    def __init__ (
       self, distfile, repo_name, repo_file, sha256, volatile=None
    ):
@@ -196,6 +186,8 @@ class _DistMapBase ( roverlay.util.objects.PersistentContent ):
 
       self.stats    = roverlay.stats.collector.static.distmap
 
+      self._VIRTUAL_ENTRY = None
+
       self._rebind_distmap()
 
       self.update_only = True
@@ -504,16 +496,22 @@ class _DistMapBase ( roverlay.util.objects.PersistentContent ):
       """
       if self.update_only:
          entry = self._distmap.get ( distfile, None )
-         if entry is None or entry != distmap_info:
+
+         if entry is not None and entry == distmap_info:
+            return entry
+
+         else:
             self._distmap [distfile] = distmap_info
             if distmap_info.is_persistent():
                self._file_added ( distfile )
             del entry
+
       else:
          self._distmap [distfile] = distmap_info
          if distmap_info.is_persistent():
             self._file_added ( distfile )
 
+
       return distmap_info
    # --- end of add_entry (...) ---
 
@@ -601,11 +599,15 @@ class _DistMapBase ( roverlay.util.objects.PersistentContent ):
             self.logger.log ( log_level, log_msg )
       # -- end if <log_level>
 
-      return self.add_entry (
-         distfile, DistMapInfo.volatile_from_distfile (
-            distfile, backref=backref
+      if self._VIRTUAL_ENTRY is None:
+         self._VIRTUAL_ENTRY = DistMapInfo (
+            None, None, None, None, volatile=True
          )
-      )
+
+      if backref is not None:
+         self._VIRTUAL_ENTRY.add_backref ( backref )
+
+      return self.add_entry ( distfile, self._VIRTUAL_ENTRY )
    # --- end of add_virtual_entry (...) ---
 
 # --- end of _DistMapBase ---


             reply	other threads:[~2013-09-05 14:43 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-05 14:43 André Erdmann [this message]
  -- strict thread matches above, loose matches on Subject: below --
2016-07-07  4:19 [gentoo-commits] proj/R_overlay:master commit in: roverlay/db/ Benda XU
2014-07-16 15:14 André Erdmann
2013-09-05 14:43 André Erdmann
2013-09-05 14:43 André Erdmann
2013-09-05 10:24 André Erdmann
2013-09-05  9:25 André Erdmann
2013-09-05  9:25 André Erdmann
2013-09-05  9:25 André Erdmann
2013-09-03 15:37 André Erdmann
2013-09-03 13:15 André Erdmann
2013-09-03 12:21 André Erdmann
2013-09-03 12:21 André Erdmann
2013-09-02  8:44 André Erdmann
2013-08-30 15:25 André Erdmann
2013-08-30 15:23 André Erdmann
2013-08-30 14:49 André Erdmann
2013-08-30 14:49 André Erdmann
2013-08-22  9:01 André Erdmann
2013-08-16 14:26 André Erdmann
2013-08-16 12:42 André Erdmann
2013-08-15  9:18 André Erdmann
2013-08-14 14:56 André Erdmann
2013-08-14 14:56 André Erdmann
2013-08-13  8:56 André Erdmann
2013-07-30 18:40 André Erdmann
2013-07-10 15:10 [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
2013-07-10 16:16 ` [gentoo-commits] proj/R_overlay:master " André Erdmann
2013-06-22 15:14 [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
2013-06-22 15:24 ` [gentoo-commits] proj/R_overlay:master " André Erdmann

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=1378385259.35d3fa6d99e964cddb256813ef786c66becdbe61.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