From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Michael Shigorin To: devel-distro@lists.altlinux.org Date: Mon, 22 Nov 2021 21:45:17 +0300 Message-Id: <20211122184518.10821-4-mike@altlinux.org> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20211122184518.10821-1-mike@altlinux.org> References: <20211122182425.GH24863@imap.altlinux.org> <20211122184518.10821-1-mike@altlinux.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [devel-distro] [PATCH 3/4] bin/archdep-filter: cosmetic cleanups X-BeenThere: devel-distro@lists.altlinux.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: Distributions development List-Id: Distributions development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Nov 2021 18:45:33 -0000 Archived-At: List-Archive: "-a arch" is not requisite either; and having bunches of empty lines in the resulting pkglists that are user visible at least within the conventional installer's alterator-pkg (groups selection) module wouldn't be nice. I chose to sacrifice empty-line separators for clarity; the really good cleanup would save *single* empty lines between chunks of non-empty ones (not at the pkglist's start or end); feel free to implement that as well. --- bin/archdep-filter | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/archdep-filter b/bin/archdep-filter index 674c2e1cc..7802e7e15 100755 --- a/bin/archdep-filter +++ b/bin/archdep-filter @@ -2,7 +2,7 @@ # filter stdin or file for words related to # the specified target architecture # -# args: -a arch [-i file] +# args: [-a arch] [-i file] if [ "$1" = "-a" -a -n "$2" ]; then a="$2" @@ -43,7 +43,7 @@ sed -rn "s/\<([^@ ]*)\>|\<([^@ ]*)@$a\>[^ ]*\>/\1\2/pg" | sed -rn "s/\<([^@ ]*)\>|\<[^ ]*@\!$a\>[^ ]*\> */\1/pg" | sed -r "s/\<([^@ ]*)@\![^ ]+\>/\1/g" | sed -r "s/\<([^@ ]*)@[^@ ]+\> *//g" | -sed -r "s/^ +//;s/ +$//" | +sed -r "s/^ +//;s/ +$//;/^$/d" | if [ -n "$f" ]; then cat > "$t" && mv "$t" "$f" else -- 2.33.0