[devel-distro] [PATCH 3/4] bin/archdep-filter: cosmetic cleanups

Michael Shigorin mike at altlinux.org
Mon Nov 22 21:45:17 MSK 2021


"-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



More information about the devel-distro mailing list