aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts/release
diff options
context:
space:
mode:
authorGravatar Damien Martin-Guillerez <dmarting@google.com>2015-07-27 10:05:43 +0000
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2015-07-27 12:58:54 +0000
commit3b61b2c77b96948d8f3a5638977d4f3a3607fe4f (patch)
treef8e3f24b9cd9425927daa560b5cd34298adc5946 /scripts/release
parentea1a96ea0f77c112598ef069b37c106577bb2420 (diff)
Release note scripts: fix fmt usage under Linux
For some strange reason fmt do not try to fill the line by default under GNU/Linux. This is using a wrapper around fmt to fix //scripts/release:relnotes_test on Linux. Fixes #331. -- MOS_MIGRATED_REVID=99165254
Diffstat (limited to 'scripts/release')
-rwxr-xr-xscripts/release/relnotes.sh15
1 files changed, 13 insertions, 2 deletions
diff --git a/scripts/release/relnotes.sh b/scripts/release/relnotes.sh
index 56888c574e..ce256b2883 100755
--- a/scripts/release/relnotes.sh
+++ b/scripts/release/relnotes.sh
@@ -97,6 +97,17 @@ function get_release_notes() {
done
}
+# fmt behaves a bit different on GNU/Linux than on darwin.
+if [ "$(uname -s | tr 'A-Z' 'a-z')" = "darwin" ]; then
+ function wrap_text() {
+ fmt -w $1
+ }
+else
+ function wrap_text() {
+ fmt -w $1 -g $1
+ }
+fi
+
# Returns the list of release notes in arguments into a list of points in
# a markdown list. The release notes are wrapped to 70 characters so it
# displays nicely in a git history.
@@ -104,7 +115,7 @@ function format_release_notes() {
local i
for (( i=1; $i <= $#; i=$i+1 )); do
local relnote="${!i}"
- local lines=$(echo "$relnote" | fmt -w 66) # wrap to 70 counting the 4 leading spaces.
+ local lines=$(echo "$relnote" | wrap_text 66) # wrap to 70 counting the 4 leading spaces.
echo " - $lines" | head -1
echo "$lines" | tail -n +2 | sed 's/^/ /'
done
@@ -153,7 +164,7 @@ function create_revision_information() {
while [ -n "${1-}" ]; do
local hash="$1"
local subject=$(git show -s --pretty=format:%s $hash)
- local lines=$(echo "$subject" | fmt -w 56) # 14 leading spaces.
+ local lines=$(echo "$subject" | wrap_text 56) # 14 leading spaces.
echo " + $hash: $lines" | head -1
echo "$lines" | tail -n +2 | sed 's/^/ /'
shift