summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Reisner <d@falconindy.com>2011-06-20 21:37:09 +0200
committerDave Reisner <d@falconindy.com>2011-06-24 20:55:49 +0200
commit7d8e9b8ed65343031284b891d713529aecbff659 (patch)
tree4973049b9daf66c7c84bb201cc7f9cfc6772c98a
parent5246fdecf6ab6a3f847d02967250f100ef440242 (diff)
downloadpacman-7d8e9b8ed65343031284b891d713529aecbff659.tar.gz
pacman-7d8e9b8ed65343031284b891d713529aecbff659.tar.xz
repo-add: use format_entry for all desc/depends fields
This ranks high on the code readability scale. The same function formats all of our data and writes to the metadata file at once. Signed-off-by: Dave Reisner <d@falconindy.com>
-rw-r--r--scripts/repo-add.sh.in46
1 files changed, 24 insertions, 22 deletions
diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in
index dcf376e7..1e77015f 100644
--- a/scripts/repo-add.sh.in
+++ b/scripts/repo-add.sh.in
@@ -294,28 +294,30 @@ db_write_entry() {
# create desc entry
msg2 "$(gettext "Creating '%s' db entry...")" 'desc'
- echo -e "%FILENAME%\n${1##*/}\n" >>desc
- echo -e "%NAME%\n$pkgname\n" >>desc
- [[ -n $pkgbase ]] && echo -e "%BASE%\n$pkgbase\n" >>desc
- echo -e "%VERSION%\n$pkgver\n" >>desc
- [[ -n $pkgdesc ]] && echo -e "%DESC%\n$pkgdesc\n" >>desc
- format_entry "GROUPS" "${_groups[@]}" >>"desc"
- [[ -n $csize ]] && echo -e "%CSIZE%\n$csize\n" >>desc
- [[ -n $size ]] && echo -e "%ISIZE%\n$size\n" >>desc
-
- # add checksums
- echo -e "%MD5SUM%\n$md5sum\n" >>desc
- echo -e "%SHA256SUM%\n$sha256sum\n" >>desc
-
- # add PGP sig
- [[ -n $pgpsig ]] && echo -e "%PGPSIG%\n$pgpsig\n" >>desc
-
- [[ -n $url ]] && echo -e "%URL%\n$url\n" >>desc
- format_entry "LICENSE" "${_licenses[@]}" >>"desc"
- [[ -n $arch ]] && echo -e "%ARCH%\n$arch\n" >>desc
- [[ -n $builddate ]] && echo -e "%BUILDDATE%\n$builddate\n" >>desc
- [[ -n $packager ]] && echo -e "%PACKAGER%\n$packager\n" >>desc
- format_entry "REPLACES" "${_replaces[@]}" >>"desc"
+ {
+ format_entry "FILENAME" "${1##*/}"
+ format_entry "NAME" "$pkgname"
+ format_entry "BASE" "$pkgbase"
+ format_entry "VERSION" "$pkgver"
+ format_entry "DESC" "$pkgdesc"
+ format_entry "GROUPS" "${_groups[@]}"
+ format_entry "CSIZE" "$csize"
+ format_entry "ISIZE" "$size"
+
+ # add checksums
+ format_entry "MD5SUM" "$md5sum"
+ format_entry "SHA256SUM" "$sha256sum"
+
+ # add PGP sig
+ format_entry "PGPSIG" "$pgpsig"
+
+ format_entry "URL" "$url"
+ format_entry "LICENSE" "${_licenses[@]}"
+ format_entry "ARCH" "$arch"
+ format_entry "BUILDDATE" "$builddate"
+ format_entry "PACKAGER" "$packager"
+ format_entry "REPLACES" "${_replaces[@]}"
+ } >'desc'
# create depends entry
msg2 "$(gettext "Creating '%s' db entry...")" 'depends'