Skip to contentSkip to conversation

Add some sanity checks for presence of Repos configuration

PATCH In review Ian Campbell 2 participants 2 messages Jun 23, 2015

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Add some sanity checks for presence of Repos configuration

By providing an explicit fetch method in cri-getconfig which checks things.

Without this then anything which uses cr-daily-branch produces the rather cryptic:

+ test -f daily.xsettings
++ ./ap-print-url xen-unstable
with-lock-ex ./ap-print-url: /lock: Permission denied
+ treeurl=
FAILED rc=255

Which has caught out one or two people using standalone mode.

---
v2: README wrapping
Move into a cri-getconfig helper (invalidating Dario's T-a-a-b)

---
 README         |  5 +++++
 cri-getconfig  | 15 +++++++++++++++
 cri-lock-repos |  2 +-
 standalone     |  7 +++++++
 4 files changed, 28 insertions(+), 1 deletion(-)
README +5 -0
index 44e2989..c3508a3 100644
@@ -422,6 +422,11 @@ Stash
 Images
 Logs
 
+Repos              Full path to a temporary directory where repositories
+                   can be cloned. This is needed for anything which uses
+                   cr-daily-branch, including "./standalone make-flight"
+                   and "standalone-generate-dump-flight-runvars".
+
 DebianSuite
 GuestDebianSuite   defaults to DebianSuite
 
cri-getconfig +15 -0
index a19b900..0589bf0 100644
@@ -24,3 +24,18 @@ getconfig () {
                 print $c{"'$1'"} or die $!;
         '
 }
+
+getrepos() {
+	local repos=`getconfig Repos`
+	if [ -z "$repos" ] ; then
+		echo "Repos must be configured in $config" >&2
+		exit 1
+	fi
+	if [ ! -d "$repos" ] ; then
+		# Is likely an absolute path, so don't create automatically,
+		# just in case...
+		echo "Repos $repos does not exist" >&2
+		exit 1
+	fi
+	echo $repos
+}
cri-lock-repos +1 -1
index 7d10c87..c8269f3 100644
@@ -19,7 +19,7 @@
 
 . cri-common
 
-repos=`getconfig Repos`
+repos=`getrepos`
 repos_lock="$repos/lock"
 
 if [ "x$OSSTEST_REPOS_LOCK_LOCKED" != "x$repos_lock" ]; then
standalone +7 -0
index 91d18b5..c89347f 100755
@@ -142,6 +142,12 @@ need_host() {
     fi
 }
 
+check_repos() {
+    # We don't care about the answer, just the error checking and
+    # logging to stderr.
+    OSSTEST_CONFIG=$config getrepos >/dev/null
+}
+
 ensure_logs() {
     if [ ! -d "logs" ] ; then
 	mkdir "logs"
@@ -171,6 +177,7 @@ case $op in
 	;;
 
     make-flight)
+        check_repos
         need_flight
 
         if [ $# -lt 1 ] ; then
Signature · 1 line
2.1.4
#1 lore raw
Quoted 12 lines · Ian Campbell

By providing an explicit fetch method in cri-getconfig which checks things.

Without this then anything which uses cr-daily-branch produces the rather cryptic:

+ test -f daily.xsettings
++ ./ap-print-url xen-unstable
with-lock-ex ./ap-print-url: /lock: Permission denied
+ treeurl=
FAILED rc=255

Quoted 5 lines

Which has caught out one or two people using standalone mode.

Dario

Signature · 4 lines
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://about.me/dario.faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel