Skip to contentSkip to conversation

Add some sanity checks for presence of Repos configuration

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

lore
Share & tools
lore
#0 lore raw

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

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.

---
 README         |  6 ++++++
 cri-lock-repos |  8 ++++++++
 standalone     | 15 +++++++++++++++
 3 files changed, 29 insertions(+)
README +6 -0
index 44e2989..a53fdc4 100644
@@ -422,6 +422,12 @@ 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-lock-repos +8 -0
index 7d10c87..ee0d9ba 100644
@@ -20,6 +20,14 @@
 . cri-common
 
 repos=`getconfig Repos`
+if [ -z "$repos" ] ; then
+	echo "Repos must be configured in $config" >&2
+	exit 1
+fi
+if [ ! -d "$repos" ] ; then
+	echo "Repos $repos does not exist" >&2
+	exit 1
+fi
 repos_lock="$repos/lock"
 
 if [ "x$OSSTEST_REPOS_LOCK_LOCKED" != "x$repos_lock" ]; then
standalone +15 -0
index 91d18b5..a81a648 100755
@@ -142,6 +142,20 @@ need_host() {
     fi
 }
 
+check_repos() {
+    local repos=`OSSTEST_CONFIG=$config 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
+}
+
 ensure_logs() {
     if [ ! -d "logs" ] ; then
 	mkdir "logs"
@@ -171,6 +185,7 @@ case $op in
 	;;
 
     make-flight)
+        check_repos
         need_flight
 
         if [ $# -lt 1 ] ; then
Signature · 1 line
2.1.4
#1 lore raw
Quoted 9 lines · Ian Campbell

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.

Regards,
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

#2 lore raw
In reply to Ian Campbell

Ian Campbell writes ("[PATCH OSSTEST] Add some sanity checks for presence of Repos configuration"):

Quoted 10 lines

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.

I agree this should be improved, thanks.

README Stash · line 425

Quoted 9 lines
README +1 -0
index 44e2989..a53fdc4 100644
@@ -422,6 +422,12 @@ Stash
 Images
 Logs
 
+Repos              Full path to a temporary directory where repositories \

can

README Stash · line 426

Quoted 1 line
README +1 -0
+		   be cloned. This is needed for anything which uses cr-dail\

y-branch,

README Stash · line 427

Quoted 1 line
README +1 -0
+		   including "./standalone make-flight" and

Shows wrap damage on my screen, as you see.

Quoted 12 lines
cri-lock-repos +4 -0
index 7d10c87..ee0d9ba 100644
@@ -20,6 +20,14 @@
 . cri-common
 
 repos=`getconfig Repos`
+if [ -z "$repos" ] ; then
+	echo "Repos must be configured in $config" >&2
+	exit 1
+fi

...

cri-lock-repos

Quoted 6 lines
cri-lock-repos +6 -0
+check_repos() {
+    local repos=`OSSTEST_CONFIG=$config getconfig Repos`
+    if [ -z "$repos" ] ; then
+	echo "Repos must be configured in $config" >&2
+	exit 1
+    fi

...

This is the same code twice. I think check_repos could live in cri-getconfig.

Ian.