[PATCH v6 lkp-tests 2/2] tests/cci-makepkg: add download PKGBUILD patch function

[Why] Support more version's PKGBUILD. [How] Download the required file through remote-git Signed-off-by: Lin Jiaxin <ljx.joe@qq.com> --- tests/cci-makepkg | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/cci-makepkg b/tests/cci-makepkg index 9551ebfe..c7b4b2df 100755 --- a/tests/cci-makepkg +++ b/tests/cci-makepkg @@ -37,12 +37,30 @@ cd $LKP_SRC/pkg/$benchmark || die "pkg is empty" mount -t cifs -o guest,vers=1.0,noacl,nouser_xattr //$LKP_SERVER$PKG_MNT $PKG_MNT || die "Failed to run mount" } +download_pkgfile() +{ + curl -sS -H 'Content-Type: Application/json' -XPOST "$LKP_SERVER"':8100/git_command' \ + -d '{"git_repo": "'$1'", "git_command": ["git-show", "HEAD:'$2'"]}' -o "$2" +} + +get_pkgfile() +{ + PKGBUILD_TAG="-$PKGBUILD_TAG" + PKGBUILD_TAG_FILE="PKGBUILD$PKGBUILD_TAG" + + download_pkgfile "pkg/$benchmark" "$PKGBUILD_TAG_FILE" + + [ -f "$PKGBUILD_TAG_FILE" ] || die "$PKGBUILD_TAG_FILE not exist" + [ -s "$PKGBUILD_TAG_FILE" ] || die "$PKGBUILD_TAG_FILE is empty" +} + get_pkg_info() { var=$1 pkg_dir=${2:-.} ( . $pkg_dir/PKGBUILD + . $pkg_dir/PKGBUILD$PKGBUILD_TAG eval echo '$'$var ) } @@ -69,6 +87,8 @@ update_shared_pkg() echo "update shared pkg link ${benchmark}.cgz -> ${bm_name}/${cgz_name}" } +[ -n "$PKGBUILD_TAG" ] && get_pkgfile + distro_install_depends lkp-dev [ $os = "centos" ] && -- 2.23.0

On Tue, Nov 10, 2020 at 04:01:42PM +0800, Lin Jiaxin wrote:
[Why] Support more version's PKGBUILD.
[How] Download the required file through remote-git
What if no tag? What if no file for the tag? Thanks, Fengguang
Signed-off-by: Lin Jiaxin <ljx.joe@qq.com> --- tests/cci-makepkg | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
diff --git a/tests/cci-makepkg b/tests/cci-makepkg index 9551ebfe..c7b4b2df 100755 --- a/tests/cci-makepkg +++ b/tests/cci-makepkg @@ -37,12 +37,30 @@ cd $LKP_SRC/pkg/$benchmark || die "pkg is empty" mount -t cifs -o guest,vers=1.0,noacl,nouser_xattr //$LKP_SERVER$PKG_MNT $PKG_MNT || die "Failed to run mount" }
+download_pkgfile() +{ + curl -sS -H 'Content-Type: Application/json' -XPOST "$LKP_SERVER"':8100/git_command' \ + -d '{"git_repo": "'$1'", "git_command": ["git-show", "HEAD:'$2'"]}' -o "$2" +} + +get_pkgfile() +{ + PKGBUILD_TAG="-$PKGBUILD_TAG" + PKGBUILD_TAG_FILE="PKGBUILD$PKGBUILD_TAG" + + download_pkgfile "pkg/$benchmark" "$PKGBUILD_TAG_FILE" + + [ -f "$PKGBUILD_TAG_FILE" ] || die "$PKGBUILD_TAG_FILE not exist" + [ -s "$PKGBUILD_TAG_FILE" ] || die "$PKGBUILD_TAG_FILE is empty" +} + get_pkg_info() { var=$1 pkg_dir=${2:-.} ( . $pkg_dir/PKGBUILD + . $pkg_dir/PKGBUILD$PKGBUILD_TAG eval echo '$'$var ) } @@ -69,6 +87,8 @@ update_shared_pkg() echo "update shared pkg link ${benchmark}.cgz -> ${bm_name}/${cgz_name}" }
+[ -n "$PKGBUILD_TAG" ] && get_pkgfile + distro_install_depends lkp-dev
[ $os = "centos" ] && -- 2.23.0

On Tue, Nov 10, 2020 at 04:21:58PM +0800, Wu Fengguang wrote:
On Tue, Nov 10, 2020 at 04:01:42PM +0800, Lin Jiaxin wrote:
[Why] Support more version's PKGBUILD.
[How] Download the required file through remote-git
What if no tag?
same as before
What if no file for the tag?
It will report an error. Thanks, Jiaxin
Thanks, Fengguang
participants (2)
-
Lin Jiaxin
-
Wu Fengguang