Add Package.counter and mtime attributes. (trunk r10587)
authorZac Medico <zmedico@gentoo.org>
Mon, 9 Jun 2008 14:22:44 +0000 (14:22 -0000)
committerZac Medico <zmedico@gentoo.org>
Mon, 9 Jun 2008 14:22:44 +0000 (14:22 -0000)
svn path=/main/branches/2.1.2/; revision=10611

bin/emerge

index f49873d7b270b40b7beebfb32c9f485d22829de2..b2167f67d2bb09aaf8392224a5c4c99eb1e6bd1b 100755 (executable)
@@ -1422,13 +1422,13 @@ class Package(Task):
        __slots__ = ("built", "cpv", "depth",
                "installed", "metadata", "onlydeps", "operation",
                "root_config", "type_name",
-               "category", "cp", "cpv_split", "iuse",
+               "category", "counter", "cp", "cpv_split", "iuse", "mtime",
                "pf", "pv_split", "root", "slot", "slot_atom", "use")
 
        metadata_keys = [
                "CHOST", "COUNTER", "DEPEND", "EAPI", "IUSE", "KEYWORDS",
                "LICENSE", "PDEPEND", "PROVIDE", "RDEPEND",
-               "repository", "RESTRICT", "SLOT", "USE"]
+               "repository", "RESTRICT", "SLOT", "USE", "_mtime_"]
 
        def __init__(self, **kwargs):
                Task.__init__(self, **kwargs)
@@ -1472,7 +1472,8 @@ class Package(Task):
                """
                Detect metadata updates and synchronize Package attributes.
                """
-               _wrapped_keys = frozenset(["IUSE", "SLOT", "USE"])
+               _wrapped_keys = frozenset(
+                       ["COUNTER", "IUSE", "SLOT", "USE", "_mtime_"])
 
                def __init__(self, pkg, metadata):
                        dict.__init__(self)
@@ -1499,6 +1500,22 @@ class Package(Task):
                def _set_use(self, k, v):
                        self._pkg.use = self._pkg._use(v.split())
 
+               def _set_counter(self, k, v):
+                       if isinstance(v, basestring):
+                               try:
+                                       v = int(v.strip())
+                               except ValueError:
+                                       v = 0
+                       self._pkg.counter = v
+
+               def _set__mtime_(self, k, v):
+                       if isinstance(v, basestring):
+                               try:
+                                       v = float(v.strip())
+                               except ValueError:
+                                       v = 0
+                       self._pkg.mtime = v
+
        def _get_hash_key(self):
                hash_key = getattr(self, "_hash_key", None)
                if hash_key is None: