Commit fecec172 authored by Vitaly Lipatov's avatar Vitaly Lipatov

separate filter_out_installed_packages to standalone file epm-sh-install

parent d4a93dc3
......@@ -18,52 +18,13 @@
#
load_helper epm-sh-altlinux
load_helper epm-sh-install
load_helper epm-query
load_helper epm-assure
load_helper epm-repack
load_helper epm-check_updated_repo
load_helper epm-sh-warmup
__fast_hack_for_filter_out_installed_rpm()
{
LANG=C LC_ALL=C xargs -n1 rpm -q 2>&1 | grep 'is not installed' |
sed -e 's|^.*package \(.*\) is not installed.*|\1|g'
}
# TODO: use when run install with epm --skip-installed install
filter_out_installed_packages()
{
[ -z "$skip_installed" ] && cat && return
case $PMTYPE in
yum-rpm|dnf-rpm)
if [ "$($DISTRVENDOR -a)" = "x86_64" ] ; then
# shellcheck disable=SC2013
for i in $(cat) ; do
is_installed "$(__print_with_arch_suffix $i .x86_64)" && continue
is_installed "$(__print_with_arch_suffix $i .noarch)" && continue
echo $i
done
else
__fast_hack_for_filter_out_installed_rpm
fi
;;
*-rpm)
__fast_hack_for_filter_out_installed_rpm
;;
# dpkg -l lists some non ii status (un, etc)
#"deb")
# LANG=C LC_ALL=C xargs -n1 dpkg -l 2>&1 | grep -i 'no packages found matching' |
# sed -e 's|\.\+$||g' -e 's|^.*[Nn]o packages found matching \(.*\)|\1|g'
# ;;
*)
# shellcheck disable=SC2013
for i in $(cat) ; do
is_installed $i || echo $i
done
;;
esac | sed -e "s|rpm-build-altlinux-compat[^ ]*||g" | filter_strip_spaces
}
# for zypper before SUSE/11.0
__use_zypper_no_gpg_checks()
......@@ -591,6 +552,7 @@ epm_install()
# to be filter happy
warmup_lowbase
# Note: filter_out_installed_packages depends on skip_installed flag
local names="$(echo $pkg_names | filter_out_installed_packages)"
#local names="$(echo $pkg_names | exp_with_arch_suffix | filter_out_installed_packages)"
local files="$(echo $pkg_files | filter_out_installed_packages)"
......
#!/bin/sh
#
# Copyright (C) 2012-2020 Etersoft
# Copyright (C) 2012-2020 Vitaly Lipatov <lav@etersoft.ru>
#
# 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
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
load_helper epm-sh-altlinux
load_helper epm-query
__fast_hack_for_filter_out_installed_rpm()
{
LANG=C LC_ALL=C xargs -n1 rpm -q 2>&1 | grep 'is not installed' |
sed -e 's|^.*package \(.*\) is not installed.*|\1|g'
}
# pass only uninstalled packages
filter_out_installed_packages()
{
[ -z "$skip_installed" ] && cat && return
case $PMTYPE in
yum-rpm|dnf-rpm)
if [ "$($DISTRVENDOR -a)" = "x86_64" ] ; then
# shellcheck disable=SC2013
for i in $(cat) ; do
is_installed "$(__print_with_arch_suffix $i .x86_64)" && continue
is_installed "$(__print_with_arch_suffix $i .noarch)" && continue
echo $i
done
else
__fast_hack_for_filter_out_installed_rpm
fi
;;
*-rpm)
__fast_hack_for_filter_out_installed_rpm
;;
# dpkg -l lists some non ii status (un, etc)
#"deb")
# LANG=C LC_ALL=C xargs -n1 dpkg -l 2>&1 | grep -i 'no packages found matching' |
# sed -e 's|\.\+$||g' -e 's|^.*[Nn]o packages found matching \(.*\)|\1|g'
# ;;
*)
# shellcheck disable=SC2013
for i in $(cat) ; do
is_installed $i || echo $i
done
;;
esac | sed -e "s|rpm-build-altlinux-compat[^ ]*||g" | filter_strip_spaces
}
get_only_installed_packages()
{
local installlist="$*"
estrlist exclude "$(echo "$installlist" | (skip_installed='yes' filter_out_installed_packages))" "$installlist"
}
......@@ -43,7 +43,7 @@ epm_upgrade()
installlist="$(estrlist reg_exclude ".*-devel .*-devel-static" "$installlist")"
[ -n "$verbose" ] && info "Packages from task(s): $installlist"
# install only installed packages (simulate upgrade packages)
installlist="$(estrlist exclude "$(echo "$installlist" | (skip_installed='yes' filter_out_installed_packages))" "$installlist")" #"
installlist="$(get_only_installed_packages "$installlist")"
[ -n "$verbose" ] && info "Packages to upgrade: $installlist"
(pkg_names="$installlist" epm_Install)
epm_removerepo "$pkg_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