summarylogtreecommitdiffstats
path: root/xpath.patch
blob: 6c57b93c6429d7e3da994dcd7185922df4f3b560 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
diff -aur src/openscap-1.2.8/tests/test_common.sh.in src/openscap-1.2.8-patch/tests/test_common.sh.in
--- src/openscap-1.2.8/tests/test_common.sh.in	2016-01-18 10:18:42.000000000 +0100
+++ src/openscap-1.2.8-patch/tests/test_common.sh.in	2016-04-13 22:15:31.866559193 +0200
@@ -26,11 +26,7 @@
 
 export XMLDIFF="@abs_top_srcdir@/tests/xmldiff.pl"
 
-if ! XPATH=`command -v xpath 2>&1`; then
-  echo "I require xpath tool but it's not installed. Aborting." >&2
-  exit 1
-fi
-export XPATH
+export XPATH=xpath_wrapper
 
 # Overall test result.
 result=0
@@ -163,3 +160,18 @@
         fi
 }
 export -f assert_exists
+
+xpath_wrapper() {
+XPATH_BIN="/usr/bin/vendor_perl/xpath"
+if [ "$#" -eq 1 ];
+then
+	# read file from stdin
+	xpath_expr="$1"
+	$XPATH_BIN -e "$xpath_expr"
+else
+	file="$1"
+	xpath_expr="$2"
+	$XPATH_BIN -e "$xpath_expr" "$file"
+fi
+}
+export -f xpath_wrapper