extras-buildsys/utils extras-push-new,1.55,1.56
Michael Schwendt (mschwendt)
fedora-extras-commits at redhat.com
Sat Sep 16 20:23:22 UTC 2006
Author: mschwendt
Update of /cvs/fedora/extras-buildsys/utils
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv25222
Modified Files:
extras-push-new
Log Message:
* Modify find_files() so we keep track of a package's home directory
in the needsign repo in order to be able to exclude invalid builds.
Now we also warn about that in the build report.
* Move/change some status messages.
* Previous production release tagged: push-new-production-7
Index: extras-push-new
===================================================================
RCS file: /cvs/fedora/extras-buildsys/utils/extras-push-new,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -r1.55 -r1.56
--- extras-push-new 15 Sep 2006 17:16:38 -0000 1.55
+++ extras-push-new 16 Sep 2006 20:23:20 -0000 1.56
@@ -184,6 +184,7 @@
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
@@ -287,16 +288,10 @@
def find_files(repodir):
"""returns a dict of filetypes and paths to those files"""
filedict = {}
- 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".
+ filedict['pkgrelrootdict'] = {} # map pkgrelrootpath -> list of files
+
+ # The needsign repository root contains a directory for every built
+ # package "name".
for name in list_repo_root(repodir):
pkgroot = os.path.join(repodir,name)
if not os.path.isdir(pkgroot):
@@ -307,30 +302,53 @@
pkgrelroot = os.path.join(pkgroot,pkgrel)
if os.path.isfile( os.path.join(pkgrelroot,'PUSHED') ):
continue
- filedict['pkgrelroot'].append(pkgrelroot)
+ filedict['pkgrelrootdict'].setdefault(pkgrelroot,[])
- for path in filedict['pkgrelroot']:
- for root, dirs, files in os.walk(path):
+ # 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 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'
+ 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'
else:
- which = 'other'
+ which = 'rpm'
+ else:
+ which = 'other'
- fullfile = os.path.join(root, file)
- filedict[which].append(fullfile)
+ 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)
return filedict
@@ -450,9 +468,6 @@
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:
@@ -473,6 +488,7 @@
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.'
@@ -497,18 +513,29 @@
shutil.rmtree(signtmpdir)
return result, changed
- print "Copying packages into place:"
- infolist = [] # list of src.rpm NEVR for build report
+ print "Copying packages into repositories:"
+ infolist = [] # list of src.rpm NEVR id strings 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)
- install_move(signtmpdir+package,destloc)
+ 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']
# go through each package and move it to the right arch location
# if it is a noarch package, copy2 it to all arch locations
@@ -573,8 +600,8 @@
rundirfile.close()
# Mark successfully signed packages as PUSHED.
- for path in files['pkgrelroot']:
- mark_pkg_pushed(path)
+ for (pkgrelroot,f) in files['pkgrelrootdict'].items():
+ mark_pkg_pushed(pkgrelroot)
# All done, now check if something changed unless we already know it did:
if not changed:
More information about the scm-commits
mailing list