fixing gbs_export_if_ifarch_patch.case run error, that is because using items() in python3.x is different from iteritems() in python2.x,
the order is not same.
Change-Id: If06e9f75b2942c748e5b6e37b0ea4290a5c0167b
Signed-off-by: biao716.wang <biao716.wang@samsung.com>
<steps><![CDATA[
(! gbs -c base.cfg chroot 2>&1 |tee log)
-grep "gbs chroot: error: too few arguments" log
+grep "gbs chroot: error: the following arguments are required: buildroot" log
#old: error <usage>: no build root directory specified, please use "--help" for more info
-#new: usage: gbs chroot [-h] [-r] buildroot
-#gbs chroot: error: too few arguments
+#new:
+#usage: gbs chroot [-h] [-r] buildroot
+#gbs chroot: error: the following arguments are required: buildroot
]]></steps>
</testcase>
echo "" >> msg
#write condition into log msg
-echo "Gbp-Rpm: If condition1" >> msg
+echo "Gbp-Rpm: IfArch condition" >> msg
#give two condition
-echo "Gbp-Rpm: IfArch condition2" >> msg
+echo "Gbp-Rpm: If condition2" >> msg
cd fake
gbs export
-grep "%ifarch condition2" packaging/fake-1.0-1/fake.spec
+grep "%ifarch condition" packaging/fake-1.0-1/fake.spec
-#only support one condition (last one)
-( ! grep "%if condition1" packaging/fake-1.0-1/fake.spec )
+#only support one condition (first one)
+( ! grep "%if condition2" packaging/fake-1.0-1/fake.spec )
grep "%endif" packaging/fake-1.0-1/fake.spec
]]></steps>
git checkout master
-DIST=`python -c "import platform; print platform.dist()[0]"`
+DIST=`python3 -c "import distro; print(distro.linux_distribution()[0])"`
-VERSION=`python -c "import platform;print platform.dist()[1]"`
+VERSION=`python3 -c "import distro; print(distro.linux_distribution()[1])"`
if ([ $DIST = centos ] && [ $VERSION \< 7 ] ) || ([ $DIST = SuSE ] && [ $VERSION = 12.1 ]);then
OPTION=--no-log
<testcase>
<summary>GBS package version check</summary>
<steps><![CDATA[
-DIST=`python -c "import platform; print platform.dist()[0]"`
+DIST=`python3 -c "import distro; print(distro.linux_distribution()[0])"`
if [ $DIST = Ubuntu ]||[ $DIST = debian ]; then
# Version: 0.17~rc1 | 0.17
from glob import glob
from itest.utils import check_output
+from functools import reduce
CWD = os.path.dirname(os.path.abspath(__file__))
def sample_files(path, k):
files = [ os.path.join(path, name) for name in os.listdir(path) ]
- idx = random.sample(range(0, len(files)), min(k, len(files)))
+ idx = random.sample(list(range(0, len(files))), min(k, len(files)))
return [ files[i] for i in idx ]
def random_tests():
Cmnd_Alias SED = /bin/sed
Cmnd_Alias TEE = /usr/bin/tee
Cmnd_Alias TOUCH = /bin/touch
-Cmnd_Alias CHROOT = /usr/bin/chroot, /usr/sbin/chroot
+Cmnd_Alias GBSCHROOT = /usr/bin/chroot, /usr/sbin/chroot
Cmnd_Alias MNT = /bin/mount, /bin/umount
Cmnd_Alias SU = /bin/su
Cmnd_Alias FIND = /usr/bin/find
Cmnd_Alias SH = /bin/sh
-build ALL=(ALL) NOPASSWD: GBS, TEST, USER, GIT, FILE_ATTR, RM, SED, TEE, TOUCH, CHROOT, MNT, SU, FIND, SH
+build ALL=(ALL) NOPASSWD: GBS, TEST, USER, GIT, FILE_ATTR, RM, SED, TEE, TOUCH, GBSCHROOT, MNT, SU, FIND, SH