perfbook.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Akira Yokosawa <akiyks@gmail.com>
To: "Paul E. McKenney" <paulmck@kernel.org>
Cc: perfbook@vger.kernel.org, Akira Yokosawa <akiyks@gmail.com>
Subject: [PATCH -perfbook 1/2] autodate.sh: Allow alternative name for sed
Date: Thu, 16 Mar 2023 09:26:18 +0900	[thread overview]
Message-ID: <116f11cf-4763-0b74-10b4-b5c2074ae696@gmail.com> (raw)

It turns out that native sed on FreeBSD doesn't work well in
autodate.sh. GNU compatible sed can be specified by make/shell
variable SED.

Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
---
 utilities/autodate.sh | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/utilities/autodate.sh b/utilities/autodate.sh
index b1db0ec166d8..1efdbdee5290 100644
--- a/utilities/autodate.sh
+++ b/utilities/autodate.sh
@@ -28,6 +28,7 @@ qqzbg="false"
 fn="autodate.tex"
 
 : ${DATE:=date}
+: ${SED:=sed}
 
 # check if we have tcolorbox
 tcolorbox_sty=`kpsewhich tcolorbox.sty`
@@ -77,24 +78,24 @@ else
 			esac
 			case "$description" in
 		Edition[.-][0-9]*)
-			ednum="`echo $description | sed -e 's/^Edition[.-]\([0-9]*\).*$/\1/'`"
+			ednum="`echo $description | $SED -e 's/^Edition[.-]\([0-9]*\).*$/\1/'`"
 			release=`env printf '\\Ordinalstringnum{%s} %s' $ednum "$release"`
 			;;
 		esac
 		case "$description" in
 		*-rc[0-9]*)
-			rc="`echo $description | sed -e 's/^.*-rc\(.*\)$/\1/'`"
+			rc="`echo $description | $SED -e 's/^.*-rc\(.*\)$/\1/'`"
 			release="$release, Release Candidate $rc"
 			;;
 		esac
 		;;
 		*)
 			release=`env printf 'Tag: \\\texttt{%s}' "$description"`
-			commitid=`echo $description | sed -e 's/.*-\(g.*\)/\1/'`
+			commitid=`echo $description | $SED -e 's/.*-\(g.*\)/\1/'`
 			;;
 		esac
 	else
-		description=`git log --max-count=1 | head -n 1 | sed -e 's/^commit \([0-9a-f]\{12\}\).*$/g\1/'`
+		description=`git log --max-count=1 | head -n 1 | $SED -e 's/^commit \([0-9a-f]\{12\}\).*$/g\1/'`
 		release=`env printf 'Commit: \\\texttt{%s} (shallow clone)' "$description"`
 		commitid="$description"
 	fi
@@ -125,7 +126,7 @@ env printf '\\newcommand{\\commitid}{%s}\n' $commitid$modified >> $fn
 env printf '\\IfQqzBg{}{\\setboolean{qqzbg}{%s}}\n' $qqzbg >> $fn
 
 # command for newer tcolorbox (4.40 or later) to have backward-compatible skips
-tcbversion=`grep ProvidesPackage $tcolorbox_sty | sed -e 's/.*version \([0-9]\+\.[0-9]\+\).*/\1/g'`
+tcbversion=`grep ProvidesPackage $tcolorbox_sty | $SED -e 's/.*version \([0-9]\+\.[0-9]\+\).*/\1/g'`
 tcbold=4.39
 env printf '%% tcolorbox version: %s\n' $tcbversion >> $fn
 if [ $(echo $tcbversion $tcbold | awk '{if ($1 > $2) print 1;}') ] ;

base-commit: 71129aa0193b4cd29bc59ac6f5ee22982f20901b
-- 
2.25.1


             reply	other threads:[~2023-03-16  0:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-16  0:26 Akira Yokosawa [this message]
2023-03-16  0:27 ` [PATCH -perfbook 2/2] precheck.sh: Test sed against repeat patterns \+ and \? Akira Yokosawa
2023-03-16 18:31 ` [PATCH -perfbook 1/2] autodate.sh: Allow alternative name for sed Paul E. McKenney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=116f11cf-4763-0b74-10b4-b5c2074ae696@gmail.com \
    --to=akiyks@gmail.com \
    --cc=paulmck@kernel.org \
    --cc=perfbook@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).