extras-buildsys/utils/pushscript Push.py,1.56,1.57

Michael Schwendt mschwendt at fedoraproject.org
Thu Nov 6 12:29:11 UTC 2008


Author: mschwendt

Update of /cvs/fedora/extras-buildsys/utils/pushscript
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv32175

Modified Files:
	Push.py 
Log Message:
- update for 'development' dist repo layout
- move the is_any_repo_change check into Utils
- make sync_cmd config value optional



Index: Push.py
===================================================================
RCS file: /cvs/fedora/extras-buildsys/utils/pushscript/Push.py,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -r1.56 -r1.57
--- Push.py	5 Nov 2008 22:32:55 -0000	1.56
+++ Push.py	6 Nov 2008 12:29:10 -0000	1.57
@@ -47,7 +47,7 @@
 
 # ====================================================================
 
-def getexcludearch(pkgpath,reporoot):
+def getexcludearch(pkgpath,srpmspath):
     """Returns list of excluded archs for a binary rpm.
     Needs access to the repository root directory where it
     examines the source rpm."""
@@ -55,7 +55,7 @@
     global ts
     hdr = rpmUtils.miscutils.hdrFromPackage(ts,pkgpath)
     source_rpm = hdr['sourcerpm']
-    srpmloc = os.path.join(reporoot, 'SRPMS', source_rpm)
+    srpmloc = os.path.join( srpmspath, source_rpm)
     hdr = rpmUtils.miscutils.hdrFromPackage(ts,srpmloc)
     return hdr['excludearch']
 
@@ -119,12 +119,14 @@
         bi = BuildInfo(br.__str__(),'INVALID build results, not published!',False,True)
         buildreport.Add(bi)
         raise PushWarning, 'WARNING: %d source rpms in %s' % (len(br.filedict['srpm']),br.GetHome())
+
+    srpmspath = Utils.srpm_repodir(cfg,dist,destroot)
     
     package = br.filedict['srpm'][0]
     (n,a,e,v,r) = Utils.naevr(package)
     summary = Utils.get_pkg_header(package)['summary'].rstrip()
     pkg_fn = os.path.basename(package)
-    destloc = os.path.join(destroot, 'SRPMS', pkg_fn)
+    destloc = os.path.join(srpmspath, pkg_fn)
     if not os.path.exists(destloc):
         rollback.append(destloc)
         Utils.install_move(package,destloc)
@@ -145,19 +147,17 @@
         raise PushWarning, 'WARNING: no built rpms in %s' % br.GetHome()
 
     for package in br.filedict['rpm'] + br.filedict['debuginfo']:
-        pkg_fn = pkg_destfn = os.path.basename(package)
-        if package in br.filedict['debuginfo']:
-            pkg_destfn = 'debug/' + pkg_fn
+        pkg_fn = os.path.basename(package)
         (n,a,e,v,r) = Utils.naevr(package)
 
         if a == 'noarch':
-            excludearch = getexcludearch(package,destroot)
+            excludearch = getexcludearch(package,srpmspath)
             linkloc = None
             for basearch in cfg.archdict[dist]:
                 if basearch in excludearch:
                     print 'EXCLUDEARCH: Not releasing %s for %s.' % (pkg_fn,basearch)
                     continue  # with next basearch
-                destloc = os.path.join(destroot, basearch, pkg_destfn)
+                destloc = os.path.join( Utils.rpm_repodir(cfg,dist,basearch,destroot), pkg_fn )
                 rollback.append(destloc)
                 if linkloc:
                     Utils.install_link_or_copy(linkloc,destloc)
@@ -183,7 +183,10 @@
             print 'Unknown arch %s' % a
             continue  # with next package
 
-        destloc = os.path.join(destroot, basearch, pkg_destfn)
+        if package in br.filedict['debuginfo']:
+            destloc = os.path.join( Utils.debug_repodir(cfg,dist,basearch,destroot), pkg_fn )
+        else:
+            destloc = os.path.join( Utils.rpm_repodir(cfg,dist,basearch,destroot), pkg_fn )
         rollback.append(destloc)
         Utils.install_move(package,destloc)
 
@@ -220,9 +223,7 @@
     print '='*70
     print 'Target repository:', destroot
     print '='*70
-    if not os.path.exists(destroot):
-        os.makedirs(destroot)
-    Utils.make_std_repodirs(cfg,dist,destroot)
+    Utils.make_std_repodirs(cfg,dist)
     
     repolockname = os.path.join(needsignroot,REPO_LOCKFILE_NAME)
     if not os.path.exists(os.path.dirname(repolockname)):
@@ -333,15 +334,6 @@
                 break
     return newresults
 
-
-# Check a repository and its sub-repositories for external changes
-# such as file removals.
-def repo_changed(cfg,dist):
-    destroot = os.path.join(cfg.treedir,dist)
-    if not os.path.exists(destroot):
-        os.makedirs(destroot)
-    return Utils.is_any_repo_changed(cfg,dist,destroot)
-
 # ====================================================================
 
 import datetime
@@ -471,7 +463,7 @@
         if dist in cfg.frozendists:
             whitelist = []
         # Check for external changes to repository.
-        if repo_changed(cfg,dist) and not dist in changed:
+        if Utils.is_any_repo_changed(cfg,dist) and not dist in changed:
             print "Change detected:", dist
             changed.append(dist)
         # Release build jobs from needsign queue.
@@ -504,7 +496,7 @@
             RepoView.main(cfg,dist)
 
     if changed or mustfinish:
-        Utils.run_and_check(cfg.sync_cmd)
+        Utils.run_and_check( getattr(cfg,'sync_cmd','') )
 
         if cfg.opts.mail:
             email_list(diststopush)




More information about the scm-commits mailing list