DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: dev@dpdk.org
Cc: olivier.matz@6wind.com, stable@dpdk.org,
	Ali Alnubani <alialnu@mellanox.com>,
	David Marchand <david.marchand@redhat.com>
Subject: [dpdk-dev] [PATCH v2] devtools: remove config backup after test build setup
Date: Mon, 16 Dec 2019 20:15:53 +0100	[thread overview]
Message-ID: <20191216191553.1997116-1-thomas@monjalon.net> (raw)
In-Reply-To: <20191216162242.1898285-1-thomas@monjalon.net>

The config options are updated with sed and the short in-place option.
In order to avoid creating a backup file when using sed in-place,
the argument was tentatively set as an empty suffix.
On Linux, the suffix argument is optional, without space or equal before.
On FreeBSD, the suffix argument of the in-place option is mandatory.
This argument cannot be an empty string if no space before.

In GNU sed, the short option '-i' does not expect '=' before the suffix
argument, so it understands '=' as the file suffix.
As a consequence, a backup file named '.config=' was created
on Linux in the build directory.

There is no common solution (without creating a function)
to skip the backup file with GNU sed and BSD sed.
It is solved by always creating a .config.tmp backup file
which is removed at the end of the configuration.

Fixes: 4a4a20c4775b ("devtools: support FreeBSD")
Cc: olivier.matz@6wind.com
Cc: stable@dpdk.org

Reported-by: Ali Alnubani <alialnu@mellanox.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>

---

v1: try removing = sign
v2: do not skip backup file

---
 devtools/test-build.sh | 78 ++++++++++++++++++++++--------------------
 1 file changed, 40 insertions(+), 38 deletions(-)

diff --git a/devtools/test-build.sh b/devtools/test-build.sh
index 52305fbb8c..f451d91ad3 100755
--- a/devtools/test-build.sh
+++ b/devtools/test-build.sh
@@ -141,84 +141,86 @@ config () # <directory> <target> <options>
 		echo 'Customize configuration'
 		# Built-in options (lowercase)
 		! echo $3 | grep -q '+default' || \
-		sed -ri="" 's,(RTE_MACHINE=")native,\1default,' $1/.config
+		sed -ri.tmp 's,(RTE_MACHINE=")native,\1default,' $1/.config
 		echo $3 | grep -q '+next' || \
-		sed -ri=""           's,(NEXT_ABI=)y,\1n,' $1/.config
+		sed -ri.tmp           's,(NEXT_ABI=)y,\1n,' $1/.config
 		! echo $3 | grep -q '+shared' || \
-		sed -ri=""         's,(SHARED_LIB=)n,\1y,' $1/.config
+		sed -ri.tmp         's,(SHARED_LIB=)n,\1y,' $1/.config
 		! echo $3 | grep -q '+debug' || ( \
-		sed -ri=""  's,(RTE_LOG_DP_LEVEL=).*,\1RTE_LOG_DEBUG,' $1/.config
-		sed -ri=""           's,(_DEBUG.*=)n,\1y,' $1/.config
-		sed -ri=""  's,(_STAT)([S_].*=|=)n,\1\2y,' $1/.config
-		sed -ri="" 's,(TEST_PMD_RECORD_.*=)n,\1y,' $1/.config )
+		sed -ri.tmp 's,(RTE_LOG_DP_LEVEL=).*,\1RTE_LOG_DEBUG,' $1/.config
+		sed -ri.tmp           's,(_DEBUG.*=)n,\1y,' $1/.config
+		sed -ri.tmp  's,(_STAT)([S_].*=|=)n,\1\2y,' $1/.config
+		sed -ri.tmp 's,(TEST_PMD_RECORD_.*=)n,\1y,' $1/.config )
 
 		# Automatic configuration
 		test "$DPDK_DEP_NUMA" != n || \
-		sed -ri=""             's,(NUMA.*=)y,\1n,' $1/.config
-		sed -ri=""    's,(LIBRTE_IEEE1588=)n,\1y,' $1/.config
-		sed -ri=""             's,(BYPASS=)n,\1y,' $1/.config
+		sed -ri.tmp             's,(NUMA.*=)y,\1n,' $1/.config
+		sed -ri.tmp    's,(LIBRTE_IEEE1588=)n,\1y,' $1/.config
+		sed -ri.tmp             's,(BYPASS=)n,\1y,' $1/.config
 		test "$DPDK_DEP_ARCHIVE" != y || \
