find-package: if some path is provided by two or more rpmdb packages, output raw dependence

Here is the problem:

$ /usr/lib/rpm/shell.req -v /dev/stdin <<</usr/bin/openssl-config
shell.req: /dev/stdin: /usr/bin/openssl-config -> libssl-devel<STDERR-NEWLINE>
openssl (via rpmdb)
libssl-devel
openssl
$

Here is the solution:

$ /usr/lib/rpm/shell.req -v /dev/stdin <<</usr/bin/openssl-config
shell.req: /dev/stdin: /usr/bin/openssl-config provided by: libssl-devel openssl
shell.req: /dev/stdin: /usr/bin/openssl-config -> /usr/bin/openssl-config (raw)
/usr/bin/openssl-config
$

Note that this new behaviour now matches content index search:

$ grep openssl-config ~tmp/build/cache/contents/contents_index_bin
/usr/bin/openssl-config /usr/bin/openssl-config
$
This commit is contained in:
Alexey Tourbin 2007-03-07 19:57:59 +03:00
parent b8c1488e12
commit f9a7e6dea2

View File

@ -69,12 +69,17 @@ FindPackage()
fi
# Check package database.
if package="$(rpmquery --whatprovides --queryformat='%{NAME}\n' -- "$rep" |LC_COLLATE=C sort -u)"; then
if [ -n "$package" ]; then
if package="$(rpmquery --whatprovides --queryformat='%{NAME}\n' -- "$rep")"; then
package="$(printf %s "$package" |LC_COLLATE=C sort -u)"
local n="$(IFS=$'\n'; set -- $package; echo $#)"
if [ "$n" = 1 ]; then
Verbose "$f: $rep -> $package (via rpmdb)"
printf %s\\n "$package"
continue
elif [ "$n" -gt 1 ]; then
Info "$f: $rep provided by:$(echo '' $package)"
fi
# fall through
fi
# Not found; output raw dependence.