Commit 826eb9e8 authored by Vitaly Lipatov's avatar Vitaly Lipatov

backported to p7 as 1.3.1-alt0.M70P.1 (with rpmbph script)

parents be8e8d07 ff699790
...@@ -11,3 +11,8 @@ apt-rpm/remove ...@@ -11,3 +11,8 @@ apt-rpm/remove
при упаковке лучше собирать в один файл. при упаковке лучше собирать в один файл.
Внесто общих функций тоже модули. Внесто общих функций тоже модули.
<<<<<<< HEAD
=======
serv должен уметь показывать порядок загрузки?
>>>>>>> master
...@@ -73,6 +73,7 @@ quiet= ...@@ -73,6 +73,7 @@ quiet=
nodeps= nodeps=
force= force=
short= short=
sort=
non_interactive= non_interactive=
skip_installed= skip_installed=
show_command_only= show_command_only=
...@@ -184,7 +185,7 @@ check_command() ...@@ -184,7 +185,7 @@ check_command()
-qa|list|packages|-l) # HELPCMD: list of installed package(s) -qa|list|packages|-l) # HELPCMD: list of installed package(s)
epm_cmd=packages epm_cmd=packages
;; ;;
programs) # HELPCMD: list of installed program(s) programs) # HELPCMD: list of installed GUI program(s)
epm_cmd=programs epm_cmd=programs
;; ;;
...@@ -267,6 +268,9 @@ check_option() ...@@ -267,6 +268,9 @@ check_option()
--short) # HELPOPT: short output (just 'package' instead 'package-version-release') --short) # HELPOPT: short output (just 'package' instead 'package-version-release')
short="--short" short="--short"
;; ;;
--sort) # HELPOPT: sort output, f.i. --sort=size (supported only for packages command)
sort="$1"
;;
--auto) # HELPOPT: non interactive mode --auto) # HELPOPT: non interactive mode
non_interactive=1 non_interactive=1
;; ;;
......
...@@ -48,6 +48,38 @@ __use_zypper_no_gpg_checks() ...@@ -48,6 +48,38 @@ __use_zypper_no_gpg_checks()
a= zypper install --help 2>&1 | grep -q -- "--no-gpg-checks" && echo "--no-gpg-checks" a= zypper install --help 2>&1 | grep -q -- "--no-gpg-checks" && echo "--no-gpg-checks"
} }
# args: cmd_reinstall, cmd_install, packages
__separate_sudocmd_foreach()
{
local cmd_re=$1
local cmd_in=$2
shift 2
separate_installed $@
if [ -n "$pkg_noninstalled" ] ; then
sudocmd_foreach "$cmd_re" $pkg_noninstalled || return
fi
if [ -n "$pkg_installed" ] ; then
sudocmd_foreach "$cmd_in" $pkg_installed || return
fi
return 0
}
# args: cmd_reinstall, cmd_install, packages
__separate_sudocmd()
{
local cmd_re=$1
local cmd_in=$2
shift 2
separate_installed $@
if [ -n "$pkg_noninstalled" ] ; then
sudocmd "$cmd_re" $pkg_noninstalled || return
fi
if [ -n "$pkg_installed" ] ; then
sudocmd "$cmd_in" $pkg_installed || return
fi
return 0
}
# copied from etersoft-build-utils/share/eterbuild/functions/rpmpkg # copied from etersoft-build-utils/share/eterbuild/functions/rpmpkg
epm_install_names() epm_install_names()
{ {
...@@ -92,29 +124,21 @@ epm_install_names() ...@@ -92,29 +124,21 @@ epm_install_names()
sudocmd mpkg install $@ sudocmd mpkg install $@
return ;; return ;;
npackd) npackd)
separate_installed $@ # FIXME: correct arg
# FIXME: fix return status __separate_sudocmd_foreach "npackdcl add --package=" "npackdcl update --package=" $@
[ -n "$pkg_noninstalled" ] && sudocmd npackdcl add --package=$@ $pkg_noninstalled
[ -n "$pkg_installed" ] && sudocmd npackdcl update --package=$@ $pkg_installed
return ;; return ;;
slackpkg) slackpkg)
separate_installed $@ __separate_sudocmd_foreach "/usr/sbin/slackpkg install" "/usr/sbin/slackpkg upgrade" $@
[ -n "$pkg_noninstalled" ] && sudocmd_foreach "/usr/sbin/slackpkg install" $pkg_noninstalled
[ -n "$pkg_installed" ] && sudocmd_foreach "/usr/sbin/slackpkg upgrade" $pkg_installed
return ;; return ;;
homebrew) homebrew)
separate_installed $@ __separate_sudocmd "brew install" "brew upgrade" $@
[ -n "$pkg_noninstalled" ] && sudocmd brew install $pkg_noninstalled
[ -n "$pkg_installed" ] && sudocmd brew upgrade $pkg_installed
return ;; return ;;
ipkg) ipkg)
[ -n "$force" ] && force=-force-depends [ -n "$force" ] && force=-force-depends
sudocmd ipkg $force install $@ sudocmd ipkg $force install $@
return ;; return ;;
nix) nix)
separate_installed $@ __separate_sudocmd "nix-env --install" "nix-env --upgrade" $@
[ -n "$pkg_noninstalled" ] && sudocmd nix-env --install $pkg_noninstalled
[ -n "$pkg_installed" ] && sudocmd nix-env --upgrade $pkg_installed
return ;; return ;;
*) *)
fatal "Have no suitable install command for $PMTYPE" fatal "Have no suitable install command for $PMTYPE"
...@@ -166,10 +190,8 @@ epm_ni_install_names() ...@@ -166,10 +190,8 @@ epm_ni_install_names()
sudocmd nix-env --install $@ sudocmd nix-env --install $@
return ;; return ;;
slackpkg) slackpkg)
separate_installed $@
# FIXME: broken status when use batch and default answer # FIXME: broken status when use batch and default answer
[ -n "$pkg_noninstalled" ] && sudocmd_foreach "/usr/sbin/slackpkg -batch=on -default_answer=yes install" $pkg_noninstalled __separate_sudocmd_foreach "/usr/sbin/slackpkg -batch=on -default_answer=yes install" "/usr/sbin/slackpkg -batch=on -default_answer=yes upgrade" $@
[ -n "$pkg_installed" ] && sudocmd_foreach "/usr/sbin/slackpkg -batch=on -default_answer=yes upgrade" $pkg_installed
return ;; return ;;
*) *)
fatal "Have no suitable appropriate install command for $PMTYPE" fatal "Have no suitable appropriate install command for $PMTYPE"
...@@ -269,10 +291,8 @@ epm_install_files() ...@@ -269,10 +291,8 @@ epm_install_files()
return ;; return ;;
slackpkg) slackpkg)
# FIXME: check for full package name # FIXME: check for full package name
separate_installed $@
# FIXME: broken status when use batch and default answer # FIXME: broken status when use batch and default answer
[ -n "$pkg_noninstalled" ] && sudocmd_foreach "/sbin/installpkg" $pkg_noninstalled __separate_sudocmd_foreach "/sbin/installpkg" "/sbin/upgradepkg" $@
[ -n "$pkg_installed" ] && sudocmd_foreach "/sbin/upgradepkg" $pkg_installed
return ;; return ;;
esac esac
......
...@@ -17,9 +17,26 @@ ...@@ -17,9 +17,26 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
__epm_packages_sort()
{
# FIXME: sort depends on --sort value
case $PMTYPE in
apt-rpm|yum-rpm|urpm-rpm|zypper-rpm|dnf-rpm)
docmd rpm -qa --queryformat "%{size} %{name}-%{version}-%{release}\n" $pkg_filenames | sort -n
;;
apt-dpkg)
docmd dpkg-query -W --showformat="\${Size} \${Package}-\${Version}\n" $pkg_filenames | sort -n
;;
*)
fatal "Sorted package list are not realized for $PMTYPE"
;;
esac
}
epm_packages() epm_packages()
{ {
local CMD local CMD
[ -n "$sort" ] && __epm_packages_sort && return
case $PMTYPE in case $PMTYPE in
apt-rpm) apt-rpm)
...@@ -59,7 +76,10 @@ case $PMTYPE in ...@@ -59,7 +76,10 @@ case $PMTYPE in
slackpkg) slackpkg)
CMD="ls -1 /var/log/packages/" CMD="ls -1 /var/log/packages/"
if [ -n "$short" ] ; then if [ -n "$short" ] ; then
docmd ls -1 /var/log/packages/ | sed -e "s|-[0-9].*||g" # FIXME: does not work for libjpeg-v8a
# TODO: remove last 3 elements (if arch is second from the last?)
# FIXME this hack
docmd ls -1 /var/log/packages/ | sed -e "s|-[0-9].*||g" | sed -e "s|libjpeg-v8a.*|libjpeg|g"
return return
fi fi
;; ;;
......
...@@ -28,10 +28,10 @@ _query_via_packages_list() ...@@ -28,10 +28,10 @@ _query_via_packages_list()
shift shift
# separate first line for print out command # separate first line for print out command
pkg_filenames=$firstpkg epm_packages | grep -- "^$firstpkg$" || res=1 short=1 pkg_filenames=$firstpkg epm_packages | grep -- "^$firstpkg$" || res=1
for pkg in "$@" ; do for pkg in "$@" ; do
pkg_filenames=$pkg epm_packages 2>/dev/null | grep -- "^$pkg$" || res=1 short=1 pkg_filenames=$pkg epm_packages 2>/dev/null | grep -- "^$pkg$" || res=1
done done
return $res return $res
...@@ -129,6 +129,7 @@ __epm_query_name() ...@@ -129,6 +129,7 @@ __epm_query_name()
warning "fix query" warning "fix query"
return 1 return 1
;; ;;
# Note: slackpkg info pkgname
*) *)
_query_via_packages_list $@ _query_via_packages_list $@
return return
......
...@@ -109,6 +109,8 @@ EOF ...@@ -109,6 +109,8 @@ EOF
local pkg res local pkg res
res=0 res=0
for pkg in $filenames ; do for pkg in $filenames ; do
# FIXME: -[0-0] does not work in search!
# FIXME: we need strict search here (not find gst-plugins-base if search for gst-plugins
pkg_filenames="$pkg-[0-9]" epm_search | grep -E "(installed|upgrade)" && continue pkg_filenames="$pkg-[0-9]" epm_search | grep -E "(installed|upgrade)" && continue
pkg_filenames="$pkg" epm_search | grep -E "(installed|upgrade)" && continue pkg_filenames="$pkg" epm_search | grep -E "(installed|upgrade)" && continue
res=1 res=1
......
# This spec is backported to ALTLinux p7 automatically by rpmbph script. Do not edit it. # This spec is backported to ALTLinux p7 automatically by rpmbph script. Do not edit it.
# #
Name: eepm Name: eepm
Version: 1.3.0 Version: 1.3.1
Release: alt0.M70P.1 Release: alt0.M70P.1
Summary: Etersoft EPM package manager Summary: Etersoft EPM package manager
...@@ -64,9 +64,14 @@ chmod a+x %buildroot%_datadir/%name/{serv-,epm-}* ...@@ -64,9 +64,14 @@ chmod a+x %buildroot%_datadir/%name/{serv-,epm-}*
%_sysconfdir/bash_completion.d/cerv %_sysconfdir/bash_completion.d/cerv
%changelog %changelog
* Thu Jul 11 2013 Vitaly Lipatov <lav@altlinux.ru> 1.3.0-alt0.M70P.1 * Wed Jul 24 2013 Vitaly Lipatov <lav@altlinux.ru> 1.3.1-alt0.M70P.1
- backport to ALTLinux p7 (by rpmbph script) - backport to ALTLinux p7 (by rpmbph script)
* Wed Jul 24 2013 Vitaly Lipatov <lav@altlinux.ru> 1.3.1-alt1
- epm-packages: add size sort support for rpm and dpkg
- fix epm query for non rpm/deb systems
- epm-install: rewrite pkg_(non)installed for get correct return status
* Thu Jul 11 2013 Vitaly Lipatov <lav@altlinux.ru> 1.3.0-alt1 * Thu Jul 11 2013 Vitaly Lipatov <lav@altlinux.ru> 1.3.0-alt1
- slackware: fix repo update, fix install pkg from file - slackware: fix repo update, fix install pkg from file
- query, packages: print out in name-version format - query, packages: print out in name-version format
......
...@@ -829,6 +829,36 @@ __use_zypper_no_gpg_checks() ...@@ -829,6 +829,36 @@ __use_zypper_no_gpg_checks()
a= zypper install --help 2>&1 | grep -q -- "--no-gpg-checks" && echo "--no-gpg-checks" a= zypper install --help 2>&1 | grep -q -- "--no-gpg-checks" && echo "--no-gpg-checks"
} }
__separate_sudocmd_foreach()
{
local cmd_re=$1
local cmd_in=$2
shift 2
separate_installed $@
if [ -n "$pkg_noninstalled" ] ; then
sudocmd_foreach "$cmd_re" $pkg_noninstalled || return
fi
if [ -n "$pkg_installed" ] ; then
sudocmd_foreach "$cmd_in" $pkg_installed || return
fi
return 0
}
__separate_sudocmd()
{
local cmd_re=$1
local cmd_in=$2
shift 2
separate_installed $@
if [ -n "$pkg_noninstalled" ] ; then
sudocmd "$cmd_re" $pkg_noninstalled || return
fi
if [ -n "$pkg_installed" ] ; then
sudocmd "$cmd_in" $pkg_installed || return
fi
return 0
}
epm_install_names() epm_install_names()
{ {
if [ -n "$non_interactive" ] ; then if [ -n "$non_interactive" ] ; then
...@@ -872,29 +902,21 @@ epm_install_names() ...@@ -872,29 +902,21 @@ epm_install_names()
sudocmd mpkg install $@ sudocmd mpkg install $@
return ;; return ;;
npackd) npackd)
separate_installed $@ # FIXME: correct arg
# FIXME: fix return status __separate_sudocmd_foreach "npackdcl add --package=" "npackdcl update --package=" $@
[ -n "$pkg_noninstalled" ] && sudocmd npackdcl add --package=$@ $pkg_noninstalled
[ -n "$pkg_installed" ] && sudocmd npackdcl update --package=$@ $pkg_installed
return ;; return ;;
slackpkg) slackpkg)
separate_installed $@ __separate_sudocmd_foreach "/usr/sbin/slackpkg install" "/usr/sbin/slackpkg upgrade" $@
[ -n "$pkg_noninstalled" ] && sudocmd_foreach "/usr/sbin/slackpkg install" $pkg_noninstalled
[ -n "$pkg_installed" ] && sudocmd_foreach "/usr/sbin/slackpkg upgrade" $pkg_installed
return ;; return ;;
homebrew) homebrew)
separate_installed $@ __separate_sudocmd "brew install" "brew upgrade" $@
[ -n "$pkg_noninstalled" ] && sudocmd brew install $pkg_noninstalled
[ -n "$pkg_installed" ] && sudocmd brew upgrade $pkg_installed
return ;; return ;;
ipkg) ipkg)
[ -n "$force" ] && force=-force-depends [ -n "$force" ] && force=-force-depends
sudocmd ipkg $force install $@ sudocmd ipkg $force install $@
return ;; return ;;
nix) nix)
separate_installed $@ __separate_sudocmd "nix-env --install" "nix-env --upgrade" $@
[ -n "$pkg_noninstalled" ] && sudocmd nix-env --install $pkg_noninstalled
[ -n "$pkg_installed" ] && sudocmd nix-env --upgrade $pkg_installed
return ;; return ;;
*) *)
fatal "Have no suitable install command for $PMTYPE" fatal "Have no suitable install command for $PMTYPE"
...@@ -945,10 +967,8 @@ epm_ni_install_names() ...@@ -945,10 +967,8 @@ epm_ni_install_names()
sudocmd nix-env --install $@ sudocmd nix-env --install $@
return ;; return ;;
slackpkg) slackpkg)
separate_installed $@
# FIXME: broken status when use batch and default answer # FIXME: broken status when use batch and default answer
[ -n "$pkg_noninstalled" ] && sudocmd_foreach "/usr/sbin/slackpkg -batch=on -default_answer=yes install" $pkg_noninstalled __separate_sudocmd_foreach "/usr/sbin/slackpkg -batch=on -default_answer=yes install" "/usr/sbin/slackpkg -batch=on -default_answer=yes upgrade" $@
[ -n "$pkg_installed" ] && sudocmd_foreach "/usr/sbin/slackpkg -batch=on -default_answer=yes upgrade" $pkg_installed
return ;; return ;;
*) *)
fatal "Have no suitable appropriate install command for $PMTYPE" fatal "Have no suitable appropriate install command for $PMTYPE"
...@@ -1048,10 +1068,8 @@ epm_install_files() ...@@ -1048,10 +1068,8 @@ epm_install_files()
return ;; return ;;
slackpkg) slackpkg)
# FIXME: check for full package name # FIXME: check for full package name
separate_installed $@
# FIXME: broken status when use batch and default answer # FIXME: broken status when use batch and default answer
[ -n "$pkg_noninstalled" ] && sudocmd_foreach "/sbin/installpkg" $pkg_noninstalled __separate_sudocmd_foreach "/sbin/installpkg" "/sbin/upgradepkg" $@
[ -n "$pkg_installed" ] && sudocmd_foreach "/sbin/upgradepkg" $pkg_installed
return ;; return ;;
esac esac
...@@ -1232,9 +1250,25 @@ epm_kernel_update() ...@@ -1232,9 +1250,25 @@ epm_kernel_update()
# File bin/epm-packages: # File bin/epm-packages:
__epm_packages_sort()
{
case $PMTYPE in
apt-rpm|yum-rpm|urpm-rpm|zypper-rpm|dnf-rpm)
docmd rpm -qa --queryformat "%{size} %{name}-%{version}-%{release}\n" $pkg_filenames | sort -n
;;
apt-dpkg)
docmd dpkg-query -W --showformat="\${Size} \${Package}-\${Version}\n" $pkg_filenames | sort -n
;;
*)
fatal "Sorted package list are not realized for $PMTYPE"
;;
esac
}
epm_packages() epm_packages()
{ {
local CMD local CMD
[ -n "$sort" ] && __epm_packages_sort && return
case $PMTYPE in case $PMTYPE in
apt-rpm) apt-rpm)
...@@ -1270,7 +1304,10 @@ case $PMTYPE in ...@@ -1270,7 +1304,10 @@ case $PMTYPE in
slackpkg) slackpkg)
CMD="ls -1 /var/log/packages/" CMD="ls -1 /var/log/packages/"
if [ -n "$short" ] ; then if [ -n "$short" ] ; then
docmd ls -1 /var/log/packages/ | sed -e "s|-[0-9].*||g" # FIXME: does not work for libjpeg-v8a
# TODO: remove last 3 elements (if arch is second from the last?)
# FIXME this hack
docmd ls -1 /var/log/packages/ | sed -e "s|-[0-9].*||g" | sed -e "s|libjpeg-v8a.*|libjpeg|g"
return return
fi fi
;; ;;
...@@ -1359,10 +1396,10 @@ _query_via_packages_list() ...@@ -1359,10 +1396,10 @@ _query_via_packages_list()
shift shift
# separate first line for print out command # separate first line for print out command
pkg_filenames=$firstpkg epm_packages | grep -- "^$firstpkg$" || res=1 short=1 pkg_filenames=$firstpkg epm_packages | grep -- "^$firstpkg$" || res=1
for pkg in "$@" ; do for pkg in "$@" ; do
pkg_filenames=$pkg epm_packages 2>/dev/null | grep -- "^$pkg$" || res=1 short=1 pkg_filenames=$pkg epm_packages 2>/dev/null | grep -- "^$pkg$" || res=1
done done
return $res return $res
...@@ -1457,6 +1494,7 @@ __epm_query_name() ...@@ -1457,6 +1494,7 @@ __epm_query_name()
warning "fix query" warning "fix query"
return 1 return 1
;; ;;
# Note: slackpkg info pkgname
*) *)
_query_via_packages_list $@ _query_via_packages_list $@
return return
...@@ -2276,6 +2314,8 @@ EOF ...@@ -2276,6 +2314,8 @@ EOF
local pkg res local pkg res
res=0 res=0
for pkg in $filenames ; do for pkg in $filenames ; do
# FIXME: -[0-0] does not work in search!
# FIXME: we need strict search here (not find gst-plugins-base if search for gst-plugins
pkg_filenames="$pkg-[0-9]" epm_search | grep -E "(installed|upgrade)" && continue pkg_filenames="$pkg-[0-9]" epm_search | grep -E "(installed|upgrade)" && continue
pkg_filenames="$pkg" epm_search | grep -E "(installed|upgrade)" && continue pkg_filenames="$pkg" epm_search | grep -E "(installed|upgrade)" && continue
res=1 res=1
...@@ -2800,6 +2840,7 @@ quiet= ...@@ -2800,6 +2840,7 @@ quiet=
nodeps= nodeps=
force= force=
short= short=
sort=
non_interactive= non_interactive=
skip_installed= skip_installed=
show_command_only= show_command_only=
...@@ -2911,7 +2952,7 @@ check_command() ...@@ -2911,7 +2952,7 @@ check_command()
-qa|list|packages|-l) # HELPCMD: list of installed package(s) -qa|list|packages|-l) # HELPCMD: list of installed package(s)
epm_cmd=packages epm_cmd=packages
;; ;;
programs) # HELPCMD: list of installed program(s) programs) # HELPCMD: list of installed GUI program(s)
epm_cmd=programs epm_cmd=programs
;; ;;
...@@ -2994,6 +3035,9 @@ check_option() ...@@ -2994,6 +3035,9 @@ check_option()
--short) # HELPOPT: short output (just 'package' instead 'package-version-release') --short) # HELPOPT: short output (just 'package' instead 'package-version-release')
short="--short" short="--short"
;; ;;
--sort) # HELPOPT: sort output, f.i. --sort=size (supported only for packages command)
sort="$1"
;;
--auto) # HELPOPT: non interactive mode --auto) # HELPOPT: non interactive mode
non_interactive=1 non_interactive=1
;; ;;
......
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