Commit a35c00b6 authored by Vitaly Lipatov's avatar Vitaly Lipatov

rewrite epm_requires and epm_provides

parent 17477ad5
...@@ -19,27 +19,29 @@ ...@@ -19,27 +19,29 @@
load_helper epm-query load_helper epm-query
epm_provides() epm_provides_files()
{ {
local CMD [ -n "$pkg_files" ] || return
[ -n "$pkg_filenames" ] || fatal "Run query without names"
# by package file case $(get_package_type $pkg_files) in
case $PMTYPE in rpm)
*-rpm) docmd "rpm -q --provides -p"
CMD="rpm -q --provides -p"
;; ;;
# apt-dpkg) # deb)
# showcmd dpkg -s $pkg_files # a= docmd dpkg -s $pkg_names | grep "^Depends:" | sed "s|^Depends:||g"
# a= dpkg -s $pkg_names | grep "^Depends:" | sed "s|^Depends:||g" # return
# return # ;;
# ;;
*) *)
fatal "Have no suitable command for $PMTYPE" fatal "Have no suitable command for $PMTYPE"
;; ;;
esac esac
}
[ -n "$pkg_files" ] && docmd $CMD $pkg_files
epm_provides_names()
{
local CMD
[ -n "$pkg_names" ] || return
# by package name # by package name
case $PMTYPE in case $PMTYPE in
...@@ -83,6 +85,13 @@ case $PMTYPE in ...@@ -83,6 +85,13 @@ case $PMTYPE in
;; ;;
esac esac
[ -n "$pkg_names" ] && docmd $CMD $pkg_names docmd $CMD $pkg_names
}
epm_provides()
{
[ -n "$pkg_filenames" ] || fatal "Run query without names"
epm_provides_files
epm_provides_names
} }
...@@ -19,36 +19,33 @@ ...@@ -19,36 +19,33 @@
load_helper epm-query load_helper epm-query
epm_requires_files()
epm_requires()
{ {
local CMD [ -n "$pkg_files" ] || return
[ -n "$pkg_filenames" ] || fatal "Run query without names"
# TODO: Здесь выбирать команду по расширению, а не по системному менеджеру case $(get_package_type $pkg_files) in
# В других таких случаях тоже rpm)
# В списке пакетов на установку проверять, что пакеты имеют соответствующее расширение docmd "rpm -q --requires -p"
# by package file
case $PMTYPE in
apt-rpm|urpm-rpm|zypper-rpm|yum-rpm)
CMD="rpm -q --requires -p"
;; ;;
apt-dpkg) deb)
if [ -n "$pkg_files" ] ; then if [ -n "$pkg_files" ] ; then
# FIXME: need package base # FIXME: need package base
showcmd dpkg -s $pkg_files # FIXME: need dpkg base. some other method?
a= dpkg -s $pkg_files | grep "^Depends:" | sed "s|^Depends:||g" a= docmd dpkg -s $pkg_files | grep "^Depends:" | sed "s|^Depends:||g"
# FIXME: we need execute package name section too # FIXME: we need execute package name section too
# TODO: separate to two section # TODO: separate to two section
return
fi fi
;; ;;
*) *)
fatal "Have no suitable command for $PMTYPE" fatal "Have no suitable command for $PMTYPE"
;; ;;
esac esac
}
[ -n "$pkg_files" ] && docmd $CMD $pkg_files epm_requires_names()
{
local CMD
[ -n "$pkg_names" ] || return
# by package name # by package name
case $PMTYPE in case $PMTYPE in
...@@ -95,6 +92,13 @@ case $PMTYPE in ...@@ -95,6 +92,13 @@ case $PMTYPE in
esac esac
[ -n "$pkg_names" ] && docmd $CMD $pkg_names docmd $CMD $pkg_names
}
epm_requires()
{
[ -n "$pkg_filenames" ] || fatal "Run query without names"
epm_requires_files
epm_requires_names
} }
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