Signed-off-by: Zhang Yale ylzhangah@qq.com --- tests/rpmbuild-pkg | 66 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100755 tests/rpmbuild-pkg
diff --git a/tests/rpmbuild-pkg b/tests/rpmbuild-pkg new file mode 100755 index 00000000..d70b7c94 --- /dev/null +++ b/tests/rpmbuild-pkg @@ -0,0 +1,66 @@ +#!/bin/bash +# - rpm_repo + +. $LKP_SRC/lib/debug.sh +. $LKP_SRC/lib/upload.sh + +check_vars() +{ + [ -n "$rpm_repo" ] || die "rpm_repo is empty" +} + +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 +request_pkg +rpmbuild_pkg +upload_pkg
On Wed, Dec 09, 2020 at 06:42:07PM +0800, Zhang Yale wrote:
Signed-off-by: Zhang Yale ylzhangah@qq.com
tests/rpmbuild-pkg | 66 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100755 tests/rpmbuild-pkg
diff --git a/tests/rpmbuild-pkg b/tests/rpmbuild-pkg new file mode 100755 index 00000000..d70b7c94 --- /dev/null +++ b/tests/rpmbuild-pkg @@ -0,0 +1,66 @@ +#!/bin/bash +# - rpm_repo
+. $LKP_SRC/lib/debug.sh +. $LKP_SRC/lib/upload.sh
+check_vars() +{
- [ -n "$rpm_repo" ] || die "rpm_repo is empty"
+}
+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
^---- $HOME => ${HOME}
- #sed -i 's/^(Source[^ ]*:[ \t]*)https/\1http/g' `grep http -rl $benchmark.spec`
^---- add space.
- # 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"
^---ditto Thanks, Liushaofei
- for file in $(find $HOME/rpmbuild/ -type f -name "*.rpm")
- do
upload_one_curl ${file} ${sync_dest}
- done
+}
+check_vars +request_pkg +rpmbuild_pkg
+upload_pkg
2.23.0
On Wed, Dec 09, 2020 at 06:49:52PM +0800, Liu Shaofei wrote:
On Wed, Dec 09, 2020 at 06:42:07PM +0800, Zhang Yale wrote:
Signed-off-by: Zhang Yale ylzhangah@qq.com
tests/rpmbuild-pkg | 66 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100755 tests/rpmbuild-pkg
diff --git a/tests/rpmbuild-pkg b/tests/rpmbuild-pkg new file mode 100755 index 00000000..d70b7c94 --- /dev/null +++ b/tests/rpmbuild-pkg @@ -0,0 +1,66 @@ +#!/bin/bash +# - rpm_repo
+. $LKP_SRC/lib/debug.sh +. $LKP_SRC/lib/upload.sh
+check_vars() +{
- [ -n "$rpm_repo" ] || die "rpm_repo is empty"
+}
+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
^---- $HOME => ${HOME}
ok, I'll use unified writing.
- #sed -i 's/^(Source[^ ]*:[ \t]*)https/\1http/g' `grep http -rl $benchmark.spec`
^---- add space.
ok
- # 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"
^---ditto
ok
Thanks, Yale
Thanks, Liushaofei
- for file in $(find $HOME/rpmbuild/ -type f -name "*.rpm")
- do
upload_one_curl ${file} ${sync_dest}
- done
+}
+check_vars +request_pkg +rpmbuild_pkg
+upload_pkg
2.23.0
On Wed, Dec 09, 2020 at 06:42:07PM +0800, Zhang Yale wrote:
Signed-off-by: Zhang Yale ylzhangah@qq.com
tests/rpmbuild-pkg | 66 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100755 tests/rpmbuild-pkg
diff --git a/tests/rpmbuild-pkg b/tests/rpmbuild-pkg new file mode 100755 index 00000000..d70b7c94 --- /dev/null +++ b/tests/rpmbuild-pkg @@ -0,0 +1,66 @@ +#!/bin/bash +# - rpm_repo
+. $LKP_SRC/lib/debug.sh +. $LKP_SRC/lib/upload.sh
+check_vars() +{
- [ -n "$rpm_repo" ] || die "rpm_repo is empty"
^ indent.
+}
+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
use a function.
Thanks, Xueliang
+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 +request_pkg +rpmbuild_pkg
+upload_pkg
2.23.0
On Wed, Dec 09, 2020 at 06:54:33PM +0800, Cao Xueliang wrote:
On Wed, Dec 09, 2020 at 06:42:07PM +0800, Zhang Yale wrote:
Signed-off-by: Zhang Yale ylzhangah@qq.com
tests/rpmbuild-pkg | 66 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100755 tests/rpmbuild-pkg
diff --git a/tests/rpmbuild-pkg b/tests/rpmbuild-pkg new file mode 100755 index 00000000..d70b7c94 --- /dev/null +++ b/tests/rpmbuild-pkg @@ -0,0 +1,66 @@ +#!/bin/bash +# - rpm_repo
+. $LKP_SRC/lib/debug.sh +. $LKP_SRC/lib/upload.sh
+check_vars() +{
- [ -n "$rpm_repo" ] || die "rpm_repo is empty"
^ indent.
OK, I got it.
+}
+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
use a function.
Thanks, Xueliang
Ok, I got it.
Thanks, Yale
+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 +request_pkg +rpmbuild_pkg
+upload_pkg
2.23.0