pld-ftp-admin: modules/ftptree.py - allow filtering source and debugfiles i...

glen glen at pld-linux.org
Mon Jan 10 21:10:21 CET 2011


Author: glen                         Date: Mon Jan 10 20:10:21 2011 GMT
Module: pld-ftp-admin                 Tag: HEAD
---- Log message:
- allow filtering source and debugfiles in rpmfiles() method

---- Files affected:
pld-ftp-admin/modules:
   ftptree.py (1.50 -> 1.51) 

---- Diffs:

================================================================
Index: pld-ftp-admin/modules/ftptree.py
diff -u pld-ftp-admin/modules/ftptree.py:1.50 pld-ftp-admin/modules/ftptree.py:1.51
--- pld-ftp-admin/modules/ftptree.py:1.50	Mon Jan 10 21:07:44 2011
+++ pld-ftp-admin/modules/ftptree.py	Mon Jan 10 21:10:16 2011
@@ -90,6 +90,12 @@
         pkg = nvr.split('-')[:-2]
         return pkg[-1] == 'debuginfo'
 
+    def is_sourcefile(self, file):
+        """
+        returns true if file is source package
+        """
+        return file[-8:] == '.src.rpm'
+
     # returns true if package build is integer
     def is_release(self):
         """
@@ -163,7 +169,7 @@
                         rm(noarchcachedir + rpm + '.reqlist', test)
         rm(self.tree.basedir + '/SRPMS/.metadata/' + self.nvr + '.src.rpm.info', test)
 
-    def rpmfiles(self, debugfiles = True):
+    def rpmfiles(self, debugfiles = True, sourcefiles  = True):
         """
         Return rpm files related to this package
         """
@@ -174,7 +180,11 @@
                     if debugfiles:
                         files.append(self.tree.basedir + '/' + arch + '/debuginfo/' + nvr)
                 else:
-                    files.append(self.tree.basedir + '/' + arch + '/RPMS/' + nvr)
+                    if self.is_sourcefile(nvr):
+                        if sourcefiles:
+                            files.append(self.tree.basedir + '/' + arch + '/RPMS/' + nvr)
+                    else:
+                        files.append(self.tree.basedir + '/' + arch + '/RPMS/' + nvr)
         return files
 
     def obsoletes(self):
@@ -320,13 +330,13 @@
         for pkg in self.marked4moving:
             pkg.move(dsttree)
 
-    def rpmfiles(self):
+    def rpmfiles(self, debugfiles = True, sourcefiles = True):
         if self.do_checkbuild:
             self.__checkbuild(self.marked4moving)
 
         files = []
         for pkg in self.marked4moving:
-            files += pkg.rpmfiles()
+            files += pkg.rpmfiles(debugfiles = debugfiles, sourcefiles = sourcefiles)
         return files
 
     def removepkgs(self):
================================================================

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



More information about the pld-cvs-commit mailing list