-		sed -ri=""       's,(RESOURCE_TAR=)n,\1y,' $1/.config
+		sed -ri.tmp       's,(RESOURCE_TAR=)n,\1y,' $1/.config
 		test "$DPDK_DEP_BPF" != y || \
-		sed -ri=""         's,(PMD_AF_XDP=)n,\1y,' $1/.config
+		sed -ri.tmp         's,(PMD_AF_XDP=)n,\1y,' $1/.config
 		test "$DPDK_DEP_ISAL" != y || \
-		sed -ri=""           's,(PMD_ISAL=)n,\1y,' $1/.config
+		sed -ri.tmp           's,(PMD_ISAL=)n,\1y,' $1/.config
 		test "$DPDK_DEP_MLX" != y || \
-		sed -ri=""           's,(MLX._PMD=)n,\1y,' $1/.config
+		sed -ri.tmp           's,(MLX._PMD=)n,\1y,' $1/.config
 		test "$DPDK_DEP_NFB" != y || \
-		sed -ri=""            's,(NFB_PMD=)n,\1y,' $1/.config
+		sed -ri.tmp            's,(NFB_PMD=)n,\1y,' $1/.config
 		test "$DPDK_DEP_SZE" != y || \
-		sed -ri=""       's,(PMD_SZEDATA2=)n,\1y,' $1/.config
+		sed -ri.tmp       's,(PMD_SZEDATA2=)n,\1y,' $1/.config
 		test "$DPDK_DEP_ZLIB" != y || \
-		sed -ri=""          's,(BNX2X_PMD=)n,\1y,' $1/.config
+		sed -ri.tmp          's,(BNX2X_PMD=)n,\1y,' $1/.config
 		test "$DPDK_DEP_ZLIB" != y || \
-		sed -ri=""           's,(PMD_ZLIB=)n,\1y,' $1/.config
+		sed -ri.tmp           's,(PMD_ZLIB=)n,\1y,' $1/.config
 		test "$DPDK_DEP_ZLIB" != y || \
-		sed -ri=""   's,(COMPRESSDEV_TEST=)n,\1y,' $1/.config
+		sed -ri.tmp   's,(COMPRESSDEV_TEST=)n,\1y,' $1/.config
 		test "$DPDK_DEP_PCAP" != y || \
-		sed -ri=""               's,(PCAP=)n,\1y,' $1/.config
+		sed -ri.tmp               's,(PCAP=)n,\1y,' $1/.config
 		test -z "$ARMV8_CRYPTO_LIB_PATH" || \
-		sed -ri=""   's,(PMD_ARMV8_CRYPTO=)n,\1y,' $1/.config
+		sed -ri.tmp   's,(PMD_ARMV8_CRYPTO=)n,\1y,' $1/.config
 		test "$DPDK_DEP_IPSEC_MB" != y || \
-		sed -ri=""       's,(PMD_AESNI_MB=)n,\1y,' $1/.config
+		sed -ri.tmp       's,(PMD_AESNI_MB=)n,\1y,' $1/.config
 		test "$DPDK_DEP_IPSEC_MB" != y || \
-		sed -ri=""      's,(PMD_AESNI_GCM=)n,\1y,' $1/.config
+		sed -ri.tmp      's,(PMD_AESNI_GCM=)n,\1y,' $1/.config
 		test -z "$LIBSSO_SNOW3G_PATH" || \
-		sed -ri=""         's,(PMD_SNOW3G=)n,\1y,' $1/.config
+		sed -ri.tmp         's,(PMD_SNOW3G=)n,\1y,' $1/.config
 		test -z "$LIBSSO_KASUMI_PATH" || \
-		sed -ri=""         's,(PMD_KASUMI=)n,\1y,' $1/.config
+		sed -ri.tmp         's,(PMD_KASUMI=)n,\1y,' $1/.config
 		test -z "$LIBSSO_ZUC_PATH" || \
