[PATCH v2 lkp-tests 2/4] test/build-pkg: fix a softlink will be established if the package fails

After packaging fails, a softlink will be established, but this is wrong. If the packaging fails, the softlink should not be established. Signed-off-by: Sun Yukui <sun.yukui@foxmail.com> --- tests/build-pkg | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/build-pkg b/tests/build-pkg index 6426f2da..8d5fc7d4 100755 --- a/tests/build-pkg +++ b/tests/build-pkg @@ -101,10 +101,11 @@ build_source_pkg() cgz_name="$PKG_MNT/${pack_to}/${pkgname}/${upstream_commit}.cgz" PACMAN=true BUILDDIR=$TMP CARCH=$os_arch PKGEXT=.cgz CGZDEST="$cgz_name" \ $LKP_SRC/sbin/makepkg -A --check --skippgpcheck --config $LKP_SRC/etc/makepkg.conf 2>&1 + + [ "$?" == 0 ] || create_softlink } check_vars mount_dest request_pkg build_source_pkg -create_softlink -- 2.23.0

On Tue, Nov 17, 2020 at 11:57:13AM +0800, Sun Yukui wrote:
After packaging fails, a softlink will be established, but this is wrong. If the packaging fails, the softlink should not be established.
Signed-off-by: Sun Yukui <sun.yukui@foxmail.com> --- tests/build-pkg | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tests/build-pkg b/tests/build-pkg index 6426f2da..8d5fc7d4 100755 --- a/tests/build-pkg +++ b/tests/build-pkg @@ -101,10 +101,11 @@ build_source_pkg() cgz_name="$PKG_MNT/${pack_to}/${pkgname}/${upstream_commit}.cgz" PACMAN=true BUILDDIR=$TMP CARCH=$os_arch PKGEXT=.cgz CGZDEST="$cgz_name" \ $LKP_SRC/sbin/makepkg -A --check --skippgpcheck --config $LKP_SRC/etc/makepkg.conf 2>&1 + ^ redundant line.
+ [ "$?" == 0 ] || create_softlink
Your code is inconsistent with your changelog, your changelog says If the packaging fails, the softlink should not be established. if so, change like this: [ "$?" == 0 ] && create_softlink Thanks, Zhangyu
}
check_vars mount_dest request_pkg build_source_pkg -create_softlink -- 2.23.0

On Tue, Nov 17, 2020 at 02:41:58PM +0800, Zhang Yu wrote:
On Tue, Nov 17, 2020 at 11:57:13AM +0800, Sun Yukui wrote:
After packaging fails, a softlink will be established, but this is wrong. If the packaging fails, the softlink should not be established.
Signed-off-by: Sun Yukui <sun.yukui@foxmail.com> --- tests/build-pkg | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tests/build-pkg b/tests/build-pkg index 6426f2da..8d5fc7d4 100755 --- a/tests/build-pkg +++ b/tests/build-pkg @@ -101,10 +101,11 @@ build_source_pkg() cgz_name="$PKG_MNT/${pack_to}/${pkgname}/${upstream_commit}.cgz" PACMAN=true BUILDDIR=$TMP CARCH=$os_arch PKGEXT=.cgz CGZDEST="$cgz_name" \ $LKP_SRC/sbin/makepkg -A --check --skippgpcheck --config $LKP_SRC/etc/makepkg.conf 2>&1 + ^ redundant line.
+ [ "$?" == 0 ] || create_softlink
Your code is inconsistent with your changelog, your changelog says If the packaging fails, the softlink should not be established. if so, change like this: [ "$?" == 0 ] && create_softlink
[ $? == 0 ] => this mean that build failure, the condition is true. if condition is true, should not create softlink, so use "||" to be correct. Thanks, Liushaofei
Thanks, Zhangyu
}
check_vars mount_dest request_pkg build_source_pkg -create_softlink -- 2.23.0

Your code is inconsistent with your changelog, your changelog says If the packaging fails, the softlink should not be established. if so, change like this: [ "$?" == 0 ] && create_softlink
[ $? == 0 ] => this mean that build failure, the condition is true.
if condition is true, should not create softlink, so use "||" to be correct.
Oh, sorry i misunderstood. i thought [ $? == 0 ] this mean that build success. Thanks, Zhangyu
participants (3)
-
Liu Shaofei
-
Sun Yukui
-
Zhang Yu