extras-buildsys/utils/pushscript Push.py,1.43,1.44
Michael Schwendt (mschwendt)
fedora-extras-commits at redhat.com
Thu Aug 23 12:11:19 UTC 2007
Author: mschwendt
Update of /cvs/fedora/extras-buildsys/utils/pushscript
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv8142
Modified Files:
Push.py
Log Message:
- hack in rudimentary support for a 'pushtotesting' option, which
redirects pushes from the single plague-results dir to testing
repos
- move the repo_changed check out of the copy_sign_move block
- remove the doublesync option (we won't need it)
Index: Push.py
===================================================================
RCS file: /cvs/fedora/extras-buildsys/utils/pushscript/Push.py,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- Push.py 6 May 2007 19:46:03 -0000 1.43
+++ Push.py 23 Aug 2007 12:11:17 -0000 1.44
@@ -183,21 +183,27 @@
def copy_sign_move(dist,whitelist=['.*']):
"""Copies, signs and moves packages for the given dist.
- Returns (errcode, changed) where errcode is an error code and changed
- is a boolean indicating whether the target repo was changed."""
+ Returns (errcode, changedrepo) where errcode is an error code and
+ changedrepo is either the dist id of the target repo that was changed
+ or None."""
+ changedrepo = None
+
+ srcdist = dist
distdir = '%s-%s-%s' % (cfg.distro, dist, cfg.project)
needsignroot = os.path.join(cfg.stagesdir, distdir)
- destroot = os.path.join(cfg.treedir, dist)
+
+ if hasattr(cfg.opts,'pushtotesting') and cfg.opts.pushtotesting and not dist.startswith('testing/') and not dist=='development':
+ dist = 'testing/%s' % dist
+ destroot = os.path.join(cfg.treedir, dist)
+ else:
+ destroot = os.path.join(cfg.treedir, dist)
if not os.path.exists(destroot):
os.makedirs(destroot)
- # We check for changes already here in case the repo has changed
- # due to external activities such as removing files etc, and will
- # recheck it again later if needed when we're done with this sign
- # batch.
- changed = Utils.is_any_repo_changed(cfg,dist,destroot)
-
+ if srcdist.startswith('testing/'):
+ return 0, changedrepo
+
Utils.make_std_repodirs(cfg,dist,destroot)
repolockname = os.path.join(needsignroot,REPO_LOCKFILE_NAME)
@@ -214,11 +220,11 @@
bs = LocalPlague(needsignroot)
bs.PruneBuildResults()
results = bs.GetBuildResults()
- results = BlackList.get_filtered_build_results(cfg,dist,results)
+ results = BlackList.get_filtered_build_results(cfg,srcdist,results)
results = apply_whitelist(results,whitelist)
print 'Package directories found: %d' % len(results)
if len(results) == 0:
- return 0, changed
+ return 0, changedrepo
print 'Copying build results to temporary working directory:'
signtmpdir = tempfile.mkdtemp('','.push',cfg.treedir)
@@ -269,6 +275,7 @@
else:
buildreport = BuildReportManager(cfg.rundir,dist)
targetroot = destroot
+ changedrepo = dist
try:
push(br,dist,targetroot,buildreport)
# TODO: report these via mail (or so)
@@ -291,11 +298,7 @@
print('Removing tmp tree: %s' % signtmpdir)
shutil.rmtree(signtmpdir)
- # All done, now check if something changed unless we already know it did:
- if not changed:
- changed = Utils.is_any_repo_changed(cfg,dist,destroot)
-
- return 0, changed
+ return 0, changedrepo
def apply_whitelist(results, whitelist):
@@ -307,6 +310,15 @@
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
@@ -427,11 +439,16 @@
whitelist = ['.*'] # all (regexp)
if dist in cfg.frozendists:
whitelist = []
- result, repochanged = copy_sign_move(dist,whitelist)
+ # Check for external changes to repository.
+ if repo_changed(cfg,dist) and not dist in changed:
+ print "Change detected:", dist
+ changed.append(dist)
+ # Release build jobs from needsign queue.
+ result, changedrepo = copy_sign_move(dist,whitelist)
if result:
sys.exit(result)
- if repochanged:
- changed.append(dist)
+ if changedrepo and changedrepo not in changed:
+ changed.append(changedrepo)
brm = BuildReportManager(cfg.rundir,dist)
buildjobs = brm.GetCount()
totalchanges += buildjobs
@@ -451,10 +468,6 @@
MultiLib.main(cfg,changed)
- if changed:
- if cfg.opts.doublesync:
- Utils.run_and_check(cfg.sync_cmd)
-
for dist in changed:
if cfg.opts.repoview:
RepoView.main(cfg,dist)
More information about the fedora-extras-commits
mailing list