-		sed -ri=""            's,(PMD_ZUC=)n,\1y,' $1/.config
+		sed -ri.tmp            's,(PMD_ZUC=)n,\1y,' $1/.config
 		test "$DPDK_DEP_SSL" != y || \
-		sed -ri=""            's,(PMD_CCP=)n,\1y,' $1/.config
+		sed -ri.tmp            's,(PMD_CCP=)n,\1y,' $1/.config
 		test "$DPDK_DEP_SSL" != y || \
-		sed -ri=""        's,(PMD_OPENSSL=)n,\1y,' $1/.config
+		sed -ri.tmp        's,(PMD_OPENSSL=)n,\1y,' $1/.config
 		test "$DPDK_DEP_SSL" != y || \
-		sed -ri=""            's,(QAT_SYM=)n,\1y,' $1/.config
+		sed -ri.tmp            's,(QAT_SYM=)n,\1y,' $1/.config
 		test -z "$FLEXRAN_SDK" || \
-		sed -ri=""     's,(BBDEV_TURBO_SW=)n,\1y,' $1/.config
-		sed -ri=""           's,(SCHED_.*=)n,\1y,' $1/.config
+		sed -ri.tmp     's,(BBDEV_TURBO_SW=)n,\1y,' $1/.config
+		sed -ri.tmp           's,(SCHED_.*=)n,\1y,' $1/.config
 		test -z "$LIBMUSDK_PATH" || \
-		sed -ri=""   's,(PMD_MVSAM_CRYPTO=)n,\1y,' $1/.config
+		sed -ri.tmp   's,(PMD_MVSAM_CRYPTO=)n,\1y,' $1/.config
 		test -z "$LIBMUSDK_PATH" || \
-		sed -ri=""          's,(MVPP2_PMD=)n,\1y,' $1/.config
+		sed -ri.tmp          's,(MVPP2_PMD=)n,\1y,' $1/.config
 		test -z "$LIBMUSDK_PATH" || \
-		sed -ri=""         's,(MVNETA_PMD=)n,\1y,' $1/.config
+		sed -ri.tmp         's,(MVNETA_PMD=)n,\1y,' $1/.config
 		test "$DPDK_DEP_ELF" != y || \
-		sed -ri=""            's,(BPF_ELF=)n,\1y,' $1/.config
+		sed -ri.tmp            's,(BPF_ELF=)n,\1y,' $1/.config
 		test "$DPDK_DEP_JSON" != y || \
-		sed -ri=""          's,(TELEMETRY=)n,\1y,' $1/.config
+		sed -ri.tmp          's,(TELEMETRY=)n,\1y,' $1/.config
 		build_config_hook $1 $2 $3
 
 		# Explicit enabler/disabler (uppercase)
 		for option in $(echo $3 | sed 's,[~+], &,g') ; do
 			pattern=$(echo $option | cut -c2-)
 			if echo $option | grep -q '^~' ; then
-				sed -ri="" "s,($pattern=)y,\1n," $1/.config
+				sed -ri.tmp "s,($pattern=)y,\1n," $1/.config
 			elif echo $option | grep -q '^+' ; then
-				sed -ri="" "s,($pattern=)n,\1y," $1/.config
+				sed -ri.tmp "s,($pattern=)n,\1y," $1/.config
 			fi
 		done
+
+		rm -f $1/.config.tmp
 	fi
 }
 
-- 
2.24.0


  parent reply	other threads:[~2019-12-16 19:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-16 16:22 [dpdk-dev] [PATCH] devtools: avoid config backup during " Thomas Monjalon
2019-12-16 16:40 ` Bruce Richardson
2019-12-16 16:47   ` Thomas Monjalon
2019-12-16 16:59     ` Bruce Richardson
2019-12-16 17:45       ` Thomas Monjalon
2019-12-16 19:15 ` Thomas Monjalon [this message]
2020-05-24 22:02   ` [dpdk-dev] [PATCH v2] devtools: remove config backup after " Thomas Monjalon

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=20191216191553.1997116-1-thomas@monjalon.net \
    --to=thomas@monjalon.net \
    --cc=alialnu@mellanox.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=olivier.matz@6wind.com \
    --cc=stable@dpdk.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 NNTP newsgroup(s).