[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(a)huawei.com>
---
tests/build-pkg | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/tests/build-pkg b/tests/build-pkg
index 1eed784f..9fd03bab 100755
--- a/tests/build-pkg
+++ b/tests/build-pkg
@@ -7,7 +7,7 @@
# - upstream_repo
# - upstream_url
# - upstream_commit
-# - upstream_tag
+# - PKGBUILD_TAG
## makepkg is a script that automates the building of packages; it can download and validate source files,
## check dependencies, configure build-time settings, compile the sources, install into a temporary root,
@@ -61,6 +61,15 @@ request_pkg()
get_pkgfile "${pkgrepo}" "$pkgfile"
done
+ # download PKGBUILD-$tag
+ benchmark="${upstream_repo##*/}"
+ benchmark="${benchmark%.git}"
+ [ -n "$PKGBUILD_TAG" ] && {
+ get_pkgfile "pkg/$benchmark" "PKGBUILD-$PKGBUILD_TAG"
+ [ -f "PKGBUILD-$PKGBUILD_TAG" ] || die "PKGBUILD-$PKGBUILD_TAG not exist"
+ [ -s "PKGBUILD-$PKGBUILD_TAG" ] || die "PKGBUILD-$PKGBUILD_TAG is empty"
+ }
+
[ -f PKGBUILD ] || die "PKGBUILD not exist"
[ -s PKGBUILD ] || die "PKGBUILD is empty"
}
@@ -81,6 +90,9 @@ build_source_pkg()
upstream_source="source=(\"${repo_dir}git://${LKP_SERVER}/${upstream_repo}#commit=${upstream_commit}\")"
sed -i "s|^source=.*|${upstream_source}|g" PKGBUILD
+ [ -n "$PKGBUILD_TAG" ] && {
+ sed -i "s|^source=.*|${upstream_source}|g" "PKGBUILD-$PKGBUILD_TAG"
+ }
}
cgz_name="$PKG_MNT/${pack_to}/${pkgname}/${upstream_commit}.cgz"
@@ -95,9 +107,9 @@ create_softlink()
local soft_path="$PKG_MNT/${pack_to}/${pkgname}"
local bm_name=$(basename $(realpath ${cgz_name}))
- if [ -n "$upstream_tag" ]; then
- echo "create soft link: ${upstream_tag}.cgz -> ${bm_name}"
- ln -sf "${bm_name}" "${soft_path}/${upstream_tag}.cgz"
+ if [ -n "$PKGBUILD_TAG" ]; then
+ echo "create soft link: ${PKGBUILD_TAG}.cgz -> ${bm_name}"
+ ln -sf "${bm_name}" "${soft_path}/${PKGBUILD_TAG}.cgz"
fi
echo "create soft link: latest.cgz -> ${bm_name}"
--
2.23.0