ALT Linux Distributions development
 help / color / mirror / Atom feed
From: Michael Shigorin <mike@altlinux.org>
To: devel-distro@lists.altlinux.org
Subject: [devel-distro] [PATCH 2/4] bin/archdep-filter: implement multi-!matching too
Date: Mon, 22 Nov 2021 21:45:16 +0300
Message-ID: <20211122184518.10821-3-mike@altlinux.org> (raw)
In-Reply-To: <20211122184518.10821-1-mike@altlinux.org>

This has been clearly lacking while making the previous commit
but the implementation isn't that clear so let it be a separate
step.

The problem requiring the change in subsequent processors
is that these relied upon "@arch" as a flag to be inspected,
and "pkg@!arch1,arch2" on arch2 needs to take out *all* of that
fragment *including* arch1 mention as well.

Part of the cause is difference in handling: "positive" multi-match
would explode its "client" line into multiple lines to filter down
the pipeline, while "negative" multi-match *has* to keep that line
on a similarly single line (otherwise we'd end up with N-1 of those
slipping past the filter for particular architecture thus defeating
the whole purpose of "negative" matching semantics):

$ echo 'pkg@!E2K,mipsel,riscv64' |
  sed -r  ':loop; s/^((([^@]+@!)[^,]+)+),([a-zA-Z0-9_]+)/\1@!\4/; t loop'
pkg@!E2K@!mipsel@!riscv64

I've tried my best to test this specific change but it still might
introduce a regression in some corner case; feel free to report;
looks like there's a space for improvement in m-p's automated
tests department as well.

So now we can do:

  pkg@!ARCHES1,ARCHES2,arch3,arch4

and have pkg excluded on arches mentioned; the previous approach
could only offer explicit whitelists (not that it was entirely
wrong but then again, we have both ExclusiveArch and ExcludeArch
rpmtags in our spec files).
---
 bin/archdep-filter | 11 ++++++-----
 doc/archdep.txt    |  3 ++-
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/bin/archdep-filter b/bin/archdep-filter
index 58cd076e9..674c2e1cc 100755
--- a/bin/archdep-filter
+++ b/bin/archdep-filter
@@ -34,13 +34,14 @@ esac
 
 # NB: pipe runs in parallel => faster than -e -e
 cat ${f:+"$f"} |
+sed -r  ':loop; s/^((([^@]+@!)[^,]+)+),([a-zA-Z0-9_]+)/\1@!\4/; t loop' |
 sed -r  ':loop; s/^((([^@]+@)[^,]+)+),([a-zA-Z0-9_]+)/\1\n\3\4/; t loop' |
-sed -rn "s/\<([^@ ]*)\>|\<([^@ ]*)@$A\>/\1\2/pg" |
-sed -rn "s/\<([^@ ]*)\>|\<[^@ ]*@\!$A\> */\1/pg" |
+sed -rn "s/\<([^@ ]*)\>|\<([^@ ]*)@$A\>[^ ]*\>/\1\2/pg" |
+sed -rn "s/\<([^@ ]*)\>|\<[^@ ]*@\!$A\>[^ ]*\> */\1/pg" |
 sed -r  "s/\<([^@ ]*)@IA32\>/\1@i586 i586-\1@x86_64/g" |
-sed -rn "s/\<([^@ ]*)\>|\<([^@ ]*)@$a\>/\1\2/pg" |
-sed -rn "s/\<([^@ ]*)\>|\<[^@ ]*@\!$a\> */\1/pg" |
-sed -r  "s/\<([^@ ]*)@\![^@ ]+\>/\1/g" |
+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/ +$//" |
 if [ -n "$f" ]; then
diff --git a/doc/archdep.txt b/doc/archdep.txt
index d1a1c3e91..845e6acdf 100644
--- a/doc/archdep.txt
+++ b/doc/archdep.txt
@@ -49,9 +49,10 @@ ARM (armh или aarch64), а также выборка "для любой ар
 (например, @!E2K, или "@!ARM).
 
 С версии 1.4.21 поддерживается перечисление архитектур через запятую
-после "@":
+после "@" или "@!":
 
   LibreOffice-still@X86,aarch64,ppc64le,mipsel
+  java-11-openjdk@!E2K,mipsel
 
 Для преобразования можно воспользоваться следующей командой:
 
-- 
2.33.0



  parent reply	other threads:[~2021-11-22 18:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-22 18:24 [devel-distro] архитектуры, java-11-openjdk и LibreOffice* Michael Shigorin
2021-11-22 18:36 ` Антон Мидюков
2021-11-22 18:50   ` Michael Shigorin
2021-11-23 10:20     ` Mikhail Efremov
2021-11-22 18:45 ` [devel-distro] [PATCH 0/4] archdep-filter и множественные архитектуры Michael Shigorin
2021-11-22 18:45   ` [devel-distro] [PATCH 1/4] bin/archdep-filter: implement multi-matching Michael Shigorin
2021-11-22 18:45   ` Michael Shigorin [this message]
2021-11-29 16:44     ` [devel-distro] [PATCH 2/4] bin/archdep-filter: implement multi-!matching too Michael Shigorin
2021-11-29 16:49       ` Антон Мидюков
2021-12-04 15:10         ` Антон Мидюков
2021-11-22 18:45   ` [devel-distro] [PATCH 3/4] bin/archdep-filter: cosmetic cleanups Michael Shigorin
2021-11-22 18:45   ` [devel-distro] [PATCH 4/4] bin/archdep-filter: a debugging note Michael Shigorin
2021-11-29  8:21   ` [devel-distro] [PATCH 0/4] archdep-filter и множественные архитектуры Антон Мидюков

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=20211122184518.10821-3-mike@altlinux.org \
    --to=mike@altlinux.org \
    --cc=devel-distro@lists.altlinux.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

ALT Linux Distributions development

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel-distro/0 devel-distro/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel-distro devel-distro/ http://lore.altlinux.org/devel-distro \
		devel-distro@lists.altlinux.org devel-distro@lists.altlinux.ru devel-distro@lists.altlinux.com
	public-inbox-index devel-distro

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel-distro


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git