Commit 9ea9ec3c authored by Vitaly Lipatov's avatar Vitaly Lipatov

epm requires: allow show also for non installed packages, improvements

parent 1f5cb9dc
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012-2013, 2016, 2018, 2019 Etersoft # Copyright (C) 2012-2013, 2016, 2018, 2019, 2022 Etersoft
# Copyright (C) 2012-2013, 2016, 2018, 2019 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012-2013, 2016, 2018, 2019, 2022 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by
...@@ -20,6 +20,21 @@ ...@@ -20,6 +20,21 @@
load_helper epm-query load_helper epm-query
load_helper epm-print load_helper epm-print
__epm_filter_out_base_alt_reqs()
{
grep -E -v "(^rpmlib\(|^/bin/sh|^/bin/bash|^rtld\(GNU_HASH\)|ld-linux)"
}
__epm_alt_rpm_requires()
{
if [ -n "$short" ] ; then
# TODO see also rpmreqs from etersoft-build-utils
docmd rpm -q --requires "$@" | __epm_filter_out_base_alt_reqs | sed -e "s| .*||"
else
docmd rpm -q --requires "$@" | __epm_filter_out_base_alt_reqs
fi
}
epm_requires_files() epm_requires_files()
{ {
local pkg_files="$*" local pkg_files="$*"
...@@ -30,12 +45,7 @@ epm_requires_files() ...@@ -30,12 +45,7 @@ epm_requires_files()
case "$PKGTYPE" in case "$PKGTYPE" in
rpm) rpm)
assure_exists rpm >/dev/null assure_exists rpm >/dev/null
if [ -n "$short" ] ; then __epm_alt_rpm_requires -p $pkg_files
# TODO see also rpmreqs from etersoft-build-utils
docmd rpm -q --requires -p $pkg_files | grep -v "^rpmlib(" | grep -v "^/bin/sh$" | grep -v "^/bin/bash" | grep -v "rtld(GNU_HASH)" | sed -e "s| .*||"
else
docmd rpm -q --requires -p $pkg_files | grep -v "^rpmlib(" | grep -v "^/bin/sh$" | grep -v "^/bin/bash" | grep -v "rtld(GNU_HASH)"
fi
;; ;;
deb) deb)
assure_exists dpkg >/dev/null assure_exists dpkg >/dev/null
...@@ -59,12 +69,20 @@ case $PMTYPE in ...@@ -59,12 +69,20 @@ case $PMTYPE in
# FIXME: need fix for a few names case # FIXME: need fix for a few names case
# FIXME: too low level of requires name (libSOME.so) # FIXME: too low level of requires name (libSOME.so)
if is_installed $pkg_names ; then if is_installed $pkg_names ; then
CMD="rpm -q --requires" assure_exists rpm >/dev/null
__epm_alt_rpm_requires $pkg_names
return
else else
#EXTRA_SHOWDOCMD=' | grep "Depends:"' if [ -n "$verbose" ] ; then
#docmd apt-cache show $pkg_names | grep "Depends:" CMD="apt-cache depends"
#return else
CMD="apt-cache depends" if [ -n "$short" ] ; then
LANG=C docmd apt-cache depends $pkg_names | grep "Depends:" | sed -e "s|.*Depends: ||" -e "s|<\(.*\)>|\1|" | __epm_filter_out_base_alt_reqs | sed -e "s| .*||"
else
LANG=C docmd apt-cache depends $pkg_names | grep "Depends:" | sed -e "s|.*Depends: ||" -e "s|<\(.*\)>|\1|" | __epm_filter_out_base_alt_reqs
fi
return
fi
fi fi
;; ;;
packagekit) packagekit)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment