pld-ftp-admin: modules/ftptree.py - non-integer build check test on testmvpkg

glen glen at pld-linux.org
Sun Jan 9 16:25:44 CET 2011


Author: glen                         Date: Sun Jan  9 15:25:44 2011 GMT
Module: pld-ftp-admin                 Tag: HEAD
---- Log message:
- non-integer build check test on testmvpkg

---- Files affected:
pld-ftp-admin/modules:
   ftptree.py (1.45 -> 1.46) 

---- Diffs:

================================================================
Index: pld-ftp-admin/modules/ftptree.py
diff -u pld-ftp-admin/modules/ftptree.py:1.45 pld-ftp-admin/modules/ftptree.py:1.46
--- pld-ftp-admin/modules/ftptree.py:1.45	Sat Sep 11 12:38:24 2010
+++ pld-ftp-admin/modules/ftptree.py	Sun Jan  9 16:25:39 2011
@@ -90,6 +90,21 @@
         pkg = nvr.split('-')[:-2]
         return pkg[-1] == 'debuginfo'
 
+    # returns true if package build is integer
+    def is_release(self):
+        """
+        To account Release tags with subver macros, we consider integer release
+        if it contains odd number of dots:
+
+        1 -> True
+        0.1 -> False
+        0.%{subver}.%{rel}, %{rel} = 1 -> 0.20010.1 -> True
+        0.%{subver}.%{rel}, %{rel} = 0.1 -> 0.20010.0.1 -> False
+        """
+        # count elements by splitting by dot
+        parts = self.release.split('.')
+        return len(parts) % 2 == 1
+
     def mark4moving(self):
         if not self.marked4moving:
             # Only one pkg in this pool can be marked for moving
@@ -280,6 +295,7 @@
 
         self.__checksigns(dsttree, self.marked4moving, test = True)
         self.__checkforobsoletes(dsttree, self.marked4moving, test = True)
+        self.__checkforrelease(dsttree, self.marked4moving, test = True)
         
         self.__rmolderfromsrc(test = True)
         self.__rmotherfromdst(dsttree, test = True, archivetree = archivetree)
@@ -502,3 +518,15 @@
                     p = findbyname(item)
                     if p:
                         pkg.warning('obsoletes %s (via %s) in dest tree, perhaps you want rmpkg' % (p,pn))
+
+    def __checkforrelease(self, tree, pkgs, test = False):
+        """
+        Checks queue file if package release is non integer.
+
+        """
+        if test != True:
+            return
+
+        for pkg in pkgs:
+            if not pkg.is_release():
+                pkg.warning('non-integer release: %s' % pkg.release)
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/pld-ftp-admin/modules/ftptree.py?r1=1.45&r2=1.46&f=u



More information about the pld-cvs-commit mailing list