mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH] replace egrep with grep -E
@ 2023-05-05 20:15 Lucas Stach
  2023-05-11  5:55 ` [ptxdist] [APPLIED] " Michael Olbrich
  0 siblings, 1 reply; 2+ messages in thread
From: Lucas Stach @ 2023-05-05 20:15 UTC (permalink / raw)
  To: ptxdist

Starting with grep 3.8, using egrep emits a warning:
egrep: warning: egrep is obsolescent; using grep -E

Replace all usages of egrep, which has been deprecated
since release 2.5.3 (2007), with grep -E.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 bin/ptxdist                                    | 6 +++---
 configure.ac                                   | 3 ---
 scripts/lib/ptxd_make_image_fix_permissions.sh | 2 +-
 scripts/ptx-file_check                         | 8 ++++----
 4 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/bin/ptxdist b/bin/ptxdist
index 724c2b0d9e60..8ede9b211051 100755
--- a/bin/ptxdist
+++ b/bin/ptxdist
@@ -1410,7 +1410,7 @@ do_select()
 	fi
 
 	# check if magic is present in config file
-	if ! egrep -q "^${magic}$" "${file}" && [ -z "${PTXDIST_FORCE}" ]; then
+	if ! grep -E -q "^${magic}$" "${file}" && [ -z "${PTXDIST_FORCE}" ]; then
 		ptxd_dialog_msgbox \
 			"error: Couldn't verify that\n" \
 			"	'${file}'\n" \
@@ -2211,7 +2211,7 @@ setup_env() {
 	unset $({
 		export -p  | sed -n 's/^declare -x \([^=]*\).*$/\1/p'
 		export -fp | sed -n 's/^declare -fx \([^=]*\).*$/\1/p'
-		} | egrep -v "^(PTXDIST_PTXRC|PTX_AUTOBUILD_DESTDIR|CCACHE_.*|PWD|HOME|USER|PATH|TERM|COLUMNS|LINES|DISPLAY|TMPDIR|KCONFIG_ALLCONFIG|KCONFIG_SEED|http_proxy|https_proxy|ftp_proxy|no_proxy${whitelist})$")
+		} | grep -E -v "^(PTXDIST_PTXRC|PTX_AUTOBUILD_DESTDIR|CCACHE_.*|PWD|HOME|USER|PATH|TERM|COLUMNS|LINES|DISPLAY|TMPDIR|KCONFIG_ALLCONFIG|KCONFIG_SEED|http_proxy|https_proxy|ftp_proxy|no_proxy${whitelist})$")
 
 	######## the environment is clean now ########
 
@@ -2361,7 +2361,7 @@ setup_parallel() {
 
 	# this one is for Linux
 	if [ -r /proc/cpuinfo ]; then
-		cpus="$(egrep '^(processor|cpu	)' /proc/cpuinfo | wc -l)"
+		cpus="$(grep -E '^(processor|cpu	)' /proc/cpuinfo | wc -l)"
 		if [ ${cpus} -eq 0 ]; then
 			cpus=1
 		fi
diff --git a/configure.ac b/configure.ac
index efd4bac52a88..43e00f86ed37 100644
--- a/configure.ac
+++ b/configure.ac
@@ -172,9 +172,6 @@ GNU_TOOL(tar, tar)
 GNU_TOOL(find, findutils)
 GNU_TOOL(xargs, findutils)
 
-dnl Check for egrep
-AC_PROG_EGREP
-
 dnl Check for awk
 AC_PROG_AWK
 AC_PATH_PROGS(AWK, ${AWK},)
diff --git a/scripts/lib/ptxd_make_image_fix_permissions.sh b/scripts/lib/ptxd_make_image_fix_permissions.sh
index bf1a2c816b0f..f53f45baee1d 100644
--- a/scripts/lib/ptxd_make_image_fix_permissions.sh
+++ b/scripts/lib/ptxd_make_image_fix_permissions.sh
@@ -35,7 +35,7 @@ ptxd_make_image_fix_permissions_check() {
     ptxd_check_obsolete_perm "${ptxd_reply_perm_files[@]}"
 
     # just care about dev-nodes, for now
-    egrep -h "^[n]${IFS}" "${ptxd_reply_perm_files[@]}" |
+    grep -E -h "^[n]${IFS}" "${ptxd_reply_perm_files[@]}" |
     while read kind file uid_should gid_should prm_should type major_should minor_should; do
 	local fixup=false
 	file="${workdir}/${file#/}"
diff --git a/scripts/ptx-file_check b/scripts/ptx-file_check
index 51bf9ed634ac..3b564aca06ec 100755
--- a/scripts/ptx-file_check
+++ b/scripts/ptx-file_check
@@ -134,7 +134,7 @@ create_md5(){
 		debug_out "ROOT Directory is >$(pwd)<"
 		RELEASEDIR=$STORE/$RELEASE
 		mkdir -p "$RELEASEDIR" || my_exit "mkdir $ROOT/$RELEASEDIR failed" 1
-		find . -type f | egrep -v "/sys/|/proc/|/dev/|/mnt|/$STORE" > $RELEASEDIR/files.list
+		find . -type f | grep -E -v "/sys/|/proc/|/dev/|/mnt|/$STORE" > $RELEASEDIR/files.list
 		LC_ALL=C sort -u $RELEASEDIR/files.list > $RELEASEDIR/files.list.tmp && mv $RELEASEDIR/files.list.tmp $RELEASEDIR/files.list
 		while read line ; do 
 			md5sum $line 
@@ -159,14 +159,14 @@ check_md5(){
 		md5sum -c $RELEASEDIR/files.md5 | grep -v OK | sed s/:\ FAILED//g>> $LOCALSTATSDIR/check-md5.status
 		echo "------------ END -------------" >> $LOCALSTATSDIR/check-md5.status
 		#
-		find . -type f | egrep -v "/sys/|/proc/|/dev/|/mnt|/$STORE" > $LOCALSTATSDIR/files.list
+		find . -type f | grep -E -v "/sys/|/proc/|/dev/|/mnt|/$STORE" > $LOCALSTATSDIR/files.list
 		LC_ALL=C sort -u $LOCALSTATSDIR/files.list > $LOCALSTATSDIR/files.list.tmp && mv $LOCALSTATSDIR/files.list.tmp $LOCALSTATSDIR/files.list
 		echo "# $(date)" > $LOCALSTATSDIR/check-files.status
 		echo "# These files do not appear in release $RELEASE, " >> $LOCALSTATSDIR/check-files.status
 		echo "# however - they appear on the system:" >> $LOCALSTATSDIR/check-files.status
 		echo "# " >> $LOCALSTATSDIR/check-files.status
 		echo "----------- START ------------" >> $LOCALSTATSDIR/check-files.status
-		diff $RELEASEDIR/files.list $LOCALSTATSDIR/files.list | egrep "<|>" | sed s/'[><][ ][\.]'//g >> $LOCALSTATSDIR/check-files.status
+		diff $RELEASEDIR/files.list $LOCALSTATSDIR/files.list | grep -E "<|>" | sed s/'[><][ ][\.]'//g >> $LOCALSTATSDIR/check-files.status
 		echo "------------ END -------------" >> $LOCALSTATSDIR/check-files.status
 		#
 		if [ "$REPORT" = "true" ]; then 
@@ -211,7 +211,7 @@ check_ipkglist(){
 		echo "# These package versions differ from release $RELEASE:" >> $LOCALSTATSDIR/check-ipkglist.status
 		echo "# " >> $LOCALSTATSDIR/check-ipkglist.status
 		echo "----------- START ------------" >> $LOCALSTATSDIR/check-ipkglist.status
-		diff $RELEASEDIR/ipkg.list $LOCALSTATSDIR/ipkg.list | egrep ">" | sed s/'[><][ ]'//g >> $LOCALSTATSDIR/check-ipkglist.status
+		diff $RELEASEDIR/ipkg.list $LOCALSTATSDIR/ipkg.list | grep -E ">" | sed s/'[><][ ]'//g >> $LOCALSTATSDIR/check-ipkglist.status
 		echo "------------ END -------------" >> $LOCALSTATSDIR/check-ipkglist.status
 		#
 		if [ "$REPORT" = "true" ]; then 
-- 
2.39.2




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [ptxdist] [APPLIED] replace egrep with grep -E
  2023-05-05 20:15 [ptxdist] [PATCH] replace egrep with grep -E Lucas Stach
@ 2023-05-11  5:55 ` Michael Olbrich
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Olbrich @ 2023-05-11  5:55 UTC (permalink / raw)
  To: ptxdist; +Cc: Lucas Stach

