aboutsummaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorMaarten Aertsen <maarten@nlnetlabs.nl>2024-02-27 22:39:57 +0100
committerRobin Jarry <robin@jarry.cc>2024-02-29 00:04:21 +0100
commit65571b67d7d310089e40d13f26b06cfcb85465bb (patch)
treef6b8baf64db511ac11eeb10d2c4d0654d71a0447 /contrib
parent8ba852ea7a3a20634f6866c32231a7e1409077cf (diff)
downloadaerc-65571b67d7d310089e40d13f26b06cfcb85465bb.tar.gz
contrib: use sed -E for shell scripts
The + character is not part of the 'basic regular expressions' in BSD grep. Use -E to enable extended (modern) regular expressions. Also remove escaping. This makes the commit msg hook work on macOS 14.2. Signed-off-by: Maarten Aertsen <maarten@nlnetlabs.nl> Signed-off-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/check-docs12
-rwxr-xr-xcontrib/commit-msg4
-rwxr-xr-xcontrib/git-stats.sh4
-rwxr-xr-xcontrib/release.sh2
4 files changed, 11 insertions, 11 deletions
diff --git a/contrib/check-docs b/contrib/check-docs
index bcc63213..a8187d9b 100755
--- a/contrib/check-docs
+++ b/contrib/check-docs
@@ -17,9 +17,9 @@ if echo . | grep --color . >/dev/null 2>&1; then
fi
fail=0
-sed -nre "$cmd_scd_sed" doc/*.scd | tr ' ' '\n' > "$tmp"
+sed -nE "$cmd_scd_sed" doc/*.scd | tr ' ' '\n' > "$tmp"
for f in $(find commands -type f -name '*.go'); do
- for cmd in $(sed -ne "$cmd_go_sed" "$f"); do
+ for cmd in $(sed -n "$cmd_go_sed" "$f"); do
if ! grep -qFx "$cmd" "$tmp"; then
grep -HnF $grep_color "\"$cmd\"" "$f"
fail=$((fail+1))
@@ -33,9 +33,9 @@ if [ "$fail" -gt 0 ]; then
fi
fail=0
-sed -ne "$cmd_go_sed" $(find commands -type f -name '*.go') | tr ' ' '\n' > "$tmp"
+sed -n "$cmd_go_sed" $(find commands -type f -name '*.go') | tr ' ' '\n' > "$tmp"
for f in doc/*.scd; do
- for cmd in $(sed -nre "$cmd_scd_sed" "$f" | tr ' ' '\n' | sed '/^-/d;/^$/d'); do
+ for cmd in $(sed -nE "$cmd_scd_sed" "$f" | tr ' ' '\n' | sed '/^-/d;/^$/d'); do
if ! grep -qFx "$cmd" "$tmp"; then
grep -Hn $grep_color "^\\*:$cmd\\*" "$f"
fail=$((fail+1))
@@ -49,9 +49,9 @@ if [ "$fail" -gt 0 ]; then
fi
fail=0
-sed -nre 's/^\*([a-z][a-z-]*)\* = .*/\1/p' doc/*.scd > "$tmp"
+sed -nE 's/^\*([a-z][a-z-]*)\* = .*/\1/p' doc/*.scd > "$tmp"
for f in $(find config -type f -name '*.go'); do
- for opt in $(sed -nre 's/.*`ini:"([a-z][a-z-]*)".*/\1/p' $f); do
+ for opt in $(sed -nE 's/.*`ini:"([a-z][a-z-]*)".*/\1/p' $f); do
if ! grep -qFx "$opt" "$tmp"; then
grep -HnF $grep_color "\"$opt\"" "$f"
fail=$((fail+1))
diff --git a/contrib/commit-msg b/contrib/commit-msg
index add67177..503b5a11 100755
--- a/contrib/commit-msg
+++ b/contrib/commit-msg
@@ -41,7 +41,7 @@ while read -r key value; do
key="$first_letter$other_letters"
# Find sort order of this key.
- order=$(echo "$trailer_order" | grep -Fxn "$key" | sed -n 's/^\([0-9]\+\):.*/\1/p')
+ order=$(echo "$trailer_order" | grep -Fxn "$key" | sed -nE 's/^([0-9]+):.*/\1/p')
if [ -z "$order" ]; then
echo "warning: unknown trailer '$key'" >&2
# Unknown trailers are always first.
@@ -51,7 +51,7 @@ while read -r key value; do
echo "$order $key $value"
done |
# Sort trailers according to their numeric order, trim the numeric order.
-LC_ALL=C sort -n | sed 's/^[0-9]\+ //' > "$tmp"
+LC_ALL=C sort -n | sed -E 's/^[0-9]+ //' > "$tmp"
debug echo ==== sanitized trailers ====
debug cat "$tmp"
diff --git a/contrib/git-stats.sh b/contrib/git-stats.sh
index 2ee1d61d..95121fc5 100755
--- a/contrib/git-stats.sh
+++ b/contrib/git-stats.sh
@@ -21,7 +21,7 @@ while read -r commits author; do
}
done |
column -t -s ';' -N "$columns" -R "${columns#*,}" |
-sed -r 's/[[:space:]]+$//'
+sed -E 's/[[:space:]]+$//'
echo
@@ -35,4 +35,4 @@ while read -r commits author; do
printf '%s;%s\n' "$author" "$commits"
done |
column -t -s ';' -N "$columns" -R "${columns#*,}" |
-sed -r 's/[[:space:]]+$//'
+sed -E 's/[[:space:]]+$//'
diff --git a/contrib/release.sh b/contrib/release.sh
index fd91be46..21d3d028 100755
--- a/contrib/release.sh
+++ b/contrib/release.sh
@@ -28,7 +28,7 @@ changelog() {
echo "$title_prefix $kind"
echo
git log --reverse --format="$format" $prev_tag.. | \
- sed '/^$/d; s/[[:space:]]\+/ /; s/^/- /' | \
+ sed -E '/^$/d; s/[[:space:]]+/ /; s/^/- /' | \
$wrap
fi
done