Signed-off-by: Zhang Yale ylzhangah@qq.com --- tests/rpmbuild-pkg | 67 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100755 tests/rpmbuild-pkg
diff --git a/tests/rpmbuild-pkg b/tests/rpmbuild-pkg new file mode 100755 index 00000000..8726543e --- /dev/null +++ b/tests/rpmbuild-pkg @@ -0,0 +1,67 @@ +#!/bin/bash +# - rpm_repo + +. $LKP_SRC/lib/debug.sh +. $LKP_SRC/lib/upload.sh + +check_vars() +{ + [ -n "$rpm_repo" ] || die "rpm_repo is empty" +} + +init_dir() +{ + benchmark=${rpm_repo##*/} + RPM_MNT=/initrd/rpmbuild-pkg + mkdir -p "$RPM_MNT" + pack_to=${os_mount}/${os}/${os_arch}/${os_version}/${benchmark} + sync_dest="$RPM_MNT/$pack_to" + rpmdev-setuptree # generate workspace in ${HOME} +} + +get_pkgfile() +{ + curl -sS -H 'Content-Type: Application/json' -XPOST "$LKP_SERVER"':8100/git_command' \ + -d '{"git_repo": "'${rpm_repo}'", "git_command": ["git-show", "HEAD:'$1'"]}' -o "${2}" +} + +request_pkg() +{ + filelist=$(curl -sS -H 'Content-Type: Application/json' -XPOST "$LKP_SERVER"':8100/git_command' \ + -d '{"git_repo": "'${rpm_repo}'", "git_command": ["git-ls-files", "."]}') + local dir="SOURCES" + for pkgfile in ${filelist[*]} + do + echo $pkgfile | egrep ".spec$" && { + dir="SPECS" + } + get_pkgfile "$pkgfile" "${HOME}/rpmbuild/${dir}/$pkgfile" + done +} + +rpmbuild_pkg() +{ + spec_dir=${HOME}/rpmbuild/SPECS/$benchmark.spec + # sed -i 's/^(Source[^ ]*:[ \t]*)https/\1http/g' `grep http -rl $benchmark.spec` + # Install build depends + yum-builddep -y $spec_dir + # Download tar.gz to default path ${HOME}/rpmbuild/SOURCE + spectool -g -R $spec_dir + # Building rpm or srpm packages + rpmbuild -ba $spec_dir +} + +upload_pkg() +{ + #rpm package will be generated in "${HOME}/rpmbuild/SRPMS" and "${HOME}/rpmbuild/RPMS" + for file in $(find ${HOME}/rpmbuild/ -type f -name "*.rpm") + do + upload_one_curl ${file} ${sync_dest} + done +} + +check_vars +init_dir +request_pkg +rpmbuild_pkg +upload_pkg
On Wed, Dec 09, 2020 at 08:02:19PM +0800, Zhang Yale wrote:
Signed-off-by: Zhang Yale ylzhangah@qq.com
tests/rpmbuild-pkg | 67 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100755 tests/rpmbuild-pkg
diff --git a/tests/rpmbuild-pkg b/tests/rpmbuild-pkg new file mode 100755 index 00000000..8726543e --- /dev/null +++ b/tests/rpmbuild-pkg @@ -0,0 +1,67 @@ +#!/bin/bash +# - rpm_repo
+. $LKP_SRC/lib/debug.sh +. $LKP_SRC/lib/upload.sh
+check_vars() +{
- [ -n "$rpm_repo" ] || die "rpm_repo is empty"
+}
+init_dir() +{
- benchmark=${rpm_repo##*/}
- RPM_MNT=/initrd/rpmbuild-pkg
- mkdir -p "$RPM_MNT"
- pack_to=${os_mount}/${os}/${os_arch}/${os_version}/${benchmark}
- sync_dest="$RPM_MNT/$pack_to"
- rpmdev-setuptree # generate workspace in ${HOME}
+}
+get_pkgfile() +{
- curl -sS -H 'Content-Type: Application/json' -XPOST "$LKP_SERVER"':8100/git_command' \
- -d '{"git_repo": "'${rpm_repo}'", "git_command": ["git-show", "HEAD:'$1'"]}' -o "${2}"
+}
+request_pkg() +{
- filelist=$(curl -sS -H 'Content-Type: Application/json' -XPOST "$LKP_SERVER"':8100/git_command' \
-d '{"git_repo": "'${rpm_repo}'", "git_command": ["git-ls-files", "."]}')
- local dir="SOURCES"
- for pkgfile in ${filelist[*]}
- do
echo $pkgfile | egrep "\.spec$" && {
dir="SPECS"
}
get_pkgfile "$pkgfile" "${HOME}/rpmbuild/${dir}/$pkgfile"
- done
+}
+rpmbuild_pkg() +{
- spec_dir=${HOME}/rpmbuild/SPECS/$benchmark.spec
- # sed -i 's/^(Source[^ ]*:[ \t]*)https/\1http/g' `grep http -rl $benchmark.spec`
- # Install build depends
- yum-builddep -y $spec_dir
- # Download tar.gz to default path ${HOME}/rpmbuild/SOURCE
- spectool -g -R $spec_dir
- # Building rpm or srpm packages
- rpmbuild -ba $spec_dir
+}
+upload_pkg() +{
- #rpm package will be generated in "${HOME}/rpmbuild/SRPMS" and "${HOME}/rpmbuild/RPMS"
^------ add space. Thanks, Liushaofei
- for file in $(find ${HOME}/rpmbuild/ -type f -name "*.rpm")
- do
upload_one_curl ${file} ${sync_dest}
- done
+}
+check_vars +init_dir +request_pkg +rpmbuild_pkg
+upload_pkg
2.23.0
On Wed, Dec 09, 2020 at 08:21:56PM +0800, Liu Shaofei wrote:
On Wed, Dec 09, 2020 at 08:02:19PM +0800, Zhang Yale wrote:
Signed-off-by: Zhang Yale ylzhangah@qq.com
tests/rpmbuild-pkg | 67 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100755 tests/rpmbuild-pkg
diff --git a/tests/rpmbuild-pkg b/tests/rpmbuild-pkg new file mode 100755 index 00000000..8726543e --- /dev/null +++ b/tests/rpmbuild-pkg @@ -0,0 +1,67 @@ +#!/bin/bash +# - rpm_repo
+. $LKP_SRC/lib/debug.sh +. $LKP_SRC/lib/upload.sh
+check_vars() +{
- [ -n "$rpm_repo" ] || die "rpm_repo is empty"
+}
+init_dir() +{
- benchmark=${rpm_repo##*/}
- RPM_MNT=/initrd/rpmbuild-pkg
- mkdir -p "$RPM_MNT"
- pack_to=${os_mount}/${os}/${os_arch}/${os_version}/${benchmark}
- sync_dest="$RPM_MNT/$pack_to"
- rpmdev-setuptree # generate workspace in ${HOME}
+}
+get_pkgfile() +{
- curl -sS -H 'Content-Type: Application/json' -XPOST "$LKP_SERVER"':8100/git_command' \
- -d '{"git_repo": "'${rpm_repo}'", "git_command": ["git-show", "HEAD:'$1'"]}' -o "${2}"
+}
+request_pkg() +{
- filelist=$(curl -sS -H 'Content-Type: Application/json' -XPOST "$LKP_SERVER"':8100/git_command' \
-d '{"git_repo": "'${rpm_repo}'", "git_command": ["git-ls-files", "."]}')
- local dir="SOURCES"
- for pkgfile in ${filelist[*]}
- do
echo $pkgfile | egrep "\.spec$" && {
dir="SPECS"
}
get_pkgfile "$pkgfile" "${HOME}/rpmbuild/${dir}/$pkgfile"
- done
+}
+rpmbuild_pkg() +{
- spec_dir=${HOME}/rpmbuild/SPECS/$benchmark.spec
- # sed -i 's/^(Source[^ ]*:[ \t]*)https/\1http/g' `grep http -rl $benchmark.spec`
- # Install build depends
- yum-builddep -y $spec_dir
- # Download tar.gz to default path ${HOME}/rpmbuild/SOURCE
- spectool -g -R $spec_dir
- # Building rpm or srpm packages
- rpmbuild -ba $spec_dir
+}
+upload_pkg() +{
- #rpm package will be generated in "${HOME}/rpmbuild/SRPMS" and "${HOME}/rpmbuild/RPMS"
^------ add space. Thanks, Liushaofei
ok, I forgot it.
Thanks, Yale
- for file in $(find ${HOME}/rpmbuild/ -type f -name "*.rpm")
- do
upload_one_curl ${file} ${sync_dest}
- done
+}
+check_vars +init_dir +request_pkg +rpmbuild_pkg
+upload_pkg
2.23.0