[Why]
config file in some software need storage and recall
now we can add config value in yaml and cp ${config} to
${cci_dir}/${pkgname}/ in PKGBUILD so that config file
can be uploaded correctly
$ cat test.yaml
...
config: ${config}
...
Signed-off-by: Wang Yong <wangyong0117(a)qq.com>
---
tests/build-pkg | 35 ++++++++++++++++++++++++++++++++---
1 file changed, 32 insertions(+), 3 deletions(-)
diff --git a/tests/build-pkg b/tests/build-pkg
index addff9f7b..06a58d498 100755
--- a/tests/build-pkg
+++ b/tests/build-pkg
@@ -4,6 +4,7 @@
# - upstream_commit
# - git_tag
# - pkg_ver
+# - config
# upstream_url
# We'll use the below global env vars, but not treat them as parameter to avoid
@@ -20,6 +21,7 @@
. $LKP_SRC/lib/debug.sh
. $LKP_SRC/distro/common
+. $LKP_SRC/lib/http.sh
check_vars()
{
@@ -31,6 +33,29 @@ check_vars()
[ -n "$os_mount" ] || die "os_mount is empty"
}
+check_config_var()
+{
+ [ -n "$config" ] || return
+}
+
+get_config()
+{
+ local cci_http_host=${INITRD_HTTP_HOST}
+ local cci_http_port=${INITRD_HTTP_PORT:-8800}
+ export cci_dir=/cci/build-config
+ local remote_dir="http://${cci_http_host}:${cci_http_port}${cci_dir}/${pkgname}"
+
+ mkdir -p ${cci_dir}
+
+ check_config_var
+ http_get_file "${remote_dir}/${config}" "${cci_dir}/${pkgname}/${config}"
+}
+
+upload_config()
+{
+ upload_to_target_dir "${cci_dir}/${pkgname}"
+}
+
mount_dest()
{
# the same image is mounted to cifs and nfs, the generated cgz files
@@ -46,7 +71,7 @@ get_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##*/}"
- }
+}
request_pkg()
{
@@ -125,13 +150,17 @@ build_source_pkg()
fi
}
replace_source PKGBUILD.src
-
create_cgz_name
+ get_config
PACMAN=true BUILDDIR=$TMP CARCH=$os_arch PKGEXT=.cgz CGZDEST="$cgz_name" \
$LKP_SRC/sbin/makepkg ${pkg_args} --config $LKP_SRC/etc/makepkg.conf
- [ "$?" == 0 ] || exit 1
+ local build_state="$?"
+
+ upload_config
+
+ [ "${build_state}" == "0" ] || exit 1
create_softlink
upload_to_target_dir ${PKG_MNT}/${pack_to}/${pkgname}
}
--
2.23.0