[PATCH v2 lkp-tests 3/4] test/cci-makepkg: Refactor encapsulate the statement as a function

[why] Encapsulating statements as functions is important for a better syntax. Signed-off-by: Sun Yukui <sun.yukui@foxmail.com> --- tests/cci-makepkg | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/cci-makepkg b/tests/cci-makepkg index a105f189..a87cf01f 100755 --- a/tests/cci-makepkg +++ b/tests/cci-makepkg @@ -92,10 +92,6 @@ cgz_name="${pkgver:-0}-${pkgrel:-0}.cgz" setup_proxy -echo $LKP_SRC/sbin/makepkg -A --skippgpcheck --config $LKP_SRC/etc/makepkg.conf -PACMAN=true BUILDDIR=$TMP CARCH=$arch PKGEXT=.cgz CGZDEST="$sync_dest/$cgz_name" \ - $LKP_SRC/sbin/makepkg -A --skippgpcheck --config $LKP_SRC/etc/makepkg.conf - update_softlink() { [ -e "$sync_dest/$cgz_name" ] || return @@ -109,4 +105,11 @@ update_softlink() rm $sync_dest/$cgz_name } +build_source_pkg(){ + echo $LKP_SRC/sbin/makepkg -A --skippgpcheck --config $LKP_SRC/etc/makepkg.conf + PACMAN=true BUILDDIR=$TMP CARCH=$arch PKGEXT=.cgz CGZDEST="$sync_dest/$cgz_name" \ + $LKP_SRC/sbin/makepkg -A --skippgpcheck --config $LKP_SRC/etc/makepkg.conf +} + +build_source_pkg update_softlink && echo "Makepkg finished successfully" -- 2.23.0

On Tue, Nov 17, 2020 at 11:57:14AM +0800, Sun Yukui wrote:
[why] Encapsulating statements as functions is important for a better syntax.
Signed-off-by: Sun Yukui <sun.yukui@foxmail.com> --- tests/cci-makepkg | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/tests/cci-makepkg b/tests/cci-makepkg index a105f189..a87cf01f 100755 --- a/tests/cci-makepkg +++ b/tests/cci-makepkg @@ -92,10 +92,6 @@ cgz_name="${pkgver:-0}-${pkgrel:-0}.cgz"
setup_proxy
-echo $LKP_SRC/sbin/makepkg -A --skippgpcheck --config $LKP_SRC/etc/makepkg.conf -PACMAN=true BUILDDIR=$TMP CARCH=$arch PKGEXT=.cgz CGZDEST="$sync_dest/$cgz_name" \ - $LKP_SRC/sbin/makepkg -A --skippgpcheck --config $LKP_SRC/etc/makepkg.conf - update_softlink() { [ -e "$sync_dest/$cgz_name" ] || return @@ -109,4 +105,11 @@ update_softlink() rm $sync_dest/$cgz_name }
+build_source_pkg(){
style: add ' ' before {
+ echo $LKP_SRC/sbin/makepkg -A --skippgpcheck --config $LKP_SRC/etc/makepkg.conf
The echo string and cmd string can be merged to a variable.
+ PACMAN=true BUILDDIR=$TMP CARCH=$arch PKGEXT=.cgz CGZDEST="$sync_dest/$cgz_name" \ + $LKP_SRC/sbin/makepkg -A --skippgpcheck --config $LKP_SRC/etc/makepkg.conf +} + +build_source_pkg update_softlink && echo "Makepkg finished successfully" -- 2.23.0

On Tue, Nov 17, 2020 at 02:38:49PM +0800, Wu Fengguang wrote:
On Tue, Nov 17, 2020 at 11:57:14AM +0800, Sun Yukui wrote:
[why] Encapsulating statements as functions is important for a better syntax.
Signed-off-by: Sun Yukui <sun.yukui@foxmail.com> --- tests/cci-makepkg | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/tests/cci-makepkg b/tests/cci-makepkg index a105f189..a87cf01f 100755 --- a/tests/cci-makepkg +++ b/tests/cci-makepkg @@ -92,10 +92,6 @@ cgz_name="${pkgver:-0}-${pkgrel:-0}.cgz"
setup_proxy
-echo $LKP_SRC/sbin/makepkg -A --skippgpcheck --config $LKP_SRC/etc/makepkg.conf -PACMAN=true BUILDDIR=$TMP CARCH=$arch PKGEXT=.cgz CGZDEST="$sync_dest/$cgz_name" \ - $LKP_SRC/sbin/makepkg -A --skippgpcheck --config $LKP_SRC/etc/makepkg.conf - update_softlink() { [ -e "$sync_dest/$cgz_name" ] || return @@ -109,4 +105,11 @@ update_softlink() rm $sync_dest/$cgz_name }
+build_source_pkg(){
style: add ' ' before {
+ echo $LKP_SRC/sbin/makepkg -A --skippgpcheck --config $LKP_SRC/etc/makepkg.conf
The echo string and cmd string can be merged to a variable.
ok Thanks sunyukui
+ PACMAN=true BUILDDIR=$TMP CARCH=$arch PKGEXT=.cgz CGZDEST="$sync_dest/$cgz_name" \ + $LKP_SRC/sbin/makepkg -A --skippgpcheck --config $LKP_SRC/etc/makepkg.conf +} + +build_source_pkg update_softlink && echo "Makepkg finished successfully" -- 2.23.0
participants (2)
-
Sun Yukui
-
Wu Fengguang