Thanks, applied as c3530731f85190b29ffdab09bd2753df5a74e6e8.

Michael

[sent from post-receive hook]

On Thu, 11 May 2023 07:55:32 +0200, Lucas Stach <l.stach@pengutronix.de> wrote:
> Starting with grep 3.8, using egrep emits a warning:
> egrep: warning: egrep is obsolescent; using grep -E
> 
> Replace all usages of egrep, which has been deprecated
> since release 2.5.3 (2007), with grep -E.
> 
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> Message-Id: <20230505201551.903822-1-l.stach@pengutronix.de>
> Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
> 
> diff --git a/bin/ptxdist b/bin/ptxdist
> index 724c2b0d9e60..8ede9b211051 100755
> --- a/bin/ptxdist
> +++ b/bin/ptxdist
> @@ -1410,7 +1410,7 @@ do_select()
>  	fi
>  
>  	# check if magic is present in config file
> -	if ! egrep -q "^${magic}$" "${file}" && [ -z "${PTXDIST_FORCE}" ]; then
> +	if ! grep -E -q "^${magic}$" "${file}" && [ -z "${PTXDIST_FORCE}" ]; then
>  		ptxd_dialog_msgbox \
>  			"error: Couldn't verify that\n" \
>  			"	'${file}'\n" \
> @@ -2211,7 +2211,7 @@ setup_env() {
>  	unset $({
>  		export -p  | sed -n 's/^declare -x \([^=]*\).*$/\1/p'
>  		export -fp | sed -n 's/^declare -fx \([^=]*\).*$/\1/p'
> -		} | egrep -v "^(PTXDIST_PTXRC|PTX_AUTOBUILD_DESTDIR|CCACHE_.*|PWD|HOME|USER|PATH|TERM|COLUMNS|LINES|DISPLAY|TMPDIR|KCONFIG_ALLCONFIG|KCONFIG_SEED|http_proxy|https_proxy|ftp_proxy|no_proxy${whitelist})$")
> +		} | grep -E -v "^(PTXDIST_PTXRC|PTX_AUTOBUILD_DESTDIR|CCACHE_.*|PWD|HOME|USER|PATH|TERM|COLUMNS|LINES|DISPLAY|TMPDIR|KCONFIG_ALLCONFIG|KCONFIG_SEED|http_proxy|https_proxy|ftp_proxy|no_proxy${whitelist})$")
>  
>  	######## the environment is clean now ########
>  
> @@ -2361,7 +2361,7 @@ setup_parallel() {
>  
>  	# this one is for Linux
>  	if [ -r /proc/cpuinfo ]; then
> -		cpus="$(egrep '^(processor|cpu	)' /proc/cpuinfo | wc -l)"
> +		cpus="$(grep -E '^(processor|cpu	)' /proc/cpuinfo | wc -l)"
>  		if [ ${cpus} -eq 0 ]; then
>  			cpus=1
>  		fi
> diff --git a/configure.ac b/configure.ac
> index efd4bac52a88..43e00f86ed37 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -172,9 +172,6 @@ GNU_TOOL(tar, tar)
>  GNU_TOOL(find, findutils)
>  GNU_TOOL(xargs, findutils)
>  
> -dnl Check for egrep
> -AC_PROG_EGREP
> -
>  dnl Check for awk
>  AC_PROG_AWK
>  AC_PATH_PROGS(AWK, ${AWK},)
> diff --git a/scripts/lib/ptxd_make_image_fix_permissions.sh b/scripts/lib/ptxd_make_image_fix_permissions.sh
> index bf1a2c816b0f..f53f45baee1d 100644
> --- a/scripts/lib/ptxd_make_image_fix_permissions.sh
> +++ b/scripts/lib/ptxd_make_image_fix_permissions.sh
> @@ -35,7 +35,7 @@ ptxd_make_image_fix_permissions_check() {
>      ptxd_check_obsolete_perm "${ptxd_reply_perm_files[@]}"
>  
>      # just care about dev-nodes, for now
> -    egrep -h "^[n]${IFS}" "${ptxd_reply_perm_files[@]}" |
> +    grep -E -h "^[n]${IFS}" "${ptxd_reply_perm_files[@]}" |
>      while read kind file uid_should gid_should prm_should type major_should minor_should; do
>  	local fixup=false
>  	file="${workdir}/${file#/}"
> diff --git a/scripts/ptx-file_check b/scripts/ptx-file_check
> index 51bf9ed634ac..3b564aca06ec 100755
> --- a/scripts/ptx-file_check
> +++ b/scripts/ptx-file_check
> @@ -134,7 +134,7 @@ create_md5(){
>  		debug_out "ROOT Directory is >$(pwd)<"
>  		RELEASEDIR=$STORE/$RELEASE
>  		mkdir -p "$RELEASEDIR" || my_exit "mkdir $ROOT/$RELEASEDIR failed" 1
> -		find . -type f | egrep -v "/sys/|/proc/|/dev/|/mnt|/$STORE" > $RELEASEDIR/files.list
> +		find . -type f | grep -E -v "/sys/|/proc/|/dev/|/mnt|/$STORE" > $RELEASEDIR/files.list
>  		LC_ALL=C sort -u $RELEASEDIR/files.list > $RELEASEDIR/files.list.tmp && mv $RELEASEDIR/files.list.tmp $RELEASEDIR/files.list
>  		while read line ; do 
>  			md5sum $line 
> @@ -159,14 +159,14 @@ check_md5(){
>  		md5sum -c $RELEASEDIR/files.md5 | grep -v OK | sed s/:\ FAILED//g>> $LOCALSTATSDIR/check-md5.status
>  		echo "------------ END -------------" >> $LOCALSTATSDIR/check-md5.status
>  		#
> -		find . -type f | egrep -v "/sys/|/proc/|/dev/|/mnt|/$STORE" > $LOCALSTATSDIR/files.list
> +		find . -type f | grep -E -v "/sys/|/proc/|/dev/|/mnt|/$STORE" > $LOCALSTATSDIR/files.list
>  		LC_ALL=C sort -u $LOCALSTATSDIR/files.list > $LOCALSTATSDIR/files.list.tmp && mv $LOCALSTATSDIR/files.list.tmp $LOCALSTATSDIR/files.list
>  		echo "# $(date)" > $LOCALSTATSDIR/check-files.status
>  		echo "# These files do not appear in release $RELEASE, " >> $LOCALSTATSDIR/check-files.status
>  		echo "# however - they appear on the system:" >> $LOCALSTATSDIR/check-files.status
>  		echo "# " >> $LOCALSTATSDIR/check-files.status
>  		echo "----------- START ------------" >> $LOCALSTATSDIR/check-files.status
> -		diff $RELEASEDIR/files.list $LOCALSTATSDIR/files.list | egrep "<|>" | sed s/'[><][ ][\.]'//g >> $LOCALSTATSDIR/check-files.status
> +		diff $RELEASEDIR/files.list $LOCALSTATSDIR/files.list | grep -E "<|>" | sed s/'[><][ ][\.]'//g >> $LOCALSTATSDIR/check-files.status
>  		echo "------------ END -------------" >> $LOCALSTATSDIR/check-files.status
>  		#
>  		if [ "$REPORT" = "true" ]; then 
> @@ -211,7 +211,7 @@ check_ipkglist(){
>  		echo "# These package versions differ from release $RELEASE:" >> $LOCALSTATSDIR/check-ipkglist.status
>  		echo "# " >> $LOCALSTATSDIR/check-ipkglist.status
>  		echo "----------- START ------------" >> $LOCALSTATSDIR/check-ipkglist.status
> -		diff $RELEASEDIR/ipkg.list $LOCALSTATSDIR/ipkg.list | egrep ">" | sed s/'[><][ ]'//g >> $LOCALSTATSDIR/check-ipkglist.status
> +		diff $RELEASEDIR/ipkg.list $LOCALSTATSDIR/ipkg.list | grep -E ">" | sed s/'[><][ ]'//g >> $LOCALSTATSDIR/check-ipkglist.status
>  		echo "------------ END -------------" >> $LOCALSTATSDIR/check-ipkglist.status
>  		#
>  		if [ "$REPORT" = "true" ]; then 



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-05-11  5:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-05 20:15 [ptxdist] [PATCH] replace egrep with grep -E Lucas Stach
2023-05-11  5:55 ` [ptxdist] [APPLIED] " Michael Olbrich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox