pacapt icon indicating copy to clipboard operation
pacapt copied to clipboard

better -Qs with rpm (dnf/yum)

Open sevu opened this issue 6 years ago • 1 comments

On Arch, -Qs with multiple arguments gives results which contain both = it's an intersection E.g. pacman -Qs maria java would match a package which has the words maria and java in any order in the pkgname or description.

rpm searches for each argument on it's own, but filters duplicates = it's an union (it searches only package names, but let's be happy with that)

-Qs is for yum and dnf currently iplemented as rpm -qa "*${*}*" We can follow how this is evaluated by using bahs's set -x, it evaluates to the single word '*maria java*' As there are no packages containing a space ...

Changing it to rpm -qa *${*}* or rpm -qa "*${@}*" would evaluate to two words '*maria' 'java*'. This would match a few packages... but not mariadb-java-client-2.3.0-1.fc29.noarch

Now comes the part where I ask for help: Transforming it to '*maria*' '*java*' will match it, though it will print all packages which are involved with either of them... a lot. (It's a union) Transforming it to '*maria*java*' will be close. but now the order matters.

To get identical results as with archlinux, we need to transform it to '*maria*java*' '*java*maria*'

In other words, we need all permutations of $*, and could then connect them with spaces and * How do we do that? And in bash? Some thoughts

  • In a loop. ${!n} would give the n'th argument
  • single quotes above are only for demonstration

sevu avatar Feb 03 '19 10:02 sevu

@sevu Thanks a lot for your input. I didn't notice there are some differences between pacman and yum/dnf. Supporting arch-liked feature sounds great however that requires a lot of effort in Bash: For the purpose I am not sure if Bash can help. Even if we implement the feature in any higher language, there is still some challenge: We implement the back-end feature (rpm/dnf) which is supposed to be done by the back-end instead.

Is that the union featureuseful from the point of view ofyum/dnfusers? Do they already have any option to switch fromuniontointersection`?

icy avatar Feb 04 '19 19:02 icy