Signed-off-by: Zhang Yale ylzhangah@qq.com --- tests/rpmbuild-pkg | 81 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100755 tests/rpmbuild-pkg
diff --git a/tests/rpmbuild-pkg b/tests/rpmbuild-pkg new file mode 100755 index 00000000..9765eddb --- /dev/null +++ b/tests/rpmbuild-pkg @@ -0,0 +1,81 @@ +#!/bin/bash +# - benchmark +# - rpm_spec +# - os_mount +# - os +# - os_arch +# - os_version + +. $LKP_SRC/lib/debug.sh +. $LKP_SRC/lib/upload.sh + +check_vars() +{ + [ -n "$benchmark" ] || die "benchmark is empty" + [ -n "$os_mount" ] || die "os_mount is empty" + [ -n "$os" ] || die "os is empty" + [ -n "$os_arch" ] || die "os_arch is empty" + [ -n "$os_version" ] || die "os_version is empty" + [ -n "$rpm_spec" ] || die "rpm_spec is empty" +} + +PKG_MNT=/initrd/rpmbuild-pkg +mkdir -p "$PKG_MNT" +pack_to=${os_mount}/${os}/${os_arch}/${os_version}/${benchmark} +sync_dest="$PKG_MNT/$pack_to" + +install_tools() +{ + yum clean all + yum -y install rpm-build + yum -y install rpmdevtools + mkdir -p ~/rpmbuild/{SPECS,SRPMS,SOURCES,BUILD,RPMS} +} + +get_pkgfile() +{ + curl -sS -H 'Content-Type: Application/json' -XPOST "$LKP_SERVER"':8100/git_command' \ + -d '{"git_repo": "'${rpm_spec}'", "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_spec}'", "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=~/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 ~/rpmbuild/SOURCE + spectool -g -R $spec_dir + # Building rpm or srpm packages + rpmbuild -ba $spec_dir +} + +upload_pkg() +{ + #rpm package will be generated in "~/rpmbuild/SRPMS" and "~/rpmbuild/RPMS" + for file in $(find ~/rpmbuild/ -type f -name "*.rpm") + do + upload_one_curl ${file} ${sync_dest} + done +} + +check_vars +install_tools +request_pkg +rpmbuild_pkg +upload_pkg
On Wed, Dec 09, 2020 at 12:32:53PM +0800, Zhang Yale wrote:
Signed-off-by: Zhang Yale ylzhangah@qq.com
tests/rpmbuild-pkg | 81 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100755 tests/rpmbuild-pkg
diff --git a/tests/rpmbuild-pkg b/tests/rpmbuild-pkg new file mode 100755 index 00000000..9765eddb --- /dev/null +++ b/tests/rpmbuild-pkg @@ -0,0 +1,81 @@
- yum clean all
Is this necessary?
- yum -y install rpm-build
- yum -y install rpmdevtools
- mkdir -p ~/rpmbuild/{SPECS,SRPMS,SOURCES,BUILD,RPMS}
if installed rpmdevtools, we can use rpmdev-setuptree to generate these directory
+}
+get_pkgfile() +{
- curl -sS -H 'Content-Type: Application/json' -XPOST "$LKP_SERVER"':8100/git_command' \
- -d '{"git_repo": "'${rpm_spec}'", "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_spec}'", "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=~/rpmbuild/SPECS/$benchmark.spec
- sed -i 's/^(Source[^ ]*:[ \t]*)https/\1http/g' `grep http -rl $benchmark.spec`
blank line here
- # Install build depends
- yum-builddep -y $spec_dir
ditto
- # Download tar.gz to default path ~/rpmbuild/SOURCE
- spectool -g -R $spec_dir
ditto
Thanks, Yong
On Wed, Dec 09, 2020 at 02:26:54PM +0800, Wang Yong wrote:
On Wed, Dec 09, 2020 at 12:32:53PM +0800, Zhang Yale wrote:
Signed-off-by: Zhang Yale ylzhangah@qq.com
tests/rpmbuild-pkg | 81 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100755 tests/rpmbuild-pkg
diff --git a/tests/rpmbuild-pkg b/tests/rpmbuild-pkg new file mode 100755 index 00000000..9765eddb --- /dev/null +++ b/tests/rpmbuild-pkg @@ -0,0 +1,81 @@
- yum clean all
Is this necessary?
If there is cache residue, it may cause the package to fail.
May be can use 'yum makecache'
Thanks, Chenglong
- yum -y install rpm-build
- yum -y install rpmdevtools
- mkdir -p ~/rpmbuild/{SPECS,SRPMS,SOURCES,BUILD,RPMS}
if installed rpmdevtools, we can use rpmdev-setuptree to generate these directory
+}
+get_pkgfile() +{
- curl -sS -H 'Content-Type: Application/json' -XPOST "$LKP_SERVER"':8100/git_command' \
- -d '{"git_repo": "'${rpm_spec}'", "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_spec}'", "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=~/rpmbuild/SPECS/$benchmark.spec
- sed -i 's/^(Source[^ ]*:[ \t]*)https/\1http/g' `grep http -rl $benchmark.spec`
blank line here
- # Install build depends
- yum-builddep -y $spec_dir
ditto
- # Download tar.gz to default path ~/rpmbuild/SOURCE
- spectool -g -R $spec_dir
ditto
Thanks, Yong
On Wed, Dec 09, 2020 at 02:33:00PM +0800, Wang Chenglong wrote:
On Wed, Dec 09, 2020 at 02:26:54PM +0800, Wang Yong wrote:
On Wed, Dec 09, 2020 at 12:32:53PM +0800, Zhang Yale wrote:
Signed-off-by: Zhang Yale ylzhangah@qq.com
tests/rpmbuild-pkg | 81 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100755 tests/rpmbuild-pkg
diff --git a/tests/rpmbuild-pkg b/tests/rpmbuild-pkg new file mode 100755 index 00000000..9765eddb --- /dev/null +++ b/tests/rpmbuild-pkg @@ -0,0 +1,81 @@
- yum clean all
Is this necessary?
If there is cache residue, it may cause the package to fail.
May be can use 'yum makecache'
Thanks, Chenglong
Ok!
Thanks, Yale
- yum -y install rpm-build
- yum -y install rpmdevtools
- mkdir -p ~/rpmbuild/{SPECS,SRPMS,SOURCES,BUILD,RPMS}
if installed rpmdevtools, we can use rpmdev-setuptree to generate these directory
+}
+get_pkgfile() +{
- curl -sS -H 'Content-Type: Application/json' -XPOST "$LKP_SERVER"':8100/git_command' \
- -d '{"git_repo": "'${rpm_spec}'", "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_spec}'", "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=~/rpmbuild/SPECS/$benchmark.spec
- sed -i 's/^(Source[^ ]*:[ \t]*)https/\1http/g' `grep http -rl $benchmark.spec`
blank line here
- # Install build depends
- yum-builddep -y $spec_dir
ditto
- # Download tar.gz to default path ~/rpmbuild/SOURCE
- spectool -g -R $spec_dir
ditto
Thanks, Yong
On Wed, Dec 09, 2020 at 02:26:54PM +0800, Wang Yong wrote:
On Wed, Dec 09, 2020 at 12:32:53PM +0800, Zhang Yale wrote:
Signed-off-by: Zhang Yale ylzhangah@qq.com
tests/rpmbuild-pkg | 81 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100755 tests/rpmbuild-pkg
diff --git a/tests/rpmbuild-pkg b/tests/rpmbuild-pkg new file mode 100755 index 00000000..9765eddb --- /dev/null +++ b/tests/rpmbuild-pkg @@ -0,0 +1,81 @@
- yum clean all
Is this necessary?
It's necessary, because it will clear cache.
- yum -y install rpm-build
- yum -y install rpmdevtools
- mkdir -p ~/rpmbuild/{SPECS,SRPMS,SOURCES,BUILD,RPMS}
if installed rpmdevtools, we can use rpmdev-setuptree to generate these directory
Good! I use rpmdev-setuptree can generate automatically, thanks.
Thanks, Yale
+}
+get_pkgfile() +{
- curl -sS -H 'Content-Type: Application/json' -XPOST "$LKP_SERVER"':8100/git_command' \
- -d '{"git_repo": "'${rpm_spec}'", "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_spec}'", "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=~/rpmbuild/SPECS/$benchmark.spec
- sed -i 's/^(Source[^ ]*:[ \t]*)https/\1http/g' `grep http -rl $benchmark.spec`
blank line here
- # Install build depends
- yum-builddep -y $spec_dir
ditto
- # Download tar.gz to default path ~/rpmbuild/SOURCE
- spectool -g -R $spec_dir
ditto
Thanks, Yong