xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Ian Jackson <ian.jackson@eu.citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Ian Jackson <ian.jackson@eu.citrix.com>,
	Ian Campbell <ian.campbell@citrix.com>
Subject: [OSSTEST PATCH 25/33] New utility mg-adjust-flight-makexrefs
Date: Thu, 17 Sep 2015 18:37:52 +0100	[thread overview]
Message-ID: <1442511480-32587-26-git-send-email-ian.jackson@eu.citrix.com> (raw)
In-Reply-To: <1442511480-32587-1-git-send-email-ian.jackson@eu.citrix.com>

This provides a fairly cooked way of adjusting an existing flight to
reuse previous builds.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
v2: New patch
---
 mg-adjust-flight-makexrefs |   83 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 83 insertions(+)
 create mode 100755 mg-adjust-flight-makexrefs

diff --git a/mg-adjust-flight-makexrefs b/mg-adjust-flight-makexrefs
new file mode 100755
index 0000000..ebbac15
--- /dev/null
+++ b/mg-adjust-flight-makexrefs
@@ -0,0 +1,83 @@
+#!/bin/bash
+#
+# usage: ./mg-adjust-flight-makexrefs [OPTIONS..] FLIGHT	\
+#		'[!]JOB-GLOB ...'		  		\
+#		REF-CONDS...
+#
+# JOB-GLOB is as for shell `case'.  Sense of first match is used.
+# If no match for a job, uses reverse of sense of last glob.
+#
+# ! means keep such jobs in FLIGHT.  Without ! means delete each such
+# job from FLIGHT and replace intra-flight references to it with
+# references to the same job in a suitable other flight.
+#
+# `Suitable' means one in which the required job passed, subject to
+# REF-CONDS (which are passed to sg-check-tested).  REF-CONDS really
+# ought to include --blessings=BLESSING,... and should probably also
+# include some --branch=REF-BRANCH.
+#
+# Options:
+#   -v      Pass -v to cs-adjust-flight
+#   -D      Print our own debugging output to stderr (consider
+#             passing --debug in REF-CONDS too)
+#   -n      Dry run: do not actually run cs-adjust-flight
+
+set -e
+
+exec 3>/dev/null
+verbose=''
+
+badusage () { echo >&2 "$0: bad usage"; exit 1; }
+
+while true; do
+	case "$1" in
+	-n)	dryrun="echo" ;;
+	-v)	verbose=-v ;;
+	-D)	exec 3>&2 ;;
+	-*)	badusage ;;
+	*)	break ;;
+	esac
+	shift
+done
+
+if [ $# -le 2 ]; then badusage; fi
+
+flight=$1; shift
+keepjobs=$1; shift
+
+for j in `./cs-adjust-flight $flight jobs-list '^build-'`; do
+
+	tokeep=continue
+	todelete=:
+
+	for glob in $keepjobs; do
+		case "$glob" in
+		!*) ifmatch=$tokeep; action=$todelete ; glob="${glob#!}" ;;
+		*)  ifmatch=$todelete; action=$tokeep ;;
+		esac
+
+		case "$j" in
+		$glob)
+			action=$ifmatch
+			echo >&3 "ADJUST XREF $j match=$glob $action"
+			break
+			;;
+		esac
+	done
+
+	# `doaction=continue'	=> job remains
+	# `doaction=:'		=> job gets deleted
+	echo >&3 "ADJUST XREF $j ACTION $action"
+	$action
+
+	# OK, process $j
+
+	ref=`./sg-check-tested --pass-job="$j" "$@"`
+	echo >&3 "ADJUST XREF $j r=$ref"
+	if [ "x$ref" = x ]; then continue; fi
+
+	$dryrun \
+	./cs-adjust-flight $verbose $flight \
+		runvar-change . '/buildjob$' "$j" "$ref.$j" \
+		jobs-del "$j"
+done
-- 
1.7.10.4

  parent reply	other threads:[~2015-09-17 17:38 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-17 17:37 [OSSTEST PATCH v2 00/33] xen.git#staging smoke tests Ian Jackson
2015-09-17 17:37 ` [OSSTEST PATCH 01/33] docs: Document OSSTEST_RESOURCE_PRIORITY values in README.planner Ian Jackson
2015-09-17 17:37 ` [OSSTEST PATCH 02/33] Executive: cs-job-create: Check that OSSTEST_FLIGHT is not set Ian Jackson
2015-09-17 17:37 ` [OSSTEST PATCH 03/33] mg-list-all-branches: Suppress `maintjobs' Ian Jackson
2015-09-17 17:37 ` [OSSTEST PATCH 04/33] standalone: Do not blunder on after errors Ian Jackson
2015-09-17 17:37 ` [OSSTEST PATCH 05/33] standalone: Set very long SQLite3 busy timeout in Perl Ian Jackson
2015-09-17 17:37 ` [OSSTEST PATCH 06/33] cr-daily-branch: Honour AP_FETCH_PFX Ian Jackson
2015-09-17 17:37 ` [OSSTEST PATCH 07/33] memoise: New utility Ian Jackson
2015-09-18  9:25   ` Ian Campbell
2015-09-17 17:37 ` [OSSTEST PATCH 08/33] standalone-generate-dump-flight-runvars: memoise ap-fetch Ian Jackson
2015-09-17 17:37 ` [OSSTEST PATCH 09/33] standalone mode: Fix two SQL `TRUE's Ian Jackson
2015-09-18  9:26   ` Ian Campbell
2015-09-17 17:37 ` [OSSTEST PATCH 10/33] mfi-common: Use job_create_build for build-*-prev Ian Jackson
2015-09-17 17:37 ` [OSSTEST PATCH 11/33] ap-fetch-version*: Unwrap xen-unstable lines Ian Jackson
2015-09-17 17:37 ` [OSSTEST PATCH 12/33] ap-push: Use refs/heads/ for destinations Ian Jackson
2015-09-17 17:37 ` [OSSTEST PATCH 13/33] cr-ensure-disk-space: Honour -D Ian Jackson
2015-09-17 17:37 ` [OSSTEST PATCH 14/33] cr-ensure-disk-space: Look at referring flights Ian Jackson
2015-09-17 17:37 ` [OSSTEST PATCH 15/33] cr-ensure-disk-space: Make main loop body into a subroutine Ian Jackson
2015-09-17 17:37 ` [OSSTEST PATCH 16/33] cr-ensure-disk-space: Take the flights db lock Ian Jackson
2015-09-17 17:37 ` [OSSTEST PATCH 17/33] cs-job-create: Permit creation of `synth' runvars Ian Jackson
2015-09-17 17:37 ` [OSSTEST PATCH 18/33] mg-show-flight-runvars: Decorate synth runvar names with ~ Ian Jackson
2015-09-18  9:27   ` Ian Campbell
2015-09-17 17:37 ` [OSSTEST PATCH 19/33] standalone-generate-dump-flight-runvars: Show synth runvars Ian Jackson
2015-09-17 17:37 ` [OSSTEST PATCH 20/33] ts-host-alloc-Executive: Honour various hostalloc_* runvars Ian Jackson
2015-09-17 17:37 ` [OSSTEST PATCH 21/33] sg-check-tested: New --pass-job= option Ian Jackson
2015-09-18  9:30   ` Ian Campbell
2015-09-17 17:37 ` [OSSTEST PATCH 22/33] cs-adjust-flight: Provide `jobs-list' operation Ian Jackson
2015-09-18  9:30   ` Ian Campbell
2015-09-17 17:37 ` [OSSTEST PATCH 23/33] cs-adjust-flight: Break out job removal machinery Ian Jackson
2015-09-18  9:31   ` Ian Campbell
2015-09-17 17:37 ` [OSSTEST PATCH 24/33] cs-adjust-flight: Provide `jobs-del' operation Ian Jackson
2015-09-18  9:31   ` Ian Campbell
2015-09-18 11:13     ` Ian Jackson
2015-09-17 17:37 ` Ian Jackson [this message]
2015-09-18  9:47   ` [OSSTEST PATCH 25/33] New utility mg-adjust-flight-makexrefs Ian Campbell
2015-09-17 17:37 ` [OSSTEST PATCH 26/33] make-flight: Contemplate varying architecture for Debian HVM Ian Jackson
2015-09-17 17:37 ` [OSSTEST PATCH 27/33] make-flight: Run job_create_test_filter_callback on true job name Ian Jackson
2015-09-17 17:37 ` [OSSTEST PATCH 28/33] make-flight: mfi-common: Honour $global_runvars Ian Jackson
2015-09-17 17:37 ` [OSSTEST PATCH 29/33] make-flight: Provide xen-unstable-smoke branch Ian Jackson
2015-09-18  9:50   ` Ian Campbell
2015-09-18 11:18     ` Ian Jackson
2015-09-18 11:23       ` Ian Campbell
2015-09-17 17:37 ` [OSSTEST PATCH 30/33] cr-daily-branch: Use mg-adjust-flight to have smoke tests reuse builds Ian Jackson
2015-09-18  9:52   ` Ian Campbell
2015-09-18 11:19     ` Ian Jackson
2015-09-17 17:37 ` [OSSTEST PATCH 31/33] cri-common: Support xen-unstable-smoke Ian Jackson
2015-09-17 17:37 ` [OSSTEST PATCH 32/33] ap-*: Be able to fetch and push xen.git#smoke Ian Jackson
2015-09-17 17:38 ` [OSSTEST PATCH 33/33] crontab: Enable xen-unstable-smoke branch every 3h at <1mod3>:51 UTC Ian Jackson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1442511480-32587-26-git-send-email-ian.jackson@eu.citrix.com \
    --to=ian.jackson@eu.citrix.com \
    --cc=ian.campbell@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).