On 25/05/10 12:22, Dan McGee wrote:
On Sun, May 23, 2010 at 8:32 AM, Andres P<[email protected]>  wrote:
Signed-off-by: Andres P<[email protected]>
---
  scripts/makepkg.sh.in |   34 +++++++++-------------------------
  1 files changed, 9 insertions(+), 25 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index fd1b68b..efd3d80 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -947,31 +947,15 @@ write_pkginfo() {
                echo "force = true"
        fi

-       local it
-       for it in "${licen...@]}"; do
-               echo "license = $it"
-       done
-       for it in "${replac...@]}"; do
-               echo "replaces = $it"
-       done
-       for it in "${grou...@]}"; do
-               echo "group = $it"
-       done
-       for it in "${depen...@]}"; do
-               echo "depend = $it"
-       done
-       for it in "${optdepen...@]}"; do
-               echo "optdepend = $it"
-       done
-       for it in "${conflic...@]}"; do
-               echo "conflict = $it"
-       done
-       for it in "${provid...@]}"; do
-               echo "provides = $it"
-       done
-       for it in "${back...@]}"; do
-               echo "backup = $it"
-       done
+       [[ $license ]]&&  printf "license = %s\n"   "${licen...@]}"
+       [[ $replaces ]]&&  printf "replaces = %s\n"  "${replac...@]}"
+       [[ $groups ]]&&  printf "group = %s\n"     "${grou...@]}"
+       [[ $depends ]]&&  printf "depend = %s\n"    "${depen...@]}"
+       [[ $optdepend ]]&&  printf "optdepend = %s\n" "${optdepen...@]}"
+       [[ $conflict ]]&&  printf "conflict = %s\n"  "${conflic...@]}"
+       [[ $provides ]]&&  printf "provides = %s\n"  "${provid...@]}"
+       [[ $backup ]]&&  printf "backup = %s\n"    "${back...@]}"
+
        for it in "${packaging_optio...@]}"; do
                local ret="$(check_option $it)"
                if [[ $ret != "?" ]]; then
--

This looks really cool, but where is this printf behavior documented?
I can't find it at all in the bash manpage. Is it portable to
different (read: older) versions of bash?


I can confirm that this works in bash-3.1.17 which is from 2005. I think that is old enough.

Remember that this patch relies on the one removing all the >.PKGINFO redirections when it comes time to commit.

Allan

Reply via email to