Signed-off-by: Li Ping 1477412247@qq.com --- jobs/rpmbuild-pkg.yaml | 2 +- tests/rpmbuild-pkg | 23 +++++++++-------------- 2 files changed, 10 insertions(+), 15 deletions(-)
diff --git a/jobs/rpmbuild-pkg.yaml b/jobs/rpmbuild-pkg.yaml index 53e145b3b..a70590afe 100644 --- a/jobs/rpmbuild-pkg.yaml +++ b/jobs/rpmbuild-pkg.yaml @@ -1,5 +1,5 @@ suite: rpmbuild-pkg category: functional
-rpm_repo: +upstream_repo: rpmbuild-pkg: diff --git a/tests/rpmbuild-pkg b/tests/rpmbuild-pkg index a8c8eb6b1..d49dc43c7 100755 --- a/tests/rpmbuild-pkg +++ b/tests/rpmbuild-pkg @@ -1,11 +1,11 @@ #!/bin/bash -# - rpm_repo +# - upstream_repo
. $LKP_SRC/lib/debug.sh . $LKP_SRC/lib/upload.sh
-[ -n "$rpm_repo" ] || die "rpm_repo is empty" -package_name=${rpm_repo##*/} +[ -n "$upstream_repo" ] || die "upstream_repo is empty" +package_name=${upstream_repo##*/} sync_dest="/initrd/rpmbuild-pkg/${os}-${os_version}/${os_arch}/${package_name}"
init_workspace() @@ -14,21 +14,16 @@ init_workspace() rpmdev-setuptree }
-get_pkgfile() +download_upstream_repo() { - curl -sS -H 'Content-Type: Application/json' -XPOST "$GIT_SERVER"':8100/git_command' \ - -d '{"git_repo": "'${rpm_repo}'", "git_command": ["git-show", "HEAD:'$1'"]}' -o "${2}" -} - -download_rpm_repo() -{ - local filelist=$(curl -sS -H 'Content-Type: Application/json' -XPOST "$GIT_SERVER"':8100/git_command' \ - -d '{"git_repo": "'${rpm_repo}'", "git_command": ["git-ls-files", "."]}') + git clone "git://$GIT_SERVER/openeuler/${upstream_repo}" || die "clone git repo ${package_name} failed: git://$GIT_SERVER/openeuler/${upstream_repo}" + cd $package_name || exit + filelist=$(git ls-files) for pkgfile in ${filelist[@]} do local dir="SOURCES" echo $pkgfile | egrep ".spec$" && dir="SPECS" - get_pkgfile "$pkgfile" "${HOME}/rpmbuild/${dir}/$pkgfile" + cat "$pkgfile" > "${HOME}/rpmbuild/${dir}/$pkgfile" done }
@@ -63,6 +58,6 @@ upload_rpm_pkg() }
init_workspace -download_rpm_repo +download_upstream_repo build_rpm upload_rpm_pkg
-get_pkgfile() +download_upstream_repo() {
- curl -sS -H 'Content-Type: Application/json' -XPOST "$GIT_SERVER"':8100/git_command' \
- -d '{"git_repo": "'${rpm_repo}'", "git_command": ["git-show", "HEAD:'$1'"]}' -o "${2}"
-}
-download_rpm_repo() -{
- local filelist=$(curl -sS -H 'Content-Type: Application/json' -XPOST "$GIT_SERVER"':8100/git_command' \
-d '{"git_repo": "'${rpm_repo}'", "git_command": ["git-ls-files", "."]}')
- git clone "git://$GIT_SERVER/openeuler/${upstream_repo}" || die "clone git repo ${package_name} failed: git://$GIT_SERVER/openeuler/${upstream_repo}"
- cd $package_name || exit
- filelist=$(git ls-files) for pkgfile in ${filelist[@]} do local dir="SOURCES" echo $pkgfile | egrep ".spec$" && dir="SPECS"
get_pkgfile "$pkgfile" "${HOME}/rpmbuild/${dir}/$pkgfile"
cat "$pkgfile" > "${HOME}/rpmbuild/${dir}/$pkgfile"
Why use cat rather than cp?
Thanks, Jiaxin
On Fri, Mar 12, 2021 at 05:34:53PM +0800, Lin Jiaxin wrote:
-get_pkgfile() +download_upstream_repo() {
- curl -sS -H 'Content-Type: Application/json' -XPOST "$GIT_SERVER"':8100/git_command' \
- -d '{"git_repo": "'${rpm_repo}'", "git_command": ["git-show", "HEAD:'$1'"]}' -o "${2}"
-}
-download_rpm_repo() -{
- local filelist=$(curl -sS -H 'Content-Type: Application/json' -XPOST "$GIT_SERVER"':8100/git_command' \
-d '{"git_repo": "'${rpm_repo}'", "git_command": ["git-ls-files", "."]}')
- git clone "git://$GIT_SERVER/openeuler/${upstream_repo}" || die "clone git repo ${package_name} failed: git://$GIT_SERVER/openeuler/${upstream_repo}"
- cd $package_name || exit
- filelist=$(git ls-files) for pkgfile in ${filelist[@]} do local dir="SOURCES" echo $pkgfile | egrep ".spec$" && dir="SPECS"
get_pkgfile "$pkgfile" "${HOME}/rpmbuild/${dir}/$pkgfile"
cat "$pkgfile" > "${HOME}/rpmbuild/${dir}/$pkgfile"
Why use cat rather than cp?
personal habits, maybe use mv is better.
Thanks, Jiaxin