diff mbox

[Branch,~linaro-validation/lava-dispatcher/trunk] Rev 566: Do not call distro-specific code unconditionally

Message ID 20130326174314.24053.51353.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Antonio Terceiro March 26, 2013, 5:43 p.m. UTC
Merge authors:
  Antonio Terceiro (terceiro)
Related merge proposals:
  https://code.launchpad.net/~terceiro/lava-dispatcher/lava-test-shell-oe/+merge/155283
  proposed by: Antonio Terceiro (terceiro)
  review: Approve - Senthil Kumaran S (stylesen)
------------------------------------------------------------
revno: 566 [merge]
fixes bug: https://launchpad.net/bugs/1154583
committer: Antonio Terceiro <antonio.terceiro@linaro.org>
branch nick: trunk
timestamp: Tue 2013-03-26 14:40:23 -0300
message:
  Do not call distro-specific code unconditionally
modified:
  lava_test_shell/lava-test-runner-ubuntu


--
lp:lava-dispatcher
https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk

You are subscribed to branch lp:lava-dispatcher.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'lava_test_shell/lava-test-runner-ubuntu'
--- lava_test_shell/lava-test-runner-ubuntu	2013-01-28 08:51:59 +0000
+++ lava_test_shell/lava-test-runner-ubuntu	2013-03-15 16:50:30 +0000
@@ -5,6 +5,12 @@ 
 RESULTSDIR="/lava/results"
 BINDIR="/lava/bin"
 
+detect_distro() {
+	test -x /usr/bin/dpkg-query && echo "debian_based" && return
+
+	echo "unknown"
+}
+
 hwcontext()
 {
 	mkdir -p ${RESULTSDIR}/hwcontext
@@ -15,7 +21,17 @@ 
 	[ -f ${meminfo} ] || cat /proc/meminfo > ${meminfo}
 }
 
-swcontext()
+unknown_swcontext() {
+	mkdir -p ${RESULTSDIR}/swcontext
+	build=${RESULTSDIR}/swcontext/build.txt
+	pkgs=${RESULTSDIR}/swcontext/pkgs.txt
+
+	# we don't know about the software context
+	echo 'Unsupported distro: cannot determine build version' > "$build"
+	echo 'Unsupported distro: cannot obtain list of installed packages' > "$pkgs"
+}
+
+debian_based_swcontext()
 {
 	mkdir -p ${RESULTSDIR}/swcontext
 	build=${RESULTSDIR}/swcontext/build.txt
@@ -27,6 +43,10 @@ 
 	[ -f ${pkgs} ]  || dpkg-query -W -f '${status} ${package} : ${version}\n' | sed -n 's/^install ok installed/package:/p'  > ${pkgs}
 }
 
+swcontext() {
+	distro=$(detect_distro)
+	${distro}_swcontext
+}
 
 cleanup()
 {