Commit d64573ba authored by Vitaly Lipatov's avatar Vitaly Lipatov

backported to M60P as 1.2.4-alt0.M60P.1 (with rpmbph script)

parents a7bd6270 ec70fd08
2. Дописать таблицу на вики на основании реализованных команд.
3. Доделать и проверить deplist|requires
eix мне кажеться для поиска немного удобной, без параметров выведет все что есть в "портежах"
eix -I - список всех установленных (-Ic сокращенный список)
eix phrase - выведет список всего что содержит phrase (-c кратко)
eix-sync - обновление "портежей"
к сожалению и ставить с emerge. хотя может можно дать и eix команду, но не смотрел, вроде
только для поиска (просто удобнее, мне по-крайне мере).
ну в man'e понятное дело много чего %)
в любом случае связка eix-sync, emerge -uDN system world, etc-update/dispatch-conf,
revdep-rebuild хорошо работает если не нужно mask/unmask делать %)
https://wiki.archlinux.org/index.php/Pacman_Rosetta
......@@ -128,7 +128,7 @@ check_command()
-i|install|add) # HELPCMD: install package(s) from remote repositories or from local file
epm_cmd=install
;;
-e|-P|remove|delete) # HELPCMD: remove (delete) package(s) from the database and the system
-e|-P|remove|delete|uninstall) # HELPCMD: remove (delete) package(s) from the database and the system
epm_cmd=remove
;;
-s|search) # HELPCMD: search in remote package repositories
......@@ -166,6 +166,12 @@ check_command()
requires|deplist) # HELPCMD: print package requires
epm_cmd=requires
;;
provides) # HELPCMD: print package provides
epm_cmd=provides
;;
whatdepends) # HELPCMD: print packages dependences on that
epm_cmd=whatdepends
;;
-qa|list|packages|-l) # HELPCMD: list of installed package(s)
epm_cmd=packages
;;
......
......@@ -44,7 +44,7 @@ case $PMTYPE in
#sudocmd repo-add $pkg_filenames
;;
npackd)
docmd npackdcl add-repo --url=$pkg_filenames
sudocmd npackdcl add-repo --url=$pkg_filenames
;;
slackpkg)
echo "You need manually add repo to /etc/slackpkg/mirrors"
......
......@@ -29,12 +29,31 @@ case $PMTYPE in
aura)
sudocmd aura -Oj
;;
#yum-rpm)
# sudocmd yum clean all
# ;;
#urpm-rpm)
# sudocmd urpmi --clean
# ;;
yum-rpm)
# cleanup orphanes?
while true ; do
docmd package-cleanup --leaves
# FIXME: package-cleanup have to use stderr for errors
local PKGLIST=$(package-cleanup --leaves | grep -v "Loaded plugins" | grep -v "Unable to")
[ -n "$PKGLIST" ] || break
sudocmd yum remove $PKGLIST
done
;;
urpm-rpm)
sudocmd urpme --auto-orphans
;;
emerge)
sudocmd emerge --depclean
docmd epm --skip-installed install gentoolkit
sudocmd revdep-rebuild
;;
pacman)
sudocmd pacman -Qdtq | pacman -Rs -
;;
slackpkg)
# clean-system removes non official packages
#sudocmd slackpkg clean-system
;;
#zypper-rpm)
# sudocmd zypper clean
# ;;
......
......@@ -38,22 +38,13 @@ case $PMTYPE in
#docmd package-cleanup --dupes
sudocmd package-cleanup --cleandupes
# cleanup orphanes?
while true ; do
docmd package-cleanup --leaves
# FIXME: package-cleanup have to use stderr for errors
local PKGLIST=$(package-cleanup --leaves | grep -v "Loaded plugins" | grep -v "Unable to")
[ -n "$PKGLIST" ] || break
sudocmd yum remove $PKGLIST
done
docmd rpm -Va --nofiles --nodigest
;;
pacman)
emerge)
sudocmd revdep-rebuild
;;
urpm-rpm)
sudocmd urpme --auto-orphans
#sudocmd urpme --auto-orphans
;;
zypper-rpm)
sudocmd zypper verify || exit
......
......@@ -25,7 +25,7 @@ case $PMTYPE in
;;
yum-rpm)
sudocmd yum clean all
sudocmd yum makecache
#sudocmd yum makecache
;;
dnf-rpm)
sudocmd dnf clean all
......@@ -39,9 +39,15 @@ case $PMTYPE in
zypper-rpm)
sudocmd zypper clean
;;
nix)
sudocmd nix-collect-garbage
;;
slackpkg)
;;
*)
fatal "Do not known command for $PMTYPE"
;;
esac
echo "It is recommend to run 'epm autoremove' also"
}
......@@ -41,6 +41,72 @@ filter_out_installed_packages()
esac | sed -e "s|rpm-build-altlinux-compat[^ ]*||g" | filter_strip_spaces
}
# http://ru.gentoo-wiki.com/wiki/Portage_Overlay
# http://kb.etersoft.ru/Gentoo:_Установка_продуктов_Etersoft
# http://linuxreviews.org/gentoo/ebuilds/
#
# install one ebuild
__emerge_install_ebuild()
{
local EBUILD="$1"
[ -s "$EBUILD" ] || fatal ".ebuild file '$EBUILD' is missing"
# load ebuild and get vars
. $EBUILD
[ -n "$SRC_URI" ] || fatal "Can't load SRC_URI from $EBUILD"
# try to detect tarballs
local TARBALLS=
local BASEDIR=$(dirname $EBUILD)
for i in $SRC_URI ; do
[ -s "$BASEDIR/$(basename $i)" ] || continue
TARBALLS="$TARBALLS $BASEDIR/$(basename $i)"
done
local PORTAGENAME=epm
local LP=/usr/local/portage/$PORTAGENAME
sudocmd mkdir -p $LP/
if ! grep -v "^#" /etc/make.conf | grep -q $LP ; then
sudocmd echo 'PORTDIR_OVERLAY="$LP \${PORTDIR_OVERLAY}"' >>/etc/make.conf
# Overlay name
sudocmd mkdir -p $LP/profiles/
sudocmd echo "$PORTAGENAME" > $LP/profiles/repo_name
fi
# copy tarballs
local DDIR=/usr/portage/distfiles
[ -d /var/calculate/remote/distfiles ] && DDIR=/var/calculate/remote/distfiles
sudocmd cp -f $TARBALLS $DDIR/ || return
# copy ebuild
sudocmd cp -f $EBUILD $LP/ || return
cd $LP
sudocmd ebuild $(basename $EBUILD) digest
cd -
# FIXME: more correcty get name
local PKGNAME=$(echo $EBUILD | sed -e "s|-[0-9].*||g")
sudocmd emerge -av $PKGNAME || return
}
# install ebuild list
__emerge_install()
{
local EBUILD=
#local TARBALLS=
local i
# search ebuild in the args
for i in $* ; do
if echo $i | grep -q ebuild ; then
[ -s "$EBUILD" ] || fatal "Can't find .ebuild file in $*"
__emerge_install_ebuild $i
continue
# else
# TARBALLS="$TARBALLS $i"
fi
done
}
# copied from etersoft-build-utils/share/eterbuild/functions/rpmpkg
epm_install_names()
......@@ -85,6 +151,13 @@ epm_install_names()
mpkg)
sudocmd mpkg install $@
return ;;
npackd)
separate_installed $@
# FIXME: fix return status
# TODO: use upgrade if package is already installed
[ -n "$pkg_noninstalled" ] && sudocmd npackdcl add --package=$@ $pkg_noninstalled
[ -n "$pkg_installed" ] && sudocmd npackdcl update --package=$@ $pkg_installed
return ;;
slackpkg)
separate_installed $@
# TODO: use upgrade if package is already installed
......@@ -100,6 +173,11 @@ epm_install_names()
[ -n "$force" ] && force=-force-depends
sudocmd ipkg $force install $@
return ;;
nix)
separate_installed $@
[ -n "$pkg_noninstalled" ] && sudocmd nix-env --install $pkg_noninstalled
[ -n "$pkg_installed" ] && sudocmd nix-env --upgrade $pkg_installed
return ;;
*)
fatal "Do not known install command for $PMTYPE"
;;
......@@ -127,6 +205,9 @@ epm_ni_install_names()
pkgsrc)
sudocmd pkg_add -r $@
return ;;
emerge)
sudocmd emerge -uD $@
return ;;
pacman)
sudocmd pacman -S --noconfirm $force $nodeps $@
return ;;
......@@ -135,7 +216,7 @@ epm_ni_install_names()
return ;;
npackd)
# npackdcl update --package=<package> (remove old and install new)
docmd npackdcl add --package=$@
sudocmd npackdcl add --package=$@
return ;;
chocolatey)
docmd chocolatey install $@
......@@ -143,9 +224,14 @@ epm_ni_install_names()
ipkg)
sudocmd ipkg -force-defaults install $@
return ;;
nix)
sudocmd nix-env --install $@
return ;;
slackpkg)
# TODO: use upgrade if package is already installed
sudocmd /usr/sbin/slackpkg -batch=on -default_answer=yes install $@
separate_installed $@
# FIXME: broken status when use batch and default answrt
[ -n "$pkg_noninstalled" ] && sudocmd /usr/sbin/slackpkg -batch=on -default_answer=yes install $pkg_noninstalled
[ -n "$pkg_installed" ] && sudocmd /usr/sbin/slackpkg -batch=on -default_answer=yes upgrade $pkg_installed
return ;;
*)
fatal "Do not known appropriate install command for $PMTYPE"
......@@ -207,6 +293,9 @@ epm_install_files()
pkgsrc)
sudocmd pkg_add $@
return ;;
emerge)
__emerge_install $@
return ;;
pacman)
sudocmd pacman -U --noconfirm $force $nodeps $@ && return
[ -n "$nodeps" ] && return
......@@ -233,6 +322,10 @@ epm_print_install_command()
pkgsrc)
echo "pkg_add $@"
;;
#emerge)
# # it is better to use epm
# echo "tar xvfj $@ -C /"
# ;;
pacman)
echo "pacman -U --noconfirm --force $nodeps $@"
;;
......@@ -259,7 +352,7 @@ epm_install()
return
fi
[ -n "$pkg_files$pkg_names" ] || fatal "Run install without packages"
[ -n "$pkg_files$pkg_names" ] || { echo "Skip empty install list" ; return 22 ; }
local names="$(echo $pkg_names | filter_out_installed_packages)"
local files="$(echo $pkg_files | filter_out_installed_packages)"
......
......@@ -49,13 +49,18 @@ case $PMTYPE in
fi
;;
npackd)
CMD="npackdcl list"
CMD="npackdcl list --status=installed"
# TODO: use search if pkg_filenames is not empty
;;
# chocolatey)
# CMD="chocolatey list"
# ;;
slackpkg)
CMD="ls -1 /var/log/packages/"
if [ -n "$short" ] ; then
docmd ls -1 /var/log/packages/ | sed -e "s|-[0-9].*||g"
return
fi
;;
homebrew)
CMD="brew $pkg_filenames"
......
#!/bin/sh
#
# Copyright (C) 2013 Etersoft
# Copyright (C) 2013 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/>.
#
epm_provides()
{
local CMD
[ -n "$pkg_filenames" ] || fatal "Run query without names"
# by package file
case $PMTYPE in
*-rpm)
CMD="rpm -q --provides -p"
;;
# apt-dpkg)
# showcmd dpkg -s $pkg_files
# a= dpkg -s $pkg_names | grep "^Depends:" | sed "s|^Depends:||g"
# return
# ;;
*)
fatal "Do not known command for $PMTYPE"
;;
esac
[ -n "$pkg_files" ] && docmd $CMD $pkg_files
# by package name
case $PMTYPE in
apt-rpm)
if is_installed $pkg_names ; then
CMD="rpm -q --provides"
else
CMD="apt-cache depends"
fi
;;
urpm-rpm|zypper-rpm)
if is_installed $pkg_names ; then
CMD="rpm -q --provides"
else
# FIXME: use hi level commands
fi
;;
emerge)
CMD="equery files"
;;
# yum-rpm)
# CMD="yum deplist"
# ;;
# apt-dpkg)
# CMD="apt-cache depends"
# ;;
*)
fatal "Do not known command for $PMTYPE"
;;
esac
[ -n "$pkg_names" ] && docmd $CMD $pkg_names
}
......@@ -70,11 +70,12 @@ __epm_query_name()
CMD="rpm -q"
;;
apt-dpkg)
CMD="dpkg -l"
#docmd dpkg -l $@
docmd dpkg -l $@ | grep "^ii"
# TODO: make rpm-like output
#showcmd dpkg -l $pkg_filenames
#dpkg -l $pkg_filenames | grep "^ii"
#return
return
;;
npackd)
CMD="npackdcl path --package=$@"
......@@ -96,7 +97,7 @@ __epm_query_name()
is_installed()
{
#pkg_filenames="$@" epm_query >/dev/null
epm installed $@ >/dev/null
epm installed $@ >/dev/null 2>/dev/null
}
# fill pkg_installed and pkg_noninstalled
......
......@@ -82,10 +82,13 @@ epm_remove_names()
sudocmd mpkg remove $@
return ;;
npackd)
docmd npackdcl remove --package=$@
sudocmd npackdcl remove --package=$@
return ;;
nix)
sudocmd nix-env --uninstall $@
return ;;
chocolatey)
docmd chocolatey uninstall $@
sudocmd chocolatey uninstall $@
return ;;
slackpkg)
sudocmd /usr/sbin/slackpkg remove $@
......
......@@ -42,7 +42,7 @@ case $PMTYPE in
echo "You need remove repo from /etc/pacman.conf"
;;
npackd)
docmd npackdcl remove-repo --url=$pkg_filenames
sudocmd npackdcl remove-repo --url=$pkg_filenames
;;
slackpkg)
echo "You need remove repo from /etc/slackpkg/mirrors"
......
......@@ -56,7 +56,8 @@ case $PMTYPE in
CMD="mpkg search"
;;
npackd)
fatal "FIXME: Have not idea for search with npackdcl list"
docmd npackdcl search --query="$pkg_filenames" --status=all
return
;;
chocolatey)
CMD="chocolatey list"
......
......@@ -67,8 +67,14 @@ _epm_do_simulate()
CMD="zypper --non-interactive install"
;;
emerge)
echo "FIXME: Skip with emerge"
return ;;
local res=0
for pkg in $filenames ; do
is_installed $pkg && continue
docmd emerge --pretend $pkg && continue
pkg=1
break
done
return $res ;;
pacman)
showcmd $SUDO pacman -v -S $filenames
echo no | $SUDO pacman -v -S $filenames
......
......@@ -57,6 +57,9 @@ case $PMTYPE in
deepsolver-rpm)
sudocmd ds-update
;;
npackd)
sudocmd packdcl detect # get packages from MSI database
;;
homebrew)
sudocmd brew update
;;
......
......@@ -28,6 +28,7 @@ epm_upgrade()
CMD="apt-get dist-upgrade"
;;
yum-rpm)
# can do update repobase automagically
CMD="yum update"
;;
dnf-rpm)
......@@ -41,7 +42,7 @@ epm_upgrade()
CMD="zypper dist-upgrade"
;;
pacman)
CMD="pacman -S -u"
CMD="pacman -S -u $force"
;;
aura)
CMD="aura -A -u"
......
#!/bin/sh
#
# Copyright (C) 2013 Etersoft
# Copyright (C) 2013 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/>.
#
epm_whatdepends()
{
local CMD
[ -n "$pkg_names" ] || fatal "Run query without names"
# by package name
case $PMTYPE in
apt-rpm|apt-dpkg)
CMD="apt-cache whatdepends"
;;
yum-rpm)
CMD="repoquery --whatrequires"
;;
emerge)
CMD="equery depends -a"
;;
*)
fatal "Do not known command for $PMTYPE"
;;
esac
[ -n "$pkg_names" ] && docmd $CMD $pkg_names
}
# This spec is backported to ALTLinux p6 automatically by rpmbph script. Do not edit it.
#
Name: eepm
Version: 1.2.3
Version: 1.2.4
Release: alt0.M60P.1
Summary: Etersoft EPM package manager
......@@ -59,9 +59,16 @@ install -m 0644 bash_completion/serv %buildroot%_sysconfdir/bash_completion.d/se
%_sysconfdir/bash_completion.d/serv
%changelog
* Mon Mar 04 2013 Vitaly Lipatov <lav@altlinux.ru> 1.2.3-alt0.M60P.1
* Mon Mar 04 2013 Vitaly Lipatov <lav@altlinux.ru> 1.2.4-alt0.M60P.1
- backport to ALTLinux p6 (by rpmbph script)
* Mon Mar 04 2013 Vitaly Lipatov <lav@altlinux.ru> 1.2.4-alt1
- epm-install: add support for direct install ebuild
- realize epm simulate for emerge
- fix autoremove, check, clean, etc.
- many fixes for npackd
- add epm whatdepends, provides commands
* Fri Feb 22 2013 Vitaly Lipatov <lav@altlinux.ru> 1.2.3-alt1
- add initial aura support
- epm-install: fix skip-installed for old Debian
......
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