extras-buildsys/utils extras-push-new,1.25,1.26

Michael Schwendt (mschwendt) fedora-extras-commits at redhat.com
Fri Jun 9 08:30:35 UTC 2006


Author: mschwendt

Update of /cvs/fedora/extras-buildsys/utils
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv2630

Modified Files:
	extras-push-new 
Log Message:
sync find_files function which ignores builds marked as PUSHED


Index: extras-push-new
===================================================================
RCS file: /cvs/fedora/extras-buildsys/utils/extras-push-new,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- extras-push-new	4 Jun 2006 11:35:28 -0000	1.25
+++ extras-push-new	9 Jun 2006 08:30:33 -0000	1.26
@@ -237,8 +237,17 @@
 # collect list of srpms and get package n-v-r from them
 # move pkgs into repo
 
-        
-def find_files(path):
+def list_repo_root(repodir):
+    """returns list of directory names in repository root directory"""
+    d = os.listdir(repodir)
+    try:
+        d.remove('repodata')
+    except:
+        pass
+    return d
+
+
+def find_files(repodir):
     """returns a dict of filetypes and paths to those files"""
     filedict = {}
     filedict['srpm'] = []
@@ -248,27 +257,43 @@
     filedict['md5sum'] = []
     filedict['debuginfo'] = []
     filedict['other'] = []
-    for root, dirs, files in os.walk(path):
-        for file in files:
-            # match the files to what list they should be in
-            if file.endswith('.log'):
-                which = 'log'
-            elif file.endswith('.rpm'):
-                if file.find('debuginfo') != -1:
-                    which = 'debuginfo' 
-                elif file.endswith('.src.rpm'):
-                    which = 'srpm'
+    filedict['pkgrelroot'] = []
+
+    # The root dir contains a directory for every pushed package "name".
+    for name in list_repo_root(repodir):
+        pkgroot = os.path.join(repodir,name)
+        if not os.path.isdir(pkgroot):
+            continue
+        # Every version-release is stored in an own sub-dir.
+        # We want only those which are not marked as PUSHED yet.
+        for pkgrel in os.listdir(pkgroot):
+            pkgrelroot = os.path.join(pkgroot,pkgrel)
+            if os.path.isfile( os.path.join(pkgrelroot,'PUSHED') ):
+                continue
+            filedict['pkgrelroot'].append(pkgrelroot)
+
+    for path in filedict['pkgrelroot']:
+        for root, dirs, files in os.walk(path):
+            for file in files:
+                # match the files to what list they should be in
+                if file.endswith('.log'):
+                    which = 'log'
+                elif file.endswith('.rpm'):
+                    if file.find('debuginfo') != -1:
+                        which = 'debuginfo' 
+                    elif file.endswith('.src.rpm'):
+                        which = 'srpm'
+                    else:
+                        which = 'rpm'
+                elif file.endswith('.spec'):
+                    which = 'spec'
+                elif file.endswith('.md5sum'):
+                    which = 'md5sum'
                 else:
-                    which = 'rpm'
-            elif file.endswith('.spec'):
-                which = 'spec'
-            elif file.endswith('.md5sum'):
-                which = 'md5sum'
-            else:
-                which = 'other'
+                    which = 'other'
 
-            fullfile = os.path.join(root, file)
-            filedict[which].append(fullfile)
+                fullfile = os.path.join(root, file)
+                filedict[which].append(fullfile)
     return filedict
 
 




More information about the fedora-extras-commits mailing list