port to python3.x code 09/293309/6
authorbiao716.wang <biao716.wang@samsung.com>
Wed, 24 May 2023 08:52:07 +0000 (17:52 +0900)
committerbiao716.wang <biao716.wang@samsung.com>
Wed, 31 May 2023 07:41:14 +0000 (16:41 +0900)
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>
cases/chroot/test_chroot_no_option.case
cases/export/gbs_export_if_ifarch_patch.case
cases/export/gbs_export_with_merge_commit_in_git-log.case
cases/other/gbs_version_check.case
settings.py
sudoers.itest_cases_gbs

index 9459886c8889940d490db1aeb786a16bbc23d600..6cb212e6ccb421556d9b7d7ae62e7388b4bd1e4a 100644 (file)
@@ -9,10 +9,11 @@
   <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>
index 263529bf0a2e5e3e74ffb1c66cb22284bd0d73b0..f119615711507c72e6ffabc4882b4757c2b77385 100644 (file)
@@ -15,10 +15,10 @@ echo "modify" >> msg
 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
 
@@ -34,10 +34,10 @@ git commit --file=../msg
 
 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>
index a9b5300bb553661c95c5a433820c82d1baf8082f..eed9a12c9b8d0991143754671b42ea402e22b8a5 100644 (file)
@@ -28,9 +28,9 @@ git commit -a -m "first moidfy README"
 
 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
index 7526e84994bbbf43e4fd5b1d28b1552fb96ea2e6..5adc62b1bbd4abdb9543d144bd2a25527e2e4592 100644 (file)
@@ -1,7 +1,7 @@
 <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
index c10924eb777229218270c61d43c8b051f2e9a3f5..cf214f62148ca3964199eb4ce36404fc6fd722a7 100644 (file)
@@ -6,6 +6,7 @@ import subprocess
 from glob import glob
 
 from itest.utils import check_output
+from functools import reduce
 
 
 CWD = os.path.dirname(os.path.abspath(__file__))
@@ -27,7 +28,7 @@ SUDO_PASSWD = os.environ.get('ITEST_SUDO_PASSWD', '123456')
 
 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():
index 5ccc828bc081f27e074d8b4c84e28fe0923da975..ded25a889d01b4d1deb287558022bea5f4be1632 100644 (file)
@@ -7,10 +7,10 @@ Cmnd_Alias RM = /bin/rm -rf /home/build/testspace, /bin/rm -rf /tmp/itestuser*,
 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