Permalink
Browse files

Fix errors when checking status of PIPE

The variable PIPESTATUS is only available in a very shortime.

* Valid: [[ PIPESTATUS[0] -eq 0 && PIPESTATUS[1] -eq 0 ]]
* Invalid: ... && [[ PIPESTATUS[1] -eq 0 ]]

We need to use an util function to check PIPESTATUS (array),
or we need to get all PIPE statues in a single test [[ .. ]]
  • Loading branch information...
icy committed Apr 23, 2013
1 parent 50d16e2 commit 9f4824ed9e5506cd97d477dfa4c7dbf5697c7fa6
Showing with 5 additions and 12 deletions.
  1. +5 −12 _utils/run.sh
@@ -144,10 +144,8 @@ _import_package() {
|| { _err "Something wrong with git repository"; return 1; }

if _pkgver="$(git show "$_pkg:$_pkg/PKGBUILD" \
| _get_version_from_old_PKGBUILD ;\
[[ ${PIPESTATUS[0]} -eq 0 ]] \
&& [[ ${PIPESTATUS[1]} -eq 0 ]] \
|| exit 1 \
| _get_version_from_old_PKGBUILD ; \
[[ ${PIPESTATUS[0]} -eq 0 && ${PIPESTATUS[1]} -eq 0 ]] || exit 1 \
)" ; then
git tag -a \
-m "The original source from the ABS" \
@@ -464,8 +462,7 @@ _get_number_of_git_commits_between_two_points() {
_num="$( \
_get_git_commits_between_two_points $_from $_to "$@" \
| _linecount ; \
[[ ${PIPESTATUS[0]} -eq 0 ]] || exit 1 ; \
[[ ${PIPESTATUS[1]} -eq 0 ]] || exit 1 ; \
[[ ${PIPESTATUS[0]} -eq 0 && ${PIPESTATUS[1]} -eq 0 ]] || exit 1 ; \
)" \
&& echo "$_num" \
|| _err "Unable to get number of commits between '$_from' and '$_to'"
@@ -692,9 +689,7 @@ _fix_the_1st_tag_on_package_branch() {
}
_commit="$( \
git log --pretty="format:%H" "TheBigBang".."$_br" -- | tail -1 ;\
[[ ${PIPESTATUS[0]} -eq 0 ]] \
&& [[ ${PIPESTATUS[1]} -eq 0 ]] \
|| exit 1 \
[[ ${PIPESTATUS[0]} -eq 0 && ${PIPESTATUS[1]} -eq 0 ]] || exit 1 \
)" \
|| return 1

@@ -712,9 +707,7 @@ _fix_the_1st_tag_on_package_branch() {
_pkgver="$(
git show "$_commit":$_br/PKGBUILD \
| _get_version_from_old_PKGBUILD ; \
[[ ${PIPESTATUS[0]} -eq 0 ]] \
&& [[ ${PIPESTATUS[1]} -eq 0 ]] \
|| exit 1 \
[[ ${PIPESTATUS[0]} -eq 0 && ${PIPESTATUS[1]} -eq 0 ]] || exit 1 \
)" \
|| return 1

0 comments on commit 9f4824e

Please sign in to comment.