summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2014-08-22 15:40:28 (EDT)
committer P. J. McDermott <pj@pehjota.net>2014-08-22 15:40:28 (EDT)
commitc538c3a709552912ebce960922c569d46def35ac (patch)
tree573d71a9839d243781753b50272de91d4789353f
parent72d25350a43a928c9f76a253d5bf1f7f71d4b31d (diff)
feed_para_cb(): Trim multiple spaces
-rw-r--r--lib/feed.sh8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/feed.sh b/lib/feed.sh
index 3805bf0..feaf7ba 100644
--- a/lib/feed.sh
+++ b/lib/feed.sh
@@ -122,9 +122,11 @@ feed_para_cb()
dep="${dep%%(*}"
dep="${dep%%|*}"
# Trim whitespace.
- # XXX: This doesn't actually trim multiple spaces.
- dep="${dep##[ ${HT}${LF}]}"
- dep="${dep%%[ ${HT}${LF}]}"
+ dep="$(printf '%s\n' "${dep}" | sed 's/^ *//; s/ *$//')"
+ # In practice, this would suffice for control files generated by
+ # opkbuild:
+ # dep="${dep#[ ${HT}${LF}]}"
+ # dep="${dep%[ ${HT}${LF}]}"
new_deps="${new_deps} ${dep}"
done
unset IFS