Commit 06432bf7 authored by Vitaly Lipatov's avatar Vitaly Lipatov

backported to p8 as 2.1.7-alt0.M80P.1 (with rpmbph script)

parents 0954ccaa b22cfb1e
аналог epm purge: запоминаем список файлов, удаляем пакеты и по возможности всё, от чего зависит (рекурсивно).
--interactive
встроить вычисление зависимость сюда rpmreqs
rsync -av --inplace --progress --compress rsync -av --inplace --progress --compress
epmqp uuid на x86_64/Ubuntu не различает архитектуру epmqp uuid на x86_64/Ubuntu не различает архитектуру
......
...@@ -25,6 +25,11 @@ has() ...@@ -25,6 +25,11 @@ has()
grep "$*" "$DISTROFILE" >/dev/null 2>&1 grep "$*" "$DISTROFILE" >/dev/null 2>&1
} }
firstupper()
{
echo "$*" | sed 's/.*/\u&/'
}
# Translate DISTRIB_ID to vendor name (like %_vendor does) # Translate DISTRIB_ID to vendor name (like %_vendor does)
rpmvendor() rpmvendor()
{ {
...@@ -46,11 +51,12 @@ pkgvendor() ...@@ -46,11 +51,12 @@ pkgvendor()
# Print pkgtype (need DISTRIB_ID var) # Print pkgtype (need DISTRIB_ID var)
pkgtype() pkgtype()
{ {
# TODO: try use generic names
case $(pkgvendor) in case $(pkgvendor) in
freebsd) echo "tbz" ;; freebsd) echo "tbz" ;;
sunos) echo "pkg.gz" ;; sunos) echo "pkg.gz" ;;
slackware|mopslinux) echo "tgz" ;; slackware|mopslinux) echo "tgz" ;;
archlinux) echo "pkg.tar.xz" ;; archlinux|manjaro) echo "pkg.tar.xz" ;;
gentoo) echo "tbz2" ;; gentoo) echo "tbz2" ;;
windows) echo "exe" ;; windows) echo "exe" ;;
android) echo "apk" ;; android) echo "apk" ;;
...@@ -140,7 +146,7 @@ elif distro slackware-version ; then ...@@ -140,7 +146,7 @@ elif distro slackware-version ; then
elif distro os-release && which apk 2>/dev/null >/dev/null ; then elif distro os-release && which apk 2>/dev/null >/dev/null ; then
# shellcheck disable=SC1090 # shellcheck disable=SC1090
. $ROOTDIR/etc/os-release . $ROOTDIR/etc/os-release
DISTRIB_ID="$ID" DISTRIB_ID="$(firstupper "$ID")"
DISTRIB_RELEASE="$VERSION_ID" DISTRIB_RELEASE="$VERSION_ID"
elif distro os-release && which tce-ab 2>/dev/null >/dev/null ; then elif distro os-release && which tce-ab 2>/dev/null >/dev/null ; then
...@@ -162,6 +168,7 @@ elif distro arch-release ; then ...@@ -162,6 +168,7 @@ elif distro arch-release ; then
DISTRIB_RELEASE="2011" DISTRIB_RELEASE="2011"
fi fi
# Elbrus
elif distro mcst_version ; then elif distro mcst_version ; then
DISTRIB_ID="MCST" DISTRIB_ID="MCST"
DISTRIB_RELEASE=$(cat "$DISTROFILE" | grep "release" | sed -e "s|.*release \([0-9]*\).*|\1|g") DISTRIB_RELEASE=$(cat "$DISTROFILE" | grep "release" | sed -e "s|.*release \([0-9]*\).*|\1|g")
...@@ -272,6 +279,14 @@ elif distro SuSe-release || distro SuSE-release ; then ...@@ -272,6 +279,14 @@ elif distro SuSe-release || distro SuSE-release ; then
DISTRIB_ID="SLES" DISTRIB_ID="SLES"
fi fi
# https://www.freedesktop.org/software/systemd/man/os-release.html
elif distro os-release ; then
# shellcheck disable=SC1090
. $ROOTDIR/etc/os-release
DISTRIB_ID="$(firstupper "$ID")"
DISTRIB_RELEASE="$VERSION_ID"
[ -n "$DISTRIB_RELEASE" ] || DISTRIB_RELEASE="CUR"
# fixme: can we detect by some file? # fixme: can we detect by some file?
elif [ "$(uname)" = "FreeBSD" ] ; then elif [ "$(uname)" = "FreeBSD" ] ; then
DISTRIB_ID="FreeBSD" DISTRIB_ID="FreeBSD"
...@@ -314,6 +329,112 @@ elif distro lsb-release && [ -n "$DISTRIB_RELEASE" ]; then ...@@ -314,6 +329,112 @@ elif distro lsb-release && [ -n "$DISTRIB_RELEASE" ]; then
esac esac
fi fi
get_base_os_name()
{
local DIST_OS
# Resolve the os
DIST_OS=`uname -s | tr [:upper:] [:lower:] | tr -d " \t\r\n"`
case "$DIST_OS" in
'sunos')
DIST_OS="solaris"
;;
'hp-ux' | 'hp-ux64')
DIST_OS="hpux"
;;
'darwin' | 'oarwin')
DIST_OS="macosx"
;;
'unix_sv')
DIST_OS="unixware"
;;
'freebsd' | 'openbsd' | 'netbsd')
DIST_OS="freebsd"
;;
esac
echo "$DIST_OS"
}
get_arch()
{
local DIST_ARCH
# Resolve the architecture
DIST_ARCH=`uname -m | tr [:upper:] [:lower:] | tr -d " \t\r\n"`
case "$DIST_ARCH" in
'amd64' | 'ia32' | 'i386' | 'i486' | 'i586' | 'i686' | 'x86_64')
DIST_ARCH="x86"
;;
'ia64' | 'ia-64')
DIST_ARCH="ia64"
;;
'ip27' | 'mips')
DIST_ARCH="mips"
;;
'powermacintosh' | 'power' | 'powerpc' | 'power_pc' | 'ppc64')
DIST_ARCH="ppc"
;;
'pa_risc' | 'pa-risc')
DIST_ARCH="parisc"
;;
'sun4u' | 'sparcv9')
DIST_ARCH="sparc"
;;
'9000/800')
DIST_ARCH="parisc"
;;
armv*)
if [ -z "`readelf -A /proc/self/exe | grep Tag_ABI_VFP_args`" ] ; then
DIST_ARCH="armel"
else
DIST_ARCH="armhf"
fi
;;
esac
echo "$DIST_ARCH"
}
get_bit_size()
{
local DIST_BIT
# Check if we are running on 64bit platform, seems like a workaround for now...
DIST_BIT=`uname -m | tr [:upper:] [:lower:] | tr -d " \t\r\n"`
case "$DIST_BIT" in
'amd64' | 'ia64' | 'x86_64' | 'ppc64')
DIST_BIT="64"
;;
# 'pa_risc' | 'pa-risc') # Are some of these 64bit? Least not all...
# BIT="64"
# ;;
'sun4u' | 'sparcv9') # Are all sparcs 64?
DIST_BIT="64"
;;
# '9000/800')
# DIST_BIT="64"
# ;;
*) # In any other case default to 32
DIST_BIT="32"
;;
esac
echo "$DIST_BIT"
}
get_memory_size() {
local detected=0
local DIST_OS=$(get_base_os_name)
if [ $DIST_OS = "macosx" ]
then
detected=$((`sysctl hw.memsize | sed s/"hw.memsize: "//`/1024/1024))
elif [ $DIST_OS = "freebsd" ]
then
detected=$((`sysctl hw.physmem | sed s/"hw.physmem: "//`/1024/1024))
elif [ $DIST_OS = "linux" ]
then
detected=$((`cat /proc/meminfo | grep MemTotal | awk '{print $2}'`/1024))
fi
# Exit codes only support values between 0 and 255. So use stdout.
echo $detected
}
case $1 in case $1 in
-p) -p)
# override DISTRIB_ID # override DISTRIB_ID
...@@ -326,6 +447,10 @@ case $1 in ...@@ -326,6 +447,10 @@ case $1 in
echo "Usage: distr_vendor [options] [args]" echo "Usage: distr_vendor [options] [args]"
echo "-p [SystemName] - print type of packaging system" echo "-p [SystemName] - print type of packaging system"
echo "-d - print distro name" echo "-d - print distro name"
echo "-a - print hardware architecture"
echo "-b - print size of arch bit (32/64)"
echo "-m - print system memory size (in MB)"
echo "-o - print base os name"
echo "-v - print version of distro" echo "-v - print version of distro"
echo "-e - print full name of distro with version (by default)" echo "-e - print full name of distro with version (by default)"
echo "-s [SystemName] - print name of distro for build system (like in the package release name)" echo "-s [SystemName] - print name of distro for build system (like in the package release name)"
...@@ -337,6 +462,18 @@ case $1 in ...@@ -337,6 +462,18 @@ case $1 in
-d) -d)
echo $DISTRIB_ID echo $DISTRIB_ID
;; ;;
-a)
get_arch
;;
-b)
get_bit_size
;;
-m)
get_memory_size
;;
-o)
get_base_os_name
;;
-v) -v)
echo $DISTRIB_RELEASE echo $DISTRIB_RELEASE
;; ;;
......
...@@ -79,6 +79,7 @@ verbose= ...@@ -79,6 +79,7 @@ verbose=
quiet= quiet=
nodeps= nodeps=
noremove= noremove=
dryrun=
force= force=
short= short=
direct= direct=
...@@ -255,7 +256,7 @@ check_command() ...@@ -255,7 +256,7 @@ check_command()
clean) # HELPCMD: clean local package cache clean) # HELPCMD: clean local package cache
epm_cmd=clean epm_cmd=clean
;; ;;
autoremove|package-cleanup) # HELPCMD: auto remove unneeded package(s) autoremove|package-cleanup) # HELPCMD: auto remove unneeded package(s) Supports args for ALT: [libs|python|perl|libs-devel]
epm_cmd=autoremove epm_cmd=autoremove
;; ;;
autoorphans|--orphans) # HELPCMD: remove all packages not from the repository autoorphans|--orphans) # HELPCMD: remove all packages not from the repository
...@@ -334,6 +335,9 @@ check_option() ...@@ -334,6 +335,9 @@ check_option()
--noremove|--no-remove) # HELPOPT: exit if any packages are to be removed during upgrade --noremove|--no-remove) # HELPOPT: exit if any packages are to be removed during upgrade
noremove="--no-remove" noremove="--no-remove"
;; ;;
--dry-run|--simulate|--just-print|-recon--no-act) # HELPOPT: print only (autoremove/autoorphans only)
dryrun="--dry-run"
;;
--short) # HELPOPT: short output (just 'package' instead 'package-version-release') --short) # HELPOPT: short output (just 'package' instead 'package-version-release')
short="--short" short="--short"
;; ;;
......
...@@ -17,53 +17,86 @@ ...@@ -17,53 +17,86 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
load_helper epm-sh-altlinux
__epm_addrepo_altlinux()
{
local repo="$@"
case "$1" in
etersoft)
info "add Etersoft's addon repo"
load_helper epm-query
epm install --skip-installed apt-conf-etersoft-common apt-conf-etersoft-hold
# TODO: ignore only error code 22 (skipped) || fatal
local branch="$DISTRVERSION/branch"
[ "$DISTRVERSION" = "Sisyphus" ] && branch="$DISTRVERSION"
# FIXME
[ -n "$DISTRVERSION" ] || fatal "Empty DISTRVERSION"
# TODO: func?
local arch=$(uname -m)
[ "$arch" = "i686" ] && arch="i586"
# TODO: use apt-repo add ?
echo "" | sudocmd tee -a /etc/apt/sources.list
echo "# added with eepm addrepo etersoft" | sudocmd tee -a /etc/apt/sources.list
echo "rpm [etersoft] http://download.etersoft.ru/pub/Etersoft LINUX@Etersoft/$branch/$arch addon" | sudocmd tee -a /etc/apt/sources.list
if [ "$arch" = "x86_64" ] ; then
echo "rpm [etersoft] http://download.etersoft.ru/pub/Etersoft LINUX@Etersoft/$branch/$arch-i586 addon" | sudocmd tee -a /etc/apt/sources.list
fi
echo "rpm [etersoft] http://download.etersoft.ru/pub/Etersoft LINUX@Etersoft/$branch/noarch addon" | sudocmd tee -a /etc/apt/sources.list
repo="$DISTRVERSION"
return 0
;;
autoimports)
[ -n "$DISTRVERSION" ] || fatal "Empty DISTRVERSION"
repo="$repo.$(echo "$DISTRVERSION" | tr "[:upper:]" "[:lower:]")"
;;
archive)
datestr="$2"
# 2017/12/31
# TODO: func?
local arch=$(uname -m)
[ "$arch" = "i686" ] && arch="i586"
echo "" | sudocmd tee -a /etc/apt/sources.list
echo "rpm [alt] ftp://ftp.altlinux.org/pub/distributions archive/sisyphus/date/$datestr/$arch classic" | sudocmd tee -a /etc/apt/sources.list
if [ "$arch" = "x86_64" ] ; then
echo "rpm [alt] ftp://ftp.altlinux.org/pub/distributions archive/sisyphus/date/$datestr/$arch-i586 classic" | sudocmd tee -a /etc/apt/sources.list
fi
echo "rpm [alt] ftp://ftp.altlinux.org/pub/distributions archive/sisyphus/date/$datestr/noarch classic" | sudocmd tee -a /etc/apt/sources.list
return 0
;;
esac
assure_exists apt-repo
if tasknumber "$repo" >/dev/null ; then
sudocmd apt-repo add $(tasknumber "$repo")
return
fi
if [ -z "$repo" ] ; then
info "Add branch repo. TODO?"
sudodocmd apt-repo add branch
return
fi
sudocmd apt-repo add "$repo"
}
epm_addrepo() epm_addrepo()
{ {
local repo="$(eval echo "$quoted_args")" local repo="$(eval echo "$quoted_args")"
case $DISTRNAME in case $DISTRNAME in
ALTLinux) ALTLinux)
case "$repo" in __epm_addrepo_altlinux $repo
etersoft)
info "add etersoft repo"
load_helper epm-query
epm install --skip-installed apt-conf-etersoft-common apt-conf-etersoft-hold || fatal
local branch="$DISTRVERSION/branch"
[ "$DISTRVERSION" = "Sisyphus" ] && branch="$DISTRVERSION"
# FIXME
[ -n "$DISTRVERSION" ] || fatal "Empty DISTRVERSION"
local arch=$(uname -m)
[ "$arch" = "i686" ] && arch="i586"
echo "" | sudocmd tee -a /etc/apt/sources.list
echo "# added with eepm addrepo etersoft" | sudocmd tee -a /etc/apt/sources.list
echo "rpm [etersoft] http://download.etersoft.ru/pub/Etersoft LINUX@Etersoft/$branch/$arch addon" | sudocmd tee -a /etc/apt/sources.list
if [ "$arch" = "x86_64" ] ; then
echo "rpm [etersoft] http://download.etersoft.ru/pub/Etersoft LINUX@Etersoft/$branch/$arch-i586 addon" | sudocmd tee -a /etc/apt/sources.list
fi
echo "rpm [etersoft] http://download.etersoft.ru/pub/Etersoft LINUX@Etersoft/$branch/noarch addon" | sudocmd tee -a /etc/apt/sources.list
repo="$DISTRVERSION"
return 0
;;
autoimports)
[ -n "$DISTRVERSION" ] || fatal "Empty DISTRVERSION"
repo="$repo.$(echo "$DISTRVERSION" | tr "[:upper:]" "[:lower:]")"
esac
assure_exists apt-repo
if [ -z "$repo" ] ; then
docmd apt-repo add branch
echo "etersoft"
return
fi
sudocmd apt-repo add "$repo"
return return
;; ;;
esac esac
case $PMTYPE in case $PMTYPE in
apt-dpkg|aptitude-dpkg) apt-dpkg|aptitude-dpkg)
info "You need manually add repo to /etc/apt/sources.list" info "You need manually add repo to /etc/apt/sources.list (TODO)"
;; ;;
yum-rpm) yum-rpm)
assure_exists yum-utils assure_exists yum-utils
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2015, 2016 Etersoft # Copyright (C) 2015, 2017 Etersoft
# Copyright (C) 2015, 2016 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2015, 2017 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
...@@ -32,18 +32,25 @@ case $PMTYPE in ...@@ -32,18 +32,25 @@ case $PMTYPE in
apt-rpm) apt-rpm)
# ALT Linux only # ALT Linux only
assure_exists /etc/buildreqs/files/ignore.d/apt-scripts apt-scripts assure_exists /etc/buildreqs/files/ignore.d/apt-scripts apt-scripts
echo "We will try remove all installed packages which are missed in repositories" if [ -z "$dryrun" ] ; then
warning "Use with caution!" echo "We will try remove all installed packages which are missed in repositories"
warning "Use with caution!"
fi
local PKGLIST=$(__epm_orphan_altrpm \ local PKGLIST=$(__epm_orphan_altrpm \
| sed -e "s/\.32bit//g" \ | sed -e "s/\.32bit//g" \
| grep -v -- "^eepm$" \ | grep -v -- "^eepm$" \
| grep -v -- "^kernel") | grep -v -- "^kernel")
docmd epm remove $PKGLIST
if [ -n "$quiet" ] ; then
echo "$PKGLIST"
else
docmd epm remove $dryrun $PKGLIST
fi
;; ;;
apt-dpkg|aptitude-dpkg) apt-dpkg|aptitude-dpkg)
assure_exists deborphan assure_exists deborphan
showcmd deborphan showcmd deborphan
a='' deborphan | docmd epm remove a='' deborphan | docmd epm remove $dryrun
;; ;;
#aura) #aura)
# sudocmd aura -Oj # sudocmd aura -Oj
...@@ -51,18 +58,22 @@ case $PMTYPE in ...@@ -51,18 +58,22 @@ case $PMTYPE in
yum-rpm) yum-rpm)
showcmd package-cleanup --orphans showcmd package-cleanup --orphans
local PKGLIST=$(package-cleanup -q --orphans | grep -v "^eepm-") local PKGLIST=$(package-cleanup -q --orphans | grep -v "^eepm-")
docmd epm remove $PKGLIST docmd epm remove $dryrun $PKGLIST
;; ;;
dnf-rpm) dnf-rpm)
# TODO: dnf list extras # TODO: dnf list extras
# TODO: Yum-utils package has been deprecated, use dnf instead. # TODO: Yum-utils package has been deprecated, use dnf instead.
showcmd package-cleanup --orphans showcmd package-cleanup --orphans
local PKGLIST=$(package-cleanup -q --orphans | grep -v "^eepm-") local PKGLIST=$(package-cleanup -q --orphans | grep -v "^eepm-")
docmd epm remove $PKGLIST docmd epm remove $dryrun $PKGLIST
;; ;;
urpm-rpm) urpm-rpm)
showcmd urpme --report-orphans if [ -n "$dryrun" ] ; then
sudocmd urpme --auto-orphans fatal "--dry-run is not supported yet"
else
showcmd urpme --report-orphans
sudocmd urpme --auto-orphans
fi
;; ;;
#emerge) #emerge)
# sudocmd emerge --depclean # sudocmd emerge --depclean
...@@ -70,7 +81,12 @@ case $PMTYPE in ...@@ -70,7 +81,12 @@ case $PMTYPE in
# sudocmd revdep-rebuild # sudocmd revdep-rebuild
# ;; # ;;
pacman) pacman)
sudocmd pacman -Qdtq | sudocmd pacman -Rs - if [ -n "$dryrun" ] ; then
info "Autoorphans packages list:"
sudocmd pacman -Qdtq
else
sudocmd pacman -Qdtq | sudocmd pacman -Rs -
fi
;; ;;
#slackpkg) #slackpkg)
# clean-system removes non official packages # clean-system removes non official packages
...@@ -89,10 +105,14 @@ case $PMTYPE in ...@@ -89,10 +105,14 @@ case $PMTYPE in
sudocmd zypper packages --orphaned sudocmd zypper packages --orphaned
# FIXME: x86_64/i586 are duplicated # FIXME: x86_64/i586 are duplicated
local PKGLIST=$(zypper packages --orphaned | tail -n +5 | cut -d \| -f 3 | sort -u) local PKGLIST=$(zypper packages --orphaned | tail -n +5 | cut -d \| -f 3 | sort -u)
sudocmd zypper remove --clean-deps $PKGLIST docmd epm remove $dryrun --clean-deps $PKGLIST
;; ;;
xbps) xbps)
CMD="xbps-remove -o" if [ -n "$dryrun" ] ; then
fatal "--dry-run is not supported yet"
else
sudocmd xbps-remove -o
fi
;; ;;
*) *)
fatal "Have no suitable command for $PMTYPE" fatal "Have no suitable command for $PMTYPE"
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012, 2016 Etersoft # Copyright (C) 2012, 2017 Etersoft
# Copyright (C) 2012, 2016 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012, 2017 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
...@@ -25,19 +25,27 @@ __epm_autoremove_altrpm_pp() ...@@ -25,19 +25,27 @@ __epm_autoremove_altrpm_pp()
#[ -n "$force" ] || info "You can run with --force for more deep removing" #[ -n "$force" ] || info "You can run with --force for more deep removing"
local force=force local force=force
local libexclude="$1"
local flag= local flag=
[ -n "$force" ] || libexclude=$libexclude'[^-]*$'
libexclude='^(python-module-|python3-module-|python-modules-|python3-modules|perl-)'
[ -n "$force" ] || libexclude=$libexclude'[^-]*$' [ -n "$force" ] || libexclude=$libexclude'[^-]*$'
showcmd "apt-cache list-nodeps | grep -E -- \"$libexclude\"" showcmd "apt-cache list-nodeps | grep -E -- \"$libexclude\""
pkgs=$(apt-cache list-nodeps | grep -E -- "$libexclude" ) pkgs=$(apt-cache list-nodeps | grep -E -- "$libexclude" )
if [ -n "$dryrun" ] ; then
info "Packages for autoremoving:"
echo "$pkgs"
return 0
fi
[ -n "$pkgs" ] && sudocmd rpm -v -e $pkgs && flag=1 [ -n "$pkgs" ] && sudocmd rpm -v -e $pkgs && flag=1
if [ -n "$flag" ] ; then if [ -n "$flag" ] ; then
info "" info ""
info "call again for next cycle until all modules will be removed" info "call again for next cycle until all modules will be removed"
__epm_autoremove_altrpm_pp __epm_autoremove_altrpm_pp "$libexclude"
fi fi
return 0 return 0
...@@ -47,8 +55,16 @@ __epm_autoremove_altrpm_lib() ...@@ -47,8 +55,16 @@ __epm_autoremove_altrpm_lib()
{ {
local pkgs local pkgs
local nodevel="$1"
info info
info "Removing all non -devel/-debuginfo libs packages not need by anything..." if [ "$nodevel" = "nodevel" ] ; then
info "Removing all non -devel/-debuginfo libs packages not need by anything..."
local develrule='-(devel|devel-static)$'
else
info "Removing all non -debuginfo libs packages (-devel too) not need by anything..."
local develrule='-(NONONO)$'
fi
#[ -n "$force" ] || info "You can run with --force for more deep removing" #[ -n "$force" ] || info "You can run with --force for more deep removing"
local force=force local force=force
...@@ -60,15 +76,23 @@ __epm_autoremove_altrpm_lib() ...@@ -60,15 +76,23 @@ __epm_autoremove_altrpm_lib()
showcmd "apt-cache list-nodeps | grep -- \"$libexclude\"" showcmd "apt-cache list-nodeps | grep -- \"$libexclude\""
pkgs=$(apt-cache list-nodeps | grep -E -- "$libexclude" \ pkgs=$(apt-cache list-nodeps | grep -E -- "$libexclude" \
| sed -e "s/[-\.]32bit$//g" \ | sed -e "s/[-\.]32bit$//g" \
| grep -E -v -- "-(devel|devel-static|debuginfo)$" \ | grep -E -v -- "$develrule" \
| grep -E -v -- "-(debuginfo)$" \
| grep -E -v -- "-(util|utils|tool|tools|plugin|daemon|help)$" \ | grep -E -v -- "-(util|utils|tool|tools|plugin|daemon|help)$" \
| grep -E -v -- "^(libsystemd|libreoffice|libnss|libvirt-client|libvirt-daemon|libsasl2-plugin|eepm)" ) | grep -E -v -- "^(libsystemd|libreoffice|libnss|libvirt-client|libvirt-daemon|libsasl2-plugin|eepm)" )
if [ -n "$dryrun" ] ; then
info "Packages for autoremoving:"
echo "$pkgs"
return 0
fi
[ -n "$pkgs" ] && sudocmd rpm -v -e $pkgs && flag=1 [ -n "$pkgs" ] && sudocmd rpm -v -e $pkgs && flag=1
if [ -n "$flag" ] ; then if [ -n "$flag" ] ; then
info "" info ""
info "call again for next cycle until all libs will be removed" info "call again for next cycle until all libs will be removed"
__epm_autoremove_altrpm_lib __epm_autoremove_altrpm_lib $nodevel
fi fi
return 0 return 0
...@@ -77,12 +101,35 @@ __epm_autoremove_altrpm_lib() ...@@ -77,12 +101,35 @@ __epm_autoremove_altrpm_lib()
__epm_autoremove_altrpm() __epm_autoremove_altrpm()
{ {
local pkg local i
load_helper epm-packages load_helper epm-packages
assure_exists /etc/buildreqs/files/ignore.d/apt-scripts apt-scripts assure_exists /etc/buildreqs/files/ignore.d/apt-scripts apt-scripts
__epm_autoremove_altrpm_pp if [ -z "$pkg_names" ] ; then
__epm_autoremove_altrpm_lib __epm_autoremove_altrpm_pp '^(python-module-|python3-module-|python-modules-|python3-modules|perl-)'
__epm_autoremove_altrpm_lib nodevel
return 0
fi
for i in $pkg_names ; do
case $i in
libs)
__epm_autoremove_altrpm_lib nodevel
;;
python)
__epm_autoremove_altrpm_pp '^(python-module-|python3-module-|python-modules-|python3-modules)'
;;
perl)
__epm_autoremove_altrpm_pp '^(perl-)'
;;
libs-devel)
__epm_autoremove_altrpm_lib
;;
*)
fatal "autoremove: unsupported '$i'. Use libs, python, perl, libs-devel."
;;
esac
done
return 0 return 0
} }
...@@ -91,11 +138,12 @@ __epm_autoremove_altrpm() ...@@ -91,11 +138,12 @@ __epm_autoremove_altrpm()
epm_autoremove() epm_autoremove()
{ {
[ -z "$pkg_filenames" ] || fatal "No arguments are allowed here"
case $DISTRNAME in case $DISTRNAME in
ALTLinux) ALTLinux)
__epm_autoremove_altrpm __epm_autoremove_altrpm
[ -n "$dryrun" ] && return
docmd epm remove-old-kernels docmd epm remove-old-kernels
if which nvidia-clean-driver 2>/dev/null ; then if which nvidia-clean-driver 2>/dev/null ; then
...@@ -108,11 +156,16 @@ case $DISTRNAME in ...@@ -108,11 +156,16 @@ case $DISTRNAME in
;; ;;
esac esac
[ -z "$pkg_filenames" ] || fatal "No arguments are allowed here"
case $PMTYPE in case $PMTYPE in
apt-dpkg|aptitude-dpkg) apt-dpkg|aptitude-dpkg)
sudocmd apt-get autoremove sudocmd apt-get autoremove $dryrun
;; ;;
aura) aura)
if [ -n "$dryrun" ] ; then
fatal "--dry-run is not supported yet"
fi
sudocmd aura -Oj sudocmd aura -Oj
;; ;;
yum-rpm) yum-rpm)
...@@ -123,10 +176,13 @@ case $PMTYPE in ...@@ -123,10 +176,13 @@ case $PMTYPE in
# FIXME: package-cleanup have to use stderr for errors # FIXME: package-cleanup have to use stderr for errors
local PKGLIST=$(package-cleanup -q --leaves | grep -v "^eepm-") local PKGLIST=$(package-cleanup -q --leaves | grep -v "^eepm-")
[ -n "$PKGLIST" ] || break [ -n "$PKGLIST" ] || break
sudocmd yum remove $PKGLIST showcmd epm remove $PKGLIST
done done
;; ;;
dnf-rpm) dnf-rpm)
if [ -n "$dryrun" ] ; then
fatal "--dry-run is not supported yet"
fi
sudocmd dnf autoremove sudocmd dnf autoremove
;; ;;
# see autoorhans # see autoorhans
...@@ -134,6 +190,9 @@ case $PMTYPE in ...@@ -134,6 +190,9 @@ case $PMTYPE in
# sudocmd urpme --auto-orphans # sudocmd urpme --auto-orphans
# ;; # ;;
emerge) emerge)
if [ -n "$dryrun" ] ; then
fatal "--dry-run is not supported yet"
fi
sudocmd emerge --depclean sudocmd emerge --depclean
assure_exists revdep-rebuild assure_exists revdep-rebuild
sudocmd revdep-rebuild sudocmd revdep-rebuild
...@@ -158,10 +217,13 @@ case $PMTYPE in ...@@ -158,10 +217,13 @@ case $PMTYPE in
sudocmd zypper packages --unneeded sudocmd zypper packages --unneeded
# FIXME: x86_64/i586 are duplicated # FIXME: x86_64/i586 are duplicated
local PKGLIST=$(zypper packages --unneeded | tail -n +5 | cut -d \| -f 3 | sort -u) local PKGLIST=$(zypper packages --unneeded | tail -n +5 | cut -d \| -f 3 | sort -u)
sudocmd zypper remove --clean-deps $PKGLIST showcmd epm remove --clean-deps $PKGLIST
;; ;;
xbps) xbps)
CMD="xbps-remove -O" if [ -n "$dryrun" ] ; then
fatal "--dry-run is not supported yet"
fi
sudocmd xbps-remove -O
;; ;;
*) *)
fatal "Have no suitable command for $PMTYPE" fatal "Have no suitable command for $PMTYPE"
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
load_helper epm-query load_helper epm-query
load_helper epm-print load_helper epm-print
load_helper epm-sh-warmup
# TODO: port or rewrite apt-file # TODO: port or rewrite apt-file
# https://bugzilla.altlinux.org/show_bug.cgi?id=14449 # https://bugzilla.altlinux.org/show_bug.cgi?id=14449
...@@ -110,6 +111,8 @@ __epm_filelist_name() ...@@ -110,6 +111,8 @@ __epm_filelist_name()
[ -z "$*" ] && return [ -z "$*" ] && return
warmup_lowbase
case $PMTYPE in case $PMTYPE in
*-rpm) *-rpm)
CMD="rpm -ql" CMD="rpm -ql"
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012-2016 Etersoft # Copyright (C) 2012-2017 Etersoft
# Copyright (C) 2012-2016 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012-2017 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
...@@ -17,9 +17,11 @@ ...@@ -17,9 +17,11 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
load_helper epm-sh-altlinux
load_helper epm-query load_helper epm-query
load_helper epm-assure load_helper epm-assure
load_helper epm-check_updated_repo load_helper epm-check_updated_repo
load_helper epm-sh-warmup
# TODO: use when run install with epm --skip-installed install # TODO: use when run install with epm --skip-installed install
filter_out_installed_packages() filter_out_installed_packages()
...@@ -86,12 +88,15 @@ __separate_sudocmd() ...@@ -86,12 +88,15 @@ __separate_sudocmd()
# copied from etersoft-build-utils/share/eterbuild/functions/rpmpkg # copied from etersoft-build-utils/share/eterbuild/functions/rpmpkg
epm_install_names() epm_install_names()
{ {
[ -z "$1" ] && return
warmup_hibase
if [ -n "$non_interactive" ] ; then if [ -n "$non_interactive" ] ; then
epm_ni_install_names "$@" epm_ni_install_names "$@"
return return
fi fi
[ -z "$1" ] && return
case $PMTYPE in case $PMTYPE in
apt-rpm|apt-dpkg) apt-rpm|apt-dpkg)
APTOPTIONS="$APTOPTIONS $(subst_option verbose "-o Debug::pkgMarkInstall=1 -o Debug::pkgProblemResolver=1")" APTOPTIONS="$APTOPTIONS $(subst_option verbose "-o Debug::pkgMarkInstall=1 -o Debug::pkgProblemResolver=1")"
...@@ -185,6 +190,7 @@ epm_install_names() ...@@ -185,6 +190,7 @@ epm_install_names()
epm_ni_install_names() epm_ni_install_names()
{ {
[ -z "$1" ] && return [ -z "$1" ] && return
case $PMTYPE in case $PMTYPE in
apt-rpm|apt-dpkg) apt-rpm|apt-dpkg)
export DEBIAN_FRONTEND=noninteractive export DEBIAN_FRONTEND=noninteractive
...@@ -565,6 +571,12 @@ epm_print_install_names_command() ...@@ -565,6 +571,12 @@ epm_print_install_names_command()
epm_install() epm_install()
{ {
if tasknumber "$pkg_names" >/dev/null ; then
assure_exists apt-repo
sudocmd apt-repo test $(tasknumber "$pkg_names")
return
fi
if [ -n "$show_command_only" ] ; then if [ -n "$show_command_only" ] ; then
epm_print_install_command $pkg_files epm_print_install_command $pkg_files
epm_print_install_names_command $pkg_names epm_print_install_names_command $pkg_names
...@@ -583,10 +595,18 @@ epm_install() ...@@ -583,10 +595,18 @@ epm_install()
[ -z "$pkg_files$pkg_names" ] && info "Skip empty install list" && return 22 [ -z "$pkg_files$pkg_names" ] && info "Skip empty install list" && return 22
# to be filter happy
warmup_lowbase
local names="$(echo $pkg_names | filter_out_installed_packages)" local names="$(echo $pkg_names | filter_out_installed_packages)"
local files="$(echo $pkg_files | filter_out_installed_packages)" local files="$(echo $pkg_files | filter_out_installed_packages)"
[ -z "$files$names" ] && info "Skip empty install list" && return 22 # can be empty only after skip installed
if [ -z "$files$names" ] ; then
# TODO: assert $skip_installed
[ -n "$verbose" ] && info "Skip empty install list"
return 22
fi
if [ -z "$files" ] && [ -z "$direct" ] ; then if [ -z "$files" ] && [ -z "$direct" ] ; then
# it is useful for first time running # it is useful for first time running
......
...@@ -18,9 +18,12 @@ ...@@ -18,9 +18,12 @@
# #
load_helper epm-check_updated_repo load_helper epm-check_updated_repo
load_helper epm-sh-warmup
epm_kernel_update() epm_kernel_update()
{ {
warmup_bases
info "Updating system kernel to the latest version..." info "Updating system kernel to the latest version..."
case $DISTRNAME in case $DISTRNAME in
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012, 2016 Etersoft # Copyright (C) 2012, 2016, 2017 Etersoft
# Copyright (C) 2012, 2016 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012, 2016, 2017 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
...@@ -17,15 +17,19 @@ ...@@ -17,15 +17,19 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
load_helper epm-sh-warmup
__epm_packages_sort() __epm_packages_sort()
{ {
# FIXME: sort depends on --sort value # FIXME: sort depends on --sort value
case $PMTYPE in case $PMTYPE in
apt-rpm|yum-rpm|urpm-rpm|zypper-rpm|dnf-rpm) apt-rpm|yum-rpm|urpm-rpm|zypper-rpm|dnf-rpm)
# FIXME: space with quotes problems, use point instead # FIXME: space with quotes problems, use point instead
warmup_rpmbase
docmd rpm -qa --queryformat "%{size}@%{name}-%{version}-%{release}\n" $pkg_filenames | sed -e "s|@| |g" | sort -n -k1 docmd rpm -qa --queryformat "%{size}@%{name}-%{version}-%{release}\n" $pkg_filenames | sed -e "s|@| |g" | sort -n -k1
;; ;;
apt-dpkg) apt-dpkg)
warmup_dpkgbase
docmd dpkg-query -W --showformat="\${Installed-Size}@\${Package}-\${Version}\n" $pkg_filenames | sed -e "s|@| |g" | sort -n -k1 docmd dpkg-query -W --showformat="\${Installed-Size}@\${Package}-\${Version}\n" $pkg_filenames | sed -e "s|@| |g" | sort -n -k1
;; ;;
*) *)
...@@ -54,12 +58,14 @@ epm_packages() ...@@ -54,12 +58,14 @@ epm_packages()
case $PMTYPE in case $PMTYPE in
apt-rpm) apt-rpm)
warmup_rpmbase
# FIXME: strong equal # FIXME: strong equal
CMD="rpm -qa $pkg_filenames" CMD="rpm -qa $pkg_filenames"
[ -n "$short" ] && CMD="rpm -qa --queryformat %{name}\n $pkg_filenames" [ -n "$short" ] && CMD="rpm -qa --queryformat %{name}\n $pkg_filenames"
docmd $CMD docmd $CMD
return ;; return ;;
*-dpkg) *-dpkg)
warmup_dpkgbase
# FIXME: strong equal # FIXME: strong equal
#CMD="dpkg -l $pkg_filenames" #CMD="dpkg -l $pkg_filenames"
CMD="dpkg-query -W --showformat=\${db:Status-Abbrev}\${Package}-\${Version}\n $pkg_filenames" CMD="dpkg-query -W --showformat=\${db:Status-Abbrev}\${Package}-\${Version}\n $pkg_filenames"
...@@ -71,6 +77,7 @@ case $PMTYPE in ...@@ -71,6 +77,7 @@ case $PMTYPE in
CMD="snappy info" CMD="snappy info"
;; ;;
yum-rpm|urpm-rpm|zypper-rpm|dnf-rpm) yum-rpm|urpm-rpm|zypper-rpm|dnf-rpm)
warmup_rpmbase
# FIXME: strong equal # FIXME: strong equal
CMD="rpm -qa $pkg_filenames" CMD="rpm -qa $pkg_filenames"
[ -n "$short" ] && CMD="rpm -qa --queryformat %{name}\n $pkg_filenames" [ -n "$short" ] && CMD="rpm -qa --queryformat %{name}\n $pkg_filenames"
......
...@@ -18,12 +18,15 @@ ...@@ -18,12 +18,15 @@
# #
load_helper epm-query load_helper epm-query
load_helper epm-sh-warmup
epm_policy() epm_policy()
{ {
[ -n "$pkg_names" ] || fatal "Info: missing package(s) name" [ -n "$pkg_names" ] || fatal "Info: missing package(s) name"
warmup_bases
# get package name for hi level package management command (with version if supported and if possible) # get package name for hi level package management command (with version if supported and if possible)
pkg_names=$(__epm_get_hilevel_name $pkg_names) pkg_names=$(__epm_get_hilevel_name $pkg_names)
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012,2014,2016 Etersoft # Copyright (C) 2012,2014,2016,2017 Etersoft
# Copyright (C) 2012,2014,2016 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012,2014,2016,2017 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
...@@ -18,11 +18,13 @@ ...@@ -18,11 +18,13 @@
# #
load_helper epm-install load_helper epm-install
load_helper epm-sh-warmup
# copied from etersoft-build-utils/share/eterbuild/functions/rpmpkg # copied from etersoft-build-utils/share/eterbuild/functions/rpmpkg
epm_reinstall_names() epm_reinstall_names()
{ {
[ -n "$1" ] || return [ -n "$1" ] || return
case $PMTYPE in case $PMTYPE in
apt-rpm|apt-dpkg) apt-rpm|apt-dpkg)
local APTOPTIONS="$(subst_option non_interactive -y)" local APTOPTIONS="$(subst_option non_interactive -y)"
...@@ -75,9 +77,13 @@ epm_reinstall() ...@@ -75,9 +77,13 @@ epm_reinstall()
{ {
[ -n "$pkg_filenames" ] || fatal "Reinstall: missing package(s) name." [ -n "$pkg_filenames" ] || fatal "Reinstall: missing package(s) name."
warmup_lowbase
# get package name for hi level package management command (with version if supported and if possible) # get package name for hi level package management command (with version if supported and if possible)
pkg_names=$(__epm_get_hilevel_name $pkg_names) pkg_names=$(__epm_get_hilevel_name $pkg_names)
warmup_hibase
epm_reinstall_names $pkg_names epm_reinstall_names $pkg_names
epm_reinstall_files $pkg_files epm_reinstall_files $pkg_files
} }
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012-2014, 2016 Etersoft # Copyright (C) 2012-2014, 2016, 2017 Etersoft
# Copyright (C) 2012-2014, 2016 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012-2014, 2016, 2017 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
...@@ -17,13 +17,18 @@ ...@@ -17,13 +17,18 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
load_helper epm-sh-altlinux
load_helper epm-query load_helper epm-query
load_helper epm-print load_helper epm-print
load_helper epm-sh-warmup
# Try remove with low level removing # Try remove with low level removing
epm_remove_low() epm_remove_low()
{ {
[ -z "$1" ] && return [ -z "$1" ] && return
warmup_lowbase
case $PMTYPE in case $PMTYPE in
apt-rpm|yum-rpm|zypper-rpm|urpm-rpm|dnf-rpm) apt-rpm|yum-rpm|zypper-rpm|urpm-rpm|dnf-rpm)
sudocmd rpm -ev $nodeps $@ sudocmd rpm -ev $nodeps $@
...@@ -55,6 +60,8 @@ epm_remove_names() ...@@ -55,6 +60,8 @@ epm_remove_names()
{ {
[ -z "$1" ] && return [ -z "$1" ] && return
warmup_bases
case $PMTYPE in case $PMTYPE in
apt-dpkg) apt-dpkg)
sudocmd apt-get remove --purge $@ sudocmd apt-get remove --purge $@
...@@ -145,6 +152,8 @@ epm_remove_names() ...@@ -145,6 +152,8 @@ epm_remove_names()
# TODO # TODO
epm_remove_nonint() epm_remove_nonint()
{ {
warmup_bases
case $PMTYPE in case $PMTYPE in
apt-dpkg) apt-dpkg)
sudocmd apt-get -y --force-yes remove --purge $@ sudocmd apt-get -y --force-yes remove --purge $@
...@@ -230,11 +239,31 @@ epm_remove() ...@@ -230,11 +239,31 @@ epm_remove()
return return
fi fi
local tn=$(tasknumber "$pkg_names")
if [ -n "$tn" ] ; then
assure_exists apt-repo
pkg_names=$(showcmd apt-repo list $tn)
#docmd epm remove $dryrun
return
fi
# get full package name(s) from the package file(s) # get full package name(s) from the package file(s)
[ -n "$pkg_files" ] && pkg_names="$pkg_names $(epm query $pkg_files)" [ -n "$pkg_files" ] && pkg_names="$pkg_names $(epm query $pkg_files)"
[ -n "$pkg_names" ] || fatal "Remove: missing package(s) name." [ -n "$pkg_names" ] || fatal "Remove: missing package(s) name."
if [ -n "$dryrun" ] ; then
info "Packages for removing:"
echo "$pkg_names"
return
fi
epm_remove_low $pkg_names && return epm_remove_low $pkg_names && return
local STATUS=$?
if [ -n "$direct" ] ; then
return $STATUS
fi
# get package name for hi level package management command (with version if supported and if possible) # get package name for hi level package management command (with version if supported and if possible)
pkg_names=$(__epm_get_hilevel_name $pkg_names) pkg_names=$(__epm_get_hilevel_name $pkg_names)
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2016 Etersoft # Copyright (C) 2016-2017 Etersoft
# Copyright (C) 2016 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2016-2017 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
...@@ -17,8 +17,13 @@ ...@@ -17,8 +17,13 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
load_helper epm-sh-warmup
epm_remove_old_kernels() epm_remove_old_kernels()
{ {
warmup_bases
case $DISTRNAME in case $DISTRNAME in
ALTLinux) ALTLinux)
load_helper epm-query_package load_helper epm-query_package
......
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
load_helper epm-sh-altlinux
epm_removerepo() epm_removerepo()
{ {
local repo="$(eval echo $quoted_args)" local repo="$(eval echo $quoted_args)"
...@@ -29,8 +31,31 @@ case $DISTRNAME in ...@@ -29,8 +31,31 @@ case $DISTRNAME in
[ -n "$DISTRVERSION" ] || fatal "Empty DISTRVERSION" [ -n "$DISTRVERSION" ] || fatal "Empty DISTRVERSION"
repo="$repo.$(echo "$DISTRVERSION" | tr "[:upper:]" "[:lower:]")" repo="$repo.$(echo "$DISTRVERSION" | tr "[:upper:]" "[:lower:]")"
;; ;;
archive)
info "remove archive repos"
assure_exists apt-repo
epm repolist | grep "archive/" | while read repo ; do
sudocmd apt-repo rm "$repo"
done
return 0
;;
tasks)
info "remove task repos"
assure_exists apt-repo
epm repolist | grep "/repo/" | while read repo ; do
sudocmd apt-repo rm "$repo"
done
return 0
;;
*)
if tasknumber "$repo" >/dev/null ; then
repo="$(epm repolist | grep "repo/$(tasknumber "$repo")" | line)"
# "
fi
;;
esac esac
[ -n "$repo" ] || fatal "No such repo or task. Use epm remove repo [autoimports|archive|TASK]"
assure_exists apt-repo assure_exists apt-repo
sudocmd apt-repo rm "$repo" sudocmd apt-repo rm "$repo"
return return
......
...@@ -61,6 +61,7 @@ __fix_apt_sources_list() ...@@ -61,6 +61,7 @@ __fix_apt_sources_list()
# Sisyphus uses 'alt' vendor key # Sisyphus uses 'alt' vendor key
__try_fix_apt_source_list $i alt "ALTLinux\/Sisyphus" __try_fix_apt_source_list $i alt "ALTLinux\/Sisyphus"
__try_fix_apt_source_list $i etersoft "Etersoft\/Sisyphus"
# skip branch replacement for ALT Linux Sisyphus # skip branch replacement for ALT Linux Sisyphus
[ "$DISTRVERSION" = "Sisyphus" ] && continue [ "$DISTRVERSION" = "Sisyphus" ] && continue
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012, 2013, 2016 Etersoft # Copyright (C) 2012, 2013, 2016-2017 Etersoft
# Copyright (C) 2012, 2013, 2016 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012, 2013, 2016-2017 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
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
# #
load_helper epm-check_updated_repo load_helper epm-check_updated_repo
load_helper epm-sh-warmup
__epm_search_output() __epm_search_output()
{ {
...@@ -176,6 +177,8 @@ epm_search() ...@@ -176,6 +177,8 @@ epm_search()
# it is useful for first time running # it is useful for first time running
update_repo_if_needed soft update_repo_if_needed soft
warmup_bases
# FIXME: do it better # FIXME: do it better
local MGS local MGS
MGS=$(eval __epm_search_make_grep $quoted_args) MGS=$(eval __epm_search_make_grep $quoted_args)
......
...@@ -115,3 +115,9 @@ get_local_alt_contents_index() ...@@ -115,3 +115,9 @@ get_local_alt_contents_index()
done done
} }
tasknumber()
{
local num="${*/\#/}"
isnumber "$num" && echo "$num"
}
...@@ -174,6 +174,12 @@ get_lastarg() ...@@ -174,6 +174,12 @@ get_lastarg()
echon "$lastarg" echon "$lastarg"
} }
# TODO: see etersoft-build-utils/tests/test_isnumber.sh
isnumber()
{
echo "$*" | filter_strip_spaces | grep -q "^[0-9]\+$"
}
filter_strip_spaces() filter_strip_spaces()
{ {
# possible use just # possible use just
......
#!/bin/sh
#
# Copyright (C) 2017 Etersoft
# Copyright (C) 2017 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/>.
#
is_warmup_allowed()
{
local MEM
MEM=$($DISTRVENDOR -m)
# disable warm if have no enough memory
[ $MEM -le 1024 ] && return 1
return 0
}
__warmup_files()
{
local D="$1"
shift
#showcmd "$*"
[ -n "$D" ] && info "Warming up $D ..."
# TODO: use progress, calc files size before
docmd cat $* >/dev/null 2>/dev/null
}
warmup_rpmbase()
{
is_warmup_allowed || return
__warmup_files "rpm" "/var/lib/rpm/*"
}
warmup_dpkgbase()
{
is_warmup_allowed || { warning "Skipping warmup bases due low memory size" ; return ; }
__warmup_files "dpkg" "/var/lib/dpkg/*"
}
warmup_lowbase()
{
case $PKGFORMAT in
"rpm")
warmup_rpmbase "$@"
;;
"dpkg")
warmup_dpkgbase "$@"
;;
*)
;;
esac
}
warmup_aptbase()
{
is_warmup_allowed || return
__warmup_files "apt" "/var/lib/apt/lists/* /var/cache/apt/*.bin"
}
warmup_hibase()
{
case $PMTYPE in
"apt-rpm"|"apt-dpkg")
warmup_aptbase "$@"
;;
*)
;;
esac
}
warmup_bases()
{
DISquiet=1 warmup_lowbase
DISquiet=1 warmup_hibase
}
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012, 2014, 2016 Etersoft # Copyright (C) 2012, 2014, 2016-2017 Etersoft
# Copyright (C) 2012, 2014, 2016 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012, 2014, 2016-2017 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
...@@ -19,11 +19,15 @@ ...@@ -19,11 +19,15 @@
# copied from korinf/tools/run-script/scripts/update # copied from korinf/tools/run-script/scripts/update
load_helper epm-sh-warmup
epm_update() epm_update()
{ {
[ -z "$pkg_filenames" ] || fatal "No arguments are allowed here" [ -z "$pkg_filenames" ] || fatal "No arguments are allowed here"
info "Running command for update remote package repository database" info "Running command for update remote package repository database"
warmup_hibase
case $PMTYPE in case $PMTYPE in
apt-rpm) apt-rpm)
sudocmd apt-get update || return sudocmd apt-get update || return
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
# #
load_helper epm-check_updated_repo load_helper epm-check_updated_repo
load_helper epm-sh-warmup
epm_upgrade() epm_upgrade()
{ {
...@@ -28,6 +29,7 @@ epm_upgrade() ...@@ -28,6 +29,7 @@ epm_upgrade()
# it is useful for first time running # it is useful for first time running
update_repo_if_needed update_repo_if_needed
warmup_bases
info "Running command for upgrade packages" info "Running command for upgrade packages"
case $PMTYPE in case $PMTYPE in
......
# This spec is backported to ALTLinux p8 automatically by rpmbph script from etersoft-build-utils. # This spec is backported to ALTLinux p8 automatically by rpmbph script from etersoft-build-utils.
# #
Name: eepm Name: eepm
Version: 2.1.3 Version: 2.1.7
Release: alt0.M80P.1 Release: alt0.M80P.1
Summary: Etersoft EPM package manager Summary: Etersoft EPM package manager
...@@ -68,9 +68,27 @@ chmod a+x %buildroot%_datadir/%name/tools_* ...@@ -68,9 +68,27 @@ chmod a+x %buildroot%_datadir/%name/tools_*
%_sysconfdir/bash_completion.d/cerv %_sysconfdir/bash_completion.d/cerv
%changelog %changelog
* Wed Oct 18 2017 Vitaly Lipatov <lav@altlinux.ru> 2.1.3-alt0.M80P.1 * Wed Oct 25 2017 Vitaly Lipatov <lav@altlinux.ru> 2.1.7-alt0.M80P.1
- backport to ALTLinux p8 (by rpmbph script) - backport to ALTLinux p8 (by rpmbph script)
* Mon Oct 23 2017 Vitaly Lipatov <lav@altlinux.ru> 2.1.7-alt1
- improve addrepo (add archive DATE support) and removerepo (archive, tasks)
* Sun Oct 22 2017 Vitaly Lipatov <lav@altlinux.ru> 2.1.6-alt1
- add support for ALT girar task number to install/remove, improve addrepo/removerepo
- distr_info: add support for get info about arch, bus size, memory size, base os name
- add warmup bases support and use it
* Wed Oct 18 2017 Vitaly Lipatov <lav@altlinux.ru> 2.1.5-alt1
- distr_info: add firstupper function, implement full /etc/os-release checking
- add --dry-run support to remove, autoorphans, autoremove
- autoremove: add support for autoremove [libs|python|perl|libs-devel]
* Mon Oct 16 2017 Vitaly Lipatov <lav@altlinux.ru> 2.1.4-alt1
- add skip # in task number
- add support for just task number in removerepo
- repofix: add sign for Etersoft Sisyphus
* Thu Sep 14 2017 Vitaly Lipatov <lav@altlinux.ru> 2.1.3-alt1 * Thu Sep 14 2017 Vitaly Lipatov <lav@altlinux.ru> 2.1.3-alt1
- use force package selection only in non interactive install - use force package selection only in non interactive install
- kernel_update: add update repo if needed - kernel_update: add update repo if needed
......
NAME="Manjaro Linux"
ID=manjaro
PRETTY_NAME="Manjaro Linux"
ANSI_COLOR="1;32"
HOME_URL="https://www.manjaro.org/"
SUPPORT_URL="https://www.manjaro.org/"
BUG_REPORT_URL="https://bugs.manjaro.org/"
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