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. Дописать таблицу на вики на основании реализованных команд. 2. Дописать таблицу на вики на основании реализованных команд.
3. Доделать и проверить deplist|requires 3. Доделать и проверить deplist|requires
https://wiki.archlinux.org/index.php/Pacman_Rosetta
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 делать %)
...@@ -128,7 +128,7 @@ check_command() ...@@ -128,7 +128,7 @@ check_command()
-i|install|add) # HELPCMD: install package(s) from remote repositories or from local file -i|install|add) # HELPCMD: install package(s) from remote repositories or from local file
epm_cmd=install 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 epm_cmd=remove
;; ;;
-s|search) # HELPCMD: search in remote package repositories -s|search) # HELPCMD: search in remote package repositories
...@@ -166,6 +166,12 @@ check_command() ...@@ -166,6 +166,12 @@ check_command()
requires|deplist) # HELPCMD: print package requires requires|deplist) # HELPCMD: print package requires
epm_cmd=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) -qa|list|packages|-l) # HELPCMD: list of installed package(s)
epm_cmd=packages epm_cmd=packages
;; ;;
......
...@@ -44,7 +44,7 @@ case $PMTYPE in ...@@ -44,7 +44,7 @@ case $PMTYPE in
#sudocmd repo-add $pkg_filenames #sudocmd repo-add $pkg_filenames
;; ;;
npackd) npackd)
docmd npackdcl add-repo --url=$pkg_filenames sudocmd npackdcl add-repo --url=$pkg_filenames
;; ;;
slackpkg) slackpkg)
echo "You need manually add repo to /etc/slackpkg/mirrors" echo "You need manually add repo to /etc/slackpkg/mirrors"
......
...@@ -29,12 +29,31 @@ case $PMTYPE in ...@@ -29,12 +29,31 @@ case $PMTYPE in
aura) aura)
sudocmd aura -Oj sudocmd aura -Oj
;; ;;
#yum-rpm) yum-rpm)
# sudocmd yum clean all # cleanup orphanes?
# ;; while true ; do
#urpm-rpm) docmd package-cleanup --leaves
# sudocmd urpmi --clean # 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) #zypper-rpm)
# sudocmd zypper clean # sudocmd zypper clean
# ;; # ;;
......
...@@ -38,22 +38,13 @@ case $PMTYPE in ...@@ -38,22 +38,13 @@ case $PMTYPE in
#docmd package-cleanup --dupes #docmd package-cleanup --dupes
sudocmd package-cleanup --cleandupes 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 docmd rpm -Va --nofiles --nodigest
;; ;;
pacman) emerge)
sudocmd revdep-rebuild sudocmd revdep-rebuild
;; ;;
urpm-rpm) urpm-rpm)
sudocmd urpme --auto-orphans #sudocmd urpme --auto-orphans
;; ;;
zypper-rpm) zypper-rpm)
sudocmd zypper verify || exit sudocmd zypper verify || exit
......
...@@ -25,7 +25,7 @@ case $PMTYPE in ...@@ -25,7 +25,7 @@ case $PMTYPE in
;; ;;
yum-rpm) yum-rpm)
sudocmd yum clean all sudocmd yum clean all
sudocmd yum makecache #sudocmd yum makecache
;; ;;
dnf-rpm) dnf-rpm)
sudocmd dnf clean all sudocmd dnf clean all
...@@ -39,9 +39,15 @@ case $PMTYPE in ...@@ -39,9 +39,15 @@ case $PMTYPE in
zypper-rpm) zypper-rpm)
sudocmd zypper clean sudocmd zypper clean
;; ;;
nix)
sudocmd nix-collect-garbage
;;
slackpkg)
;;
*) *)
fatal "Do not known command for $PMTYPE" fatal "Do not known command for $PMTYPE"
;; ;;
esac esac
echo "It is recommend to run 'epm autoremove' also"
} }
...@@ -41,6 +41,72 @@ filter_out_installed_packages() ...@@ -41,6 +41,72 @@ filter_out_installed_packages()
esac | sed -e "s|rpm-build-altlinux-compat[^ ]*||g" | filter_strip_spaces 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 # copied from etersoft-build-utils/share/eterbuild/functions/rpmpkg
epm_install_names() epm_install_names()
...@@ -85,6 +151,13 @@ epm_install_names() ...@@ -85,6 +151,13 @@ epm_install_names()
mpkg) mpkg)
sudocmd mpkg install $@ sudocmd mpkg install $@
return ;; 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) slackpkg)
separate_installed $@ separate_installed $@
# TODO: use upgrade if package is already installed # TODO: use upgrade if package is already installed
...@@ -100,6 +173,11 @@ epm_install_names() ...@@ -100,6 +173,11 @@ epm_install_names()
[ -n "$force" ] && force=-force-depends [ -n "$force" ] && force=-force-depends
sudocmd ipkg $force install $@ sudocmd ipkg $force install $@
return ;; 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" fatal "Do not known install command for $PMTYPE"
;; ;;
...@@ -127,6 +205,9 @@ epm_ni_install_names() ...@@ -127,6 +205,9 @@ epm_ni_install_names()
pkgsrc) pkgsrc)
sudocmd pkg_add -r $@ sudocmd pkg_add -r $@
return ;; return ;;
emerge)
sudocmd emerge -uD $@
return ;;
pacman) pacman)
sudocmd pacman -S --noconfirm $force $nodeps $@ sudocmd pacman -S --noconfirm $force $nodeps $@
return ;; return ;;
...@@ -135,7 +216,7 @@ epm_ni_install_names() ...@@ -135,7 +216,7 @@ epm_ni_install_names()
return ;; return ;;
npackd) npackd)
# npackdcl update --package=<package> (remove old and install new) # npackdcl update --package=<package> (remove old and install new)
docmd npackdcl add --package=$@ sudocmd npackdcl add --package=$@
return ;; return ;;
chocolatey) chocolatey)
docmd chocolatey install $@ docmd chocolatey install $@
...@@ -143,9 +224,14 @@ epm_ni_install_names() ...@@ -143,9 +224,14 @@ epm_ni_install_names()
ipkg) ipkg)
sudocmd ipkg -force-defaults install $@ sudocmd ipkg -force-defaults install $@
return ;; return ;;
nix)
sudocmd nix-env --install $@
return ;;
slackpkg) slackpkg)
# TODO: use upgrade if package is already installed separate_installed $@
sudocmd /usr/sbin/slackpkg -batch=on -default_answer=yes install $@ # 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 ;; return ;;
*) *)
fatal "Do not known appropriate install command for $PMTYPE" fatal "Do not known appropriate install command for $PMTYPE"
...@@ -207,6 +293,9 @@ epm_install_files() ...@@ -207,6 +293,9 @@ epm_install_files()
pkgsrc) pkgsrc)
sudocmd pkg_add $@ sudocmd pkg_add $@
return ;; return ;;
emerge)
__emerge_install $@
return ;;
pacman) pacman)
sudocmd pacman -U --noconfirm $force $nodeps $@ && return sudocmd pacman -U --noconfirm $force $nodeps $@ && return
[ -n "$nodeps" ] && return [ -n "$nodeps" ] && return
...@@ -233,6 +322,10 @@ epm_print_install_command() ...@@ -233,6 +322,10 @@ epm_print_install_command()
pkgsrc) pkgsrc)
echo "pkg_add $@" echo "pkg_add $@"
;; ;;
#emerge)
# # it is better to use epm
# echo "tar xvfj $@ -C /"
# ;;
pacman) pacman)
echo "pacman -U --noconfirm --force $nodeps $@" echo "pacman -U --noconfirm --force $nodeps $@"
;; ;;
...@@ -259,7 +352,7 @@ epm_install() ...@@ -259,7 +352,7 @@ epm_install()
return return
fi 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 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)"
......
...@@ -49,13 +49,18 @@ case $PMTYPE in ...@@ -49,13 +49,18 @@ case $PMTYPE in
fi fi
;; ;;
npackd) npackd)
CMD="npackdcl list" CMD="npackdcl list --status=installed"
# TODO: use search if pkg_filenames is not empty
;; ;;
# chocolatey) # chocolatey)
# CMD="chocolatey list" # CMD="chocolatey list"
# ;; # ;;
slackpkg) slackpkg)
CMD="ls -1 /var/log/packages/" 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) homebrew)
CMD="brew $pkg_filenames" 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() ...@@ -70,11 +70,12 @@ __epm_query_name()
CMD="rpm -q" CMD="rpm -q"
;; ;;
apt-dpkg) apt-dpkg)
CMD="dpkg -l" #docmd dpkg -l $@
docmd dpkg -l $@ | grep "^ii"
# TODO: make rpm-like output # TODO: make rpm-like output
#showcmd dpkg -l $pkg_filenames #showcmd dpkg -l $pkg_filenames
#dpkg -l $pkg_filenames | grep "^ii" #dpkg -l $pkg_filenames | grep "^ii"
#return return
;; ;;
npackd) npackd)
CMD="npackdcl path --package=$@" CMD="npackdcl path --package=$@"
...@@ -96,7 +97,7 @@ __epm_query_name() ...@@ -96,7 +97,7 @@ __epm_query_name()
is_installed() is_installed()
{ {
#pkg_filenames="$@" epm_query >/dev/null #pkg_filenames="$@" epm_query >/dev/null
epm installed $@ >/dev/null epm installed $@ >/dev/null 2>/dev/null
} }
# fill pkg_installed and pkg_noninstalled # fill pkg_installed and pkg_noninstalled
......
...@@ -82,10 +82,13 @@ epm_remove_names() ...@@ -82,10 +82,13 @@ epm_remove_names()
sudocmd mpkg remove $@ sudocmd mpkg remove $@
return ;; return ;;
npackd) npackd)
docmd npackdcl remove --package=$@ sudocmd npackdcl remove --package=$@
return ;;
nix)
sudocmd nix-env --uninstall $@
return ;; return ;;
chocolatey) chocolatey)
docmd chocolatey uninstall $@ sudocmd chocolatey uninstall $@
return ;; return ;;
slackpkg) slackpkg)
sudocmd /usr/sbin/slackpkg remove $@ sudocmd /usr/sbin/slackpkg remove $@
......
...@@ -42,7 +42,7 @@ case $PMTYPE in ...@@ -42,7 +42,7 @@ case $PMTYPE in
echo "You need remove repo from /etc/pacman.conf" echo "You need remove repo from /etc/pacman.conf"
;; ;;
npackd) npackd)
docmd npackdcl remove-repo --url=$pkg_filenames sudocmd npackdcl remove-repo --url=$pkg_filenames
;; ;;
slackpkg) slackpkg)
echo "You need remove repo from /etc/slackpkg/mirrors" echo "You need remove repo from /etc/slackpkg/mirrors"
......
...@@ -56,7 +56,8 @@ case $PMTYPE in ...@@ -56,7 +56,8 @@ case $PMTYPE in
CMD="mpkg search" CMD="mpkg search"
;; ;;
npackd) npackd)
fatal "FIXME: Have not idea for search with npackdcl list" docmd npackdcl search --query="$pkg_filenames" --status=all
return
;; ;;
chocolatey) chocolatey)
CMD="chocolatey list" CMD="chocolatey list"
......
...@@ -67,8 +67,14 @@ _epm_do_simulate() ...@@ -67,8 +67,14 @@ _epm_do_simulate()
CMD="zypper --non-interactive install" CMD="zypper --non-interactive install"
;; ;;
emerge) emerge)
echo "FIXME: Skip with emerge" local res=0
return ;; for pkg in $filenames ; do
is_installed $pkg && continue
docmd emerge --pretend $pkg && continue
pkg=1
break
done
return $res ;;
pacman) pacman)
showcmd $SUDO pacman -v -S $filenames showcmd $SUDO pacman -v -S $filenames
echo no | $SUDO pacman -v -S $filenames echo no | $SUDO pacman -v -S $filenames
......
...@@ -57,6 +57,9 @@ case $PMTYPE in ...@@ -57,6 +57,9 @@ case $PMTYPE in
deepsolver-rpm) deepsolver-rpm)
sudocmd ds-update sudocmd ds-update
;; ;;
npackd)
sudocmd packdcl detect # get packages from MSI database
;;
homebrew) homebrew)
sudocmd brew update sudocmd brew update
;; ;;
......
...@@ -28,6 +28,7 @@ epm_upgrade() ...@@ -28,6 +28,7 @@ epm_upgrade()
CMD="apt-get dist-upgrade" CMD="apt-get dist-upgrade"
;; ;;
yum-rpm) yum-rpm)
# can do update repobase automagically
CMD="yum update" CMD="yum update"
;; ;;
dnf-rpm) dnf-rpm)
...@@ -41,7 +42,7 @@ epm_upgrade() ...@@ -41,7 +42,7 @@ epm_upgrade()
CMD="zypper dist-upgrade" CMD="zypper dist-upgrade"
;; ;;
pacman) pacman)
CMD="pacman -S -u" CMD="pacman -S -u $force"
;; ;;
aura) aura)
CMD="aura -A -u" 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. # This spec is backported to ALTLinux p6 automatically by rpmbph script. Do not edit it.
# #
Name: eepm Name: eepm
Version: 1.2.3 Version: 1.2.4
Release: alt0.M60P.1 Release: alt0.M60P.1
Summary: Etersoft EPM package manager Summary: Etersoft EPM package manager
...@@ -59,9 +59,16 @@ install -m 0644 bash_completion/serv %buildroot%_sysconfdir/bash_completion.d/se ...@@ -59,9 +59,16 @@ install -m 0644 bash_completion/serv %buildroot%_sysconfdir/bash_completion.d/se
%_sysconfdir/bash_completion.d/serv %_sysconfdir/bash_completion.d/serv
%changelog %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) - 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 * Fri Feb 22 2013 Vitaly Lipatov <lav@altlinux.ru> 1.2.3-alt1
- add initial aura support - add initial aura support
- epm-install: fix skip-installed for old Debian - 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