[pacman-dev] [PATCH] makepkg: use printf when writing pkginfo
Dan McGee
dpmcgee at gmail.com
Mon May 24 22:22:47 EDT 2010
On Sun, May 23, 2010 at 8:32 AM, Andres P <aepd87 at gmail.com> wrote:
> Signed-off-by: Andres P <aepd87 at gmail.com>
> ---
> 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 "${license[@]}"; do
> - echo "license = $it"
> - done
> - for it in "${replaces[@]}"; do
> - echo "replaces = $it"
> - done
> - for it in "${groups[@]}"; do
> - echo "group = $it"
> - done
> - for it in "${depends[@]}"; do
> - echo "depend = $it"
> - done
> - for it in "${optdepends[@]}"; do
> - echo "optdepend = $it"
> - done
> - for it in "${conflicts[@]}"; do
> - echo "conflict = $it"
> - done
> - for it in "${provides[@]}"; do
> - echo "provides = $it"
> - done
> - for it in "${backup[@]}"; do
> - echo "backup = $it"
> - done
> + [[ $license ]] && printf "license = %s\n" "${license[@]}"
> + [[ $replaces ]] && printf "replaces = %s\n" "${replaces[@]}"
> + [[ $groups ]] && printf "group = %s\n" "${groups[@]}"
> + [[ $depends ]] && printf "depend = %s\n" "${depends[@]}"
> + [[ $optdepend ]] && printf "optdepend = %s\n" "${optdepends[@]}"
> + [[ $conflict ]] && printf "conflict = %s\n" "${conflicts[@]}"
> + [[ $provides ]] && printf "provides = %s\n" "${provides[@]}"
> + [[ $backup ]] && printf "backup = %s\n" "${backup[@]}"
> +
> for it in "${packaging_options[@]}"; 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?
-Dan
More information about the pacman-dev
mailing list