On Tue, May 14, 2024 at 02:48:53PM +0300, Arseny Maslennikov wrote: > Date: Wed, 1 May 2024 23:45:47 +0300 > Message-ID: <20240501204548.25091-1-arseny@altlinux.org> > Subject: [RFC PATCH girar.git] remote-check-install: temporarily fix unowned files reports > > On merged-usr systems for each file path accessible under both /lib and > /usr/lib, etc. `find /*` automatically optimizes away the /lib one. Many > rpm packages contain files under /lib, though, and are reported by > rpmquery as such, so the real file under /usr/lib is considered > "unprovided". > > For each path in the output of `(rpmquery -al; rpmquery -a --provides)` > under a legacy directory alias, add a matching path under the prefix. > The transformation will look like this: > % sed 's!^/\(bin\|lib\|lib32\|lib64\|libx32\|sbin\).\+!/usr&\n&!' <<____ > /sbin/chroot > /bin/bash > ____ > /usr/sbin/chroot > /sbin/chroot > /usr/bin/bash > /bin/bash > > This way the new files under the prefix can never show up. > > --- > gb/remote/gb-remote-check-install | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/gb/remote/gb-remote-check-install b/gb/remote/gb-remote-check-install > index 5cac126..ac09c4f 100755 > --- a/gb/remote/gb-remote-check-install > +++ b/gb/remote/gb-remote-check-install > @@ -189,7 +189,10 @@ sort -u -o instprov{,} > hsh-run --rooter -- \ > rpmquery -al >instfiles 2>>warnings > sed '/^(contains no files)$/d' -i warnings > +# Temporary hack: for each entry in legacy aliased dirs, > +# add its real location. > +sed -i 's!^/\(bin\|lib\|lib32\|lib64\|libx32\|sbin\).\+!/usr&\n&!' instfiles > sort -u -o instfiles{,} > > sort -u instprov instfiles >instlist > comm -23 new-files instlist >unprovided > -- > 2.42.1 Для unmerged-usr репозиториев такое решение в теории тоже подходит, потому что, как видно из текста gb-remote-check-install далее, список post-install unowned files получается из файла `unprovided`, т. е. не содержит файлов, которые не оказались там по окончании процитированного выше фрагмента. В таком репозитории, если /bin/x есть, а /usr/bin/x нет, второй путь не попадёт в `new-files`, но начнёт попадать в `instlist`. Следовательно, не попадёт в `unprovided` и не повлияет на результат. Если же мы не хотим таких допущений при формировании `instlist`, то можно и усложнить: либо детектить merged-usr окружение, либо перед включением па́рного файла в `instlist` проверять его фактическое наличие, либо ещё что-то.