[PATCH lkp-tests] tests/build-pkg: add download PKGBUILD-$tag function

[why] Support more version's PKGBUILD to build different version software. [how] Download the PKGBUILD-$tag file through remote-git server from "/srv/git/pkg/" usage: 1) append upstream_tag field from build-pkg.yaml 2) create git repo that named by software name of $upstream_repo in "/srv/git/pkg/", and add PKGBUILD-$tag file to the directory of "/srv/git/pkg/$upstream_repo". if not PKGBUILD-$tag, the software is built with PKGBUILD. Signed-off-by: Liu Shaofei <liushaofei5@huawei.com> --- tests/build-pkg | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/build-pkg b/tests/build-pkg index 1eed784f..5d2fb792 100755 --- a/tests/build-pkg +++ b/tests/build-pkg @@ -61,6 +61,15 @@ request_pkg() get_pkgfile "${pkgrepo}" "$pkgfile" done + # download PKGBUILD-$tag + benchmark="${upstream_repo##*/}" + benchmark="${benchmark%.git}" + [ -n "$upstream_tag" ] && { + get_pkgfile "pkg/$benchmark" "PKGBUILD-$upstream_tag" + [ -f "PKGBUILD-$upstream_tag" ] || die "PKGBUILD-$upstream_tag not exist" + [ -s "PKGBUILD-$upstream_tag" ] || die "PKGBUILD-$upstream_tag is empty" + } + [ -f PKGBUILD ] || die "PKGBUILD not exist" [ -s PKGBUILD ] || die "PKGBUILD is empty" } @@ -80,7 +89,10 @@ build_source_pkg() fi upstream_source="source=(\"${repo_dir}git://${LKP_SERVER}/${upstream_repo}#commit=${upstream_commit}\")" - sed -i "s|^source=.*|${upstream_source}|g" PKGBUILD + sed -i "s|^source=.*|${upstream_source}|g" "PKGBUILD" + [ -n "$upstream_tag" ] && { + sed -i "s|^source=.*|${upstream_source}|g" "PKGBUILD-$upstream_tag" + } } cgz_name="$PKG_MNT/${pack_to}/${pkgname}/${upstream_commit}.cgz" -- 2.23.0
participants (1)
-
Liu Shaofei