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
diff --git a/scripts/release/release_test.sh b/scripts/release/release_test.sh
index 4c26068..3152054 100755
--- a/scripts/release/release_test.sh
+++ b/scripts/release/release_test.sh
@@ -195,8 +195,8 @@
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 @@
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 15abbd1..7071f71 100755
--- a/scripts/release/relnotes.sh
+++ b/scripts/release/relnotes.sh
@@ -97,16 +97,10 @@
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 32d5711..419ed10 100755
--- a/scripts/release/relnotes_test.sh
+++ b/scripts/release/relnotes_test.sh
@@ -198,7 +198,7 @@
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"