extras-buildsys/utils extras-push-new,1.56,1.57

Michael Schwendt (mschwendt) fedora-extras-commits at redhat.com
Sat Sep 16 20:35:50 UTC 2006


Author: mschwendt

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

Modified Files:
	extras-push-new 
Log Message:
Hmm, actually I'm not sure we want the previous changes exactly like
this - so, reverting. Needs more work as to avoid partial pushs in case
something breaks (or maybe I just had some bad imaginations ;)...




Index: extras-push-new
===================================================================
RCS file: /cvs/fedora/extras-buildsys/utils/extras-push-new,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -r1.56 -r1.57
--- extras-push-new	16 Sep 2006 20:23:20 -0000	1.56
+++ extras-push-new	16 Sep 2006 20:35:48 -0000	1.57
@@ -184,7 +184,6 @@
 
 
 def mark_pkg_pushed(pkgrelroot):
-    """create a file named PUSHED in a package build-results root directory"""
     fname = os.path.join(pkgrelroot,'PUSHED')
     if os.path.isfile(fname):
         return
@@ -288,10 +287,16 @@
 def find_files(repodir):
     """returns a dict of filetypes and paths to those files"""
     filedict = {}
-    filedict['pkgrelrootdict'] = {}  # map pkgrelrootpath -> list of files
-    
-    # The needsign repository root contains a directory for every built
-    # package "name".
+    filedict['srpm'] = []
+    filedict['log'] = []
+    filedict['rpm'] = []
+    filedict['spec'] = []
+    filedict['md5sum'] = []
+    filedict['debuginfo'] = []
+    filedict['other'] = []
+    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):
@@ -302,53 +307,30 @@
             pkgrelroot = os.path.join(pkgroot,pkgrel)
             if os.path.isfile( os.path.join(pkgrelroot,'PUSHED') ):
                 continue
-            filedict['pkgrelrootdict'].setdefault(pkgrelroot,[])
+            filedict['pkgrelroot'].append(pkgrelroot)
 
-    # At this point we have a list of "package build-results" root directories
-    # in which to search for files in multiple sub-directories.
-    # We implement a more complex way of finding all available files,
-    # for these reasons:
-    #
-    # We want to search on disk for all available files only once,
-    # be able to drop any package's build-results later and still be able to
-    # reconstruct the list of available files without searching again.
-    
-    for (pkgrelroot,f) in filedict['pkgrelrootdict'].items():
-        for root, dirs, files in os.walk(pkgrelroot):
-            # Store the list of files found within this pkgrelroot.
+    for path in filedict['pkgrelroot']:
+        for root, dirs, files in os.walk(path):
             for file in files:
-                fullfile = os.path.join(root,file)
-                filedict['pkgrelrootdict'][pkgrelroot].append(fullfile)
-    return rebuild_filedict(filedict)
-
-
-def rebuild_filedict(filedict):
-    """rebuild the file-type dicts in our filedict only from the items in the pkgrelrootdict """
-    filedict['srpm'] = []
-    filedict['rpm'] = []
-    filedict['debuginfo'] = []
-    filedict['other'] = []
-    filedict['srpmtoroot'] = {}  # map srpmpath -> pkgrelrootpath
-    for (pkgrelroot,files) in filedict['pkgrelrootdict'].items():
-        for file in files:
-            # match the files to what list they should be in
-            if file.endswith('.rpm'):
-                if file.find('debuginfo') != -1:
-                    which = 'debuginfo' 
-                elif file.endswith('.src.rpm'):
-                    which = 'srpm'
+                # 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'
-            else:
-                which = 'other'
+                    which = 'other'
 
-            filedict[which].append(file)
-
-            # The following is only used to map a package file path to
-            # its home in the needsign repo. We use it to exclude invalid
-            # builds.
-            if which == 'srpm':
-                filedict['srpmtoroot'].setdefault(file,pkgrelroot)
+                fullfile = os.path.join(root, file)
+                filedict[which].append(fullfile)
     return filedict
 
 
@@ -468,6 +450,9 @@
     print 'Packages found: %d' % len(rpms)
     if len(rpms) == 0:
         return 0, changed
+    rpms.sort()
+    for item in rpms:
+        print ' %s' % os.path.basename(item)
 
     print 'Copying packages to temporary working directory:'
     if not DEBUG:
@@ -488,7 +473,6 @@
             if not DEBUG:
                 if not os.path.exists(destpath):
                     os.makedirs(destpath)
-            print '  %s' % os.path.basename(src)
             install_copy(src,dst)
         except:
             print 'ERROR: Creating temporary working copy failed.'
@@ -513,29 +497,18 @@
                 shutil.rmtree(signtmpdir)
             return result, changed
 
-    print "Copying packages into repositories:"
-    infolist = []  # list of src.rpm NEVR id strings for build report
+    print "Copying packages into place:"
+    infolist = []  # list of src.rpm NEVR for build report
     
     global srpmlocdict
     srpmlocdict = {} # debug only
     for package in files['srpm']:
         (n,a,e,v,r) = naevr(package)
+        infolist.append('%s-%s-%s' % (n,v,r))
         pkg_fn = os.path.basename(package)
         srpmlocdict[pkg_fn] = package  # debug only
         destloc = os.path.join(destdir, 'SRPMS', pkg_fn)
-        if not os.path.exists(destloc):
-            install_move(signtmpdir+package,destloc)
-            infolist.append('%s-%s-%s' % (n,v,r))
-        else:  # src.rpm has been published before
-            # Exclude all build-results for this package.
-            pkgrelroot = files['srpmtoroot'][package]
-            del( files['pkgrelrootdict'][pkgrelroot] )
-            infolist.append('%s-%s-%s  (EXCLUDED - published before!)' % (n,v,r))
-
-    # Rebuild the file-type parts of the filedict to get rid of
-    # excluded packages.
-    files = rebuild_filedict(files)
-    rpms = files['rpm'] + files['srpm'] + files['debuginfo']    
+        install_move(signtmpdir+package,destloc)
 
     # go through each package and move it to the right arch location
     # if it is a noarch package, copy2 it to all arch locations
@@ -600,8 +573,8 @@
     rundirfile.close()
     
     # Mark successfully signed packages as PUSHED.
-    for (pkgrelroot,f) in files['pkgrelrootdict'].items():
-        mark_pkg_pushed(pkgrelroot)
+    for path in files['pkgrelroot']:
+        mark_pkg_pushed(path)
 
     # All done, now check if something changed unless we already know it did:
     if not changed:




More information about the fedora-extras-commits mailing list