From 8dc5fb2c70f2ff9db3f804b0bba20edf4a512f78 Mon Sep 17 00:00:00 2001 From: Damien Martin-Guillerez Date: Wed, 26 Aug 2015 12:42:54 +0000 Subject: Fix word wrapping determinism on BSD / Linux fmt behaves totally differently depending on the version and on the OS, use fold instead that has a consistent behaviour accross platform. Tested with bazel test //scripts/release/... on OSX and Linux. -- MOS_MIGRATED_REVID=101567574 --- scripts/release/release_test.sh | 8 ++++---- scripts/release/relnotes.sh | 14 ++++---------- scripts/release/relnotes_test.sh | 2 +- 3 files changed, 9 insertions(+), 15 deletions(-) (limited to 'scripts/release') diff --git a/scripts/release/release_test.sh b/scripts/release/release_test.sh index 4c2606800e..3152054825 100755 --- a/scripts/release/release_test.sh +++ b/scripts/release/release_test.sh @@ -195,8 +195,8 @@ EOF local header='Release v1 ('$(date +%Y-%m-%d)') Baseline: 1170dc6 - + 0540fde: Extract version numbers that look like - "..._1.2.3_..." from BUILD_EMBED_LABEL into Info.plist. + + 0540fde: Extract version numbers that look like "..._1.2.3_..." + from BUILD_EMBED_LABEL into Info.plist. ' assert_equals "${header}Test replacement" "$(cat ${TEST_log})" @@ -208,8 +208,8 @@ Baseline: 1170dc6 header='Release v1 ('$(date +%Y-%m-%d)') Baseline: 1170dc6 - + 0540fde: Extract version numbers that look like - "..._1.2.3_..." from BUILD_EMBED_LABEL into Info.plist. + + 0540fde: Extract version numbers that look like "..._1.2.3_..." + from BUILD_EMBED_LABEL into Info.plist. + cef25c4: RELNOTES: Attribute error messages related to Android resources are easier to understand now. diff --git a/scripts/release/relnotes.sh b/scripts/release/relnotes.sh index 15abbd1cb7..7071f7186a 100755 --- a/scripts/release/relnotes.sh +++ b/scripts/release/relnotes.sh @@ -97,16 +97,10 @@ function get_release_notes() { done } -# fmt behaves a bit different on GNU/Linux than on BSDs. -if [ "$(uname -s | tr 'A-Z' 'a-z')" = "linux" ]; then - function wrap_text() { - fmt -w $1 -g $1 - } -else - function wrap_text() { - fmt -w $1 - } -fi +# fmt behaves differently on *BSD and on GNU/Linux, use fold. +function wrap_text() { + fold -s -w $1 | sed 's/ *$//' +} # 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 diff --git a/scripts/release/relnotes_test.sh b/scripts/release/relnotes_test.sh index 32d571134e..419ed109a6 100755 --- a/scripts/release/relnotes_test.sh +++ b/scripts/release/relnotes_test.sh @@ -198,7 +198,7 @@ function test_create_revision_information() { should produce additional information about aspect dependencies when --output is set to {xml, proto}.' assert_equals "$expected" \ - "$(create_revision_information 965c392 bb59d88 14d905b)" + "$(create_revision_information 965c392 bb59d88 14d905b)" } run_suite "Release notes generation tests" -- cgit v1.2.3