Commit 16c07df1 authored by Vitaly Lipatov's avatar Vitaly Lipatov

backported to M60T as 1.0.2-alt0.M60T.1 (with rpmbph script)

parents 307af931 b5331dd1
1. Разобраться с поиском по локальным пакетам 2. Дописать таблицу на вики на основании реализованных команд.
2. Дописать таблицу на вики и по ней справку 3. Доделать и проверить deplist|requires
4. Проверить, что в общем всё работает
6. rpmqf, если не найдёт в локальной базе, могла бы искать в глобальной (search_file)
7. Дописать начатый reinstall (повторную установку), с --force при установке пакета
Отказаться от distr_vendor в rpm-build-altlinux-compat и использовать distr_info отсюда.
Replace rpmU with epmi
Возможность вывода/возврата команды, планируемой к выполнению
(префикс $OUTPUT перед всеми командами?)
test requies делать перед сборкой! :)
...@@ -22,7 +22,7 @@ distro() ...@@ -22,7 +22,7 @@ distro()
has() has()
{ {
[ -n "$DISTROFILE" ] || exit 1 [ -n "$DISTROFILE" ] || exit 1
grep "$1" "$DISTROFILE" >/dev/null 2>&1 grep "$*" "$DISTROFILE" >/dev/null 2>&1
} }
# Translate DISTRIB_ID to vendor name (like %_vendor does) # Translate DISTRIB_ID to vendor name (like %_vendor does)
...@@ -93,7 +93,6 @@ if distro altlinux-release ; then ...@@ -93,7 +93,6 @@ if distro altlinux-release ; then
elif has "ALT Linux 4.1" ; then DISTRIB_RELEASE="4.1" elif has "ALT Linux 4.1" ; then DISTRIB_RELEASE="4.1"
elif has Walnut ; then DISTRIB_RELEASE="4.0" elif has Walnut ; then DISTRIB_RELEASE="4.0"
elif has 5.0 ; then DISTRIB_RELEASE="5.0" elif has 5.0 ; then DISTRIB_RELEASE="5.0"
elif has Desktop ; then DISTRIB_RELEASE="4.0"
elif has 5.1 ; then DISTRIB_RELEASE="5.1" elif has 5.1 ; then DISTRIB_RELEASE="5.1"
elif has Ziziphora ; then DISTRIB_RELEASE="5.1" elif has Ziziphora ; then DISTRIB_RELEASE="5.1"
elif has "ALT Linux p5" ; then DISTRIB_RELEASE="p5" elif has "ALT Linux p5" ; then DISTRIB_RELEASE="p5"
......
...@@ -62,6 +62,7 @@ set_pm_type ...@@ -62,6 +62,7 @@ set_pm_type
verbose= verbose=
quiet= quiet=
nodeps= nodeps=
force=
non_interactive= non_interactive=
skip_installed= skip_installed=
show_command_only= show_command_only=
...@@ -114,6 +115,9 @@ check_command() ...@@ -114,6 +115,9 @@ check_command()
-qi|info|show) # HELPCMD: print package detail info -qi|info|show) # HELPCMD: print package detail info
epm_cmd=info epm_cmd=info
;; ;;
requires|deplist) # HELPCMD: print package requires
epm_cmd=requires
;;
clean) # HELPCMD: clean local package cache clean) # HELPCMD: clean local package cache
epm_cmd=clean epm_cmd=clean
;; ;;
...@@ -138,7 +142,7 @@ check_command() ...@@ -138,7 +142,7 @@ check_command()
-qf|which|belongs) # HELPCMD: query package(s) owning file -qf|which|belongs) # HELPCMD: query package(s) owning file
epm_cmd=query_file epm_cmd=query_file
;; ;;
filesearch) # HELPCMD: search in which package a file is included -sf|filesearch|search_file) # HELPCMD: search in which package a file is included
epm_cmd=search_file epm_cmd=search_file
;; ;;
-ql|filelist) # HELPCMD: print package file list -ql|filelist) # HELPCMD: print package file list
...@@ -156,7 +160,7 @@ check_command() ...@@ -156,7 +160,7 @@ check_command()
addrepo|ar) # HELPCMD: add package repo addrepo|ar) # HELPCMD: add package repo
epm_cmd=addrepo epm_cmd=addrepo
;; ;;
repolist|sl) # HELPCMD: print repo list repolist|sl|listrepo) # HELPCMD: print repo list
epm_cmd=repolist epm_cmd=repolist
;; ;;
removerepo|rr) # HELPCMD: remove package repo removerepo|rr) # HELPCMD: remove package repo
...@@ -172,10 +176,12 @@ for opt in "$@" ; do ...@@ -172,10 +176,12 @@ for opt in "$@" ; do
check_command $opt && continue check_command $opt && continue
case $opt in case $opt in
-h|--help|help) # HELPOPT: this help -h|--help|help) # HELPOPT: this help
phelp; exit 0 phelp
exit 0
;; ;;
-v|--version) # HELPOPT: print version -v|--version) # HELPOPT: print version
print_version; exit 0 print_version
exit 0
;; ;;
--verbose) # HELPOPT: verbose mode --verbose) # HELPOPT: verbose mode
verbose=1 verbose=1
...@@ -192,6 +198,9 @@ for opt in "$@" ; do ...@@ -192,6 +198,9 @@ for opt in "$@" ; do
--nodeps) # HELPOPT: skip dependency check (during install/simulate and so on) --nodeps) # HELPOPT: skip dependency check (during install/simulate and so on)
nodeps="--nodeps" nodeps="--nodeps"
;; ;;
--force) # HELPOPT: force install/remove package (f.i., override)
force="--force"
;;
--auto) # HELPOPT: non interactive mode --auto) # HELPOPT: non interactive mode
non_interactive=1 non_interactive=1
;; ;;
...@@ -213,13 +222,14 @@ pkg_filenames=$(strip_spaces "$pkg_files $pkg_names") ...@@ -213,13 +222,14 @@ pkg_filenames=$(strip_spaces "$pkg_files $pkg_names")
echover "pkg_files=$pkg_files" echover "pkg_files=$pkg_files"
echover "pkg_names=$pkg_names" echover "pkg_names=$pkg_names"
# Run helper for command # Just printout help if run without args
if [ -z "$epm_cmd" ] ; then if [ -z "$epm_cmd" ] ; then
print_version print_version
echo echo
fatal "Run $ epm --help for get help" fatal "Run $ epm --help for get help"
fi fi
# Run helper for command
load_helper epm-$epm_cmd load_helper epm-$epm_cmd
epm_$epm_cmd epm_$epm_cmd
# return last error code # return last error code (from subroutine)
...@@ -21,20 +21,23 @@ ...@@ -21,20 +21,23 @@
epm_addrepo() epm_addrepo()
{ {
case $PMTYPE in case $PMTYPE in
apt-rpm|apt-dpkg) apt-rpm)
sudocmd apt-repo add $pkg_filenames
;;
apt-dpkg)
echo "You need manually add repo to /etc/apt/sources.list" echo "You need manually add repo to /etc/apt/sources.list"
;; ;;
yum-rpm) yum-rpm)
echo "You need manually add repo to /etc/yum.repos.d/" echo "You need manually add repo to /etc/yum.repos.d/"
;; ;;
urpm-rpm) urpm-rpm)
docmd $SUDO urpmi.addmedia $pkg_filenames sudocmd urpmi.addmedia $pkg_filenames
;; ;;
zypper-rpm) zypper-rpm)
docmd $SUDO zypper ar $pkg_filenames sudocmd zypper ar $pkg_filenames
;; ;;
emerge) emerge)
docmd $SUDO layman -a $pkg_filenames sudocmd layman -a $pkg_filenames
;; ;;
pacman) pacman)
echo "You need manually add repo to /etc/pacman.conf" echo "You need manually add repo to /etc/pacman.conf"
......
...@@ -22,24 +22,24 @@ epm_check() ...@@ -22,24 +22,24 @@ epm_check()
{ {
case $PMTYPE in case $PMTYPE in
apt-rpm|apt-dpkg) apt-rpm|apt-dpkg)
#docmd $SUDO apt-get check || exit #sudocmd apt-get check || exit
docmd $SUDO apt-get update || exit sudocmd apt-get update || exit
docmd $SUDO apt-get -f install || exit sudocmd apt-get -f install || exit
;; ;;
apt-dpkg) apt-dpkg)
docmd $SUDO apt-get update || exit sudocmd apt-get update || exit
docmd $SUDO apt-get -f install || exit sudocmd apt-get -f install || exit
docmd $SUDO apt-get autoremove sudocmd apt-get autoremove
;; ;;
yum-rpm) yum-rpm)
docmd package-cleanup --leaves docmd package-cleanup --leaves
package-cleanup --leaves | xargs yum remove a= package-cleanup --leaves | xargs yum remove
;; ;;
urpm-rpm) urpm-rpm)
docmd $SUDO urpme --auto-orphans sudocmd urpme --auto-orphans
;; ;;
zypper-rpm) zypper-rpm)
docmd $SUDO zypper verify || exit sudocmd zypper verify || exit
;; ;;
*) *)
fatal "Do not known command for $PMTYPE" fatal "Do not known command for $PMTYPE"
......
...@@ -22,17 +22,17 @@ epm_clean() ...@@ -22,17 +22,17 @@ epm_clean()
{ {
case $PMTYPE in case $PMTYPE in
apt-rpm|apt-dpkg) apt-rpm|apt-dpkg)
docmd $SUDO apt-get clean sudocmd apt-get clean
;; ;;
yum-rpm) yum-rpm)
docmd $SUDO yum clean all sudocmd yum clean all
docmd $SUDO yum makecache sudocmd yum makecache
;; ;;
urpm-rpm) urpm-rpm)
docmd $SUDO urpmi --clean sudocmd urpmi --clean
;; ;;
zypper-rpm) zypper-rpm)
docmd $SUDO zypper clean sudocmd zypper clean
;; ;;
*) *)
fatal "Do not known command for $PMTYPE" fatal "Do not known command for $PMTYPE"
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# #
load_helper epm-query
epm_filelist() epm_filelist()
{ {
[ -n "$pkg_filenames" ] || fatal "Run query without names" [ -n "$pkg_filenames" ] || fatal "Run query without names"
...@@ -46,6 +48,8 @@ case $PMTYPE in ...@@ -46,6 +48,8 @@ case $PMTYPE in
;; ;;
esac esac
docmd $CMD $pkg_filenames docmd $CMD $pkg_filenames && return
epm_query >/dev/null || fatal "Query filelist for non installed packages does not realized"
} }
...@@ -40,42 +40,47 @@ filter_out_installed_packages() ...@@ -40,42 +40,47 @@ filter_out_installed_packages()
*) *)
cat cat
;; ;;
esac | sed -e "s|rpm-build-altlinux-compat||g" | filter_strip_spaces esac | sed -e "s|rpm-build-altlinux-compat[^ ]*||g" | filter_strip_spaces
} }
# copied from etersoft-build-utils/share/eterbuild/functions/rpmpkg # copied from etersoft-build-utils/share/eterbuild/functions/rpmpkg
epm_install_names() epm_install_names()
{ {
if [ -n "$non_interactive" ] ; then
epm_ni_install_names "$@"
return
fi
[ -z "$1" ] && return [ -z "$1" ] && return
case $PMTYPE in case $PMTYPE in
apt-rpm|apt-dpkg) apt-rpm|apt-dpkg)
docmd $SUDO apt-get install $@ sudocmd apt-get install $@
return ;; return ;;
urpm-rpm) urpm-rpm)
docmd $SUDO urpmi $@ sudocmd urpmi $@
return ;; return ;;
pkg_add) pkg_add)
docmd $SUDO pkg_add -r $@ sudocmd pkg_add -r $@
return ;; return ;;
emerge) emerge)
docmd $SUDO emerge -uD $@ sudocmd emerge -uD $@
return ;; return ;;
pacman) pacman)
docmd $SUDO pacman -S $@ sudocmd pacman -S $@
return ;; return ;;
yum-rpm) yum-rpm)
docmd $SUDO yum install $@ sudocmd yum install $@
return ;; return ;;
zypper-rpm) zypper-rpm)
docmd $SUDO zypper install $@ sudocmd zypper install $@
return ;; return ;;
mpkg) mpkg)
docmd $SUDO mpkg install $@ sudocmd mpkg install $@
return ;; return ;;
slackpkg) slackpkg)
# TODO: use upgrade if package is already installed # TODO: use upgrade if package is already installed
docmd $SUDO slackpkg install $@ sudocmd slackpkg install $@
return ;; return ;;
*) *)
fatal "Do not known install command for $PMTYPE" fatal "Do not known install command for $PMTYPE"
...@@ -89,26 +94,26 @@ epm_ni_install_names() ...@@ -89,26 +94,26 @@ epm_ni_install_names()
[ -z "$1" ] && return [ -z "$1" ] && return
case $PMTYPE in case $PMTYPE in
apt-rpm|apt-dpkg) apt-rpm|apt-dpkg)
docmd $SUDO apt-get -y --force-yes install $@ sudocmd apt-get -y --force-yes install $@
return ;; return ;;
yum-rpm) yum-rpm)
docmd $SUDO yum -y install $@ sudocmd yum -y install $@
return ;; return ;;
urpm-rpm) urpm-rpm)
docmd $SUDO urpmi --auto --no-verify-rpm $@ sudocmd urpmi --auto --no-verify-rpm $@
return ;; return ;;
zypper-rpm) zypper-rpm)
yes | docmd $SUDO zypper --non-interactive install $@ yes | sudocmd zypper --non-interactive install $@
return ;; return ;;
pkg_add) pkg_add)
docmd $SUDO pkg_add -r $@ sudocmd pkg_add -r $@
return ;; return ;;
pacman) pacman)
docmd $SUDO pacman -S --noconfirm $@ sudocmd pacman -S --noconfirm $@
return ;; return ;;
slackpkg) slackpkg)
# TODO: use upgrade if package is already installed # TODO: use upgrade if package is already installed
docmd $SUDO slackpkg -batch=on -default_answer=yes install $@ sudocmd slackpkg -batch=on -default_answer=yes install $@
return ;; return ;;
*) *)
fatal "Do not known appropriate install command for $PMTYPE" fatal "Do not known appropriate install command for $PMTYPE"
...@@ -121,34 +126,31 @@ epm_install_files() ...@@ -121,34 +126,31 @@ epm_install_files()
[ -z "$1" ] && return [ -z "$1" ] && return
case $PMTYPE in case $PMTYPE in
apt-rpm) apt-rpm|urpm-rpm)
docmd $SUDO rpm -Uvh --force $nodeps $@ && return sudocmd rpm -Uvh $force $nodeps $@ && return
docmd $SUDO apt-get install $@ # use install_names
return ;; ;;
apt-dpkg) apt-dpkg)
docmd $SUDO dpkg -i $@ sudocmd dpkg -i $@
docmd $SUDO apt-get -f install sudocmd apt-get -f install
return ;; return ;;
yum-rpm) yum-rpm)
docmd $SUDO rpm -Uvh --force $@ && return sudocmd rpm -Uvh $force $@ && return
docmd $SUDO yum --nogpgcheck local install $@ sudocmd yum --nogpgcheck install $@
return ;; return ;;
pkg_add) pkg_add)
docmd $SUDO pkg_add $@ sudocmd pkg_add $@
return ;; return ;;
pacman) pacman)
docmd $SUDO pacman -U $@ sudocmd pacman -U --noconfirm $@
return ;; return ;;
slackpkg) slackpkg)
docmd $SUDO installpkg $@ sudocmd installpkg $@
return ;; return ;;
*)
fatal "Do not known appropriate install command for $PMTYPE"
;;
esac esac
# other systems can install file package via ordinary command # other systems can install file package via ordinary command
epm_install_names $@ epm_install_names "$@"
} }
epm_print_install_command() epm_print_install_command()
...@@ -190,11 +192,6 @@ epm_install() ...@@ -190,11 +192,6 @@ epm_install()
[ -z "$files$names" ] && echo "Skip empty install list" && return 2 [ -z "$files$names" ] && echo "Skip empty install list" && return 2
if [ -n "$non_interactive" ] ; then epm_install_names $names || return
epm_ni_install_names $names || return
else
epm_install_names $names || return
fi
epm_install_files $files epm_install_files $files
} }
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# #
load_helper epm-packages
# TODO: combine with -qa (the difference only in return status now) # TODO: combine with -qa (the difference only in return status now)
epm_query() epm_query()
...@@ -36,7 +38,7 @@ case $PMTYPE in ...@@ -36,7 +38,7 @@ case $PMTYPE in
#return #return
;; ;;
*) *)
fatal "Do not known command for $PMTYPE" epm_packages | grep "$pkg_filenames"
;; ;;
esac esac
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# #
load_helper epm-search_file
# copied from etersoft-build-utils/bin/rpmqf # copied from etersoft-build-utils/bin/rpmqf
# use and modify TOFILE recursively # use and modify TOFILE recursively
...@@ -85,7 +87,7 @@ __do_query() ...@@ -85,7 +87,7 @@ __do_query()
fatal "Do not known query command for $PMTYPE" fatal "Do not known query command for $PMTYPE"
;; ;;
esac esac
docmd $CMD $@ docmd $CMD $@
} }
...@@ -97,7 +99,7 @@ epm_query_file() ...@@ -97,7 +99,7 @@ epm_query_file()
for i in $pkg_filenames ; do for i in $pkg_filenames ; do
real_file "$i" real_file "$i"
__do_query $FULLFILEPATH __do_query $FULLFILEPATH || pkg_filenames=$i epm_search_file
done done
} }
...@@ -23,5 +23,5 @@ load_helper epm-packages ...@@ -23,5 +23,5 @@ load_helper epm-packages
epm_query_package() epm_query_package()
{ {
#showcmd grep --color "$pkg_filenames" #showcmd grep --color "$pkg_filenames"
epm_packages | grep --color "$pkg_filenames" pkg_filenames= epm_packages | grep --color "$pkg_filenames"
} }
...@@ -24,25 +24,25 @@ epm_reinstall_names() ...@@ -24,25 +24,25 @@ epm_reinstall_names()
[ -n "$1" ] || return [ -n "$1" ] || return
case $PMTYPE in case $PMTYPE in
apt-rpm|apt-dpkg) apt-rpm|apt-dpkg)
docmd $SUDO apt-get --reinstall install $@ sudocmd apt-get --reinstall install $@
return ;; return ;;
yum-rpm) yum-rpm)
docmd $SUDO yum install $@ sudocmd yum install $@
return ;; return ;;
urpm-rpm) urpm-rpm)
docmd $SUDO urpmi $@ sudocmd urpmi $@
return ;; return ;;
zypper-rpm) zypper-rpm)
docmd $SUDO zypper install $@ sudocmd zypper install $@
return ;; return ;;
pkg_add) pkg_add)
docmd $SUDO pkg_add -r $@ sudocmd pkg_add -r $@
return ;; return ;;
pacman) pacman)
docmd $SUDO pacman -U $@ sudocmd pacman -U $@
return ;; return ;;
slackpkg) slackpkg)
docmd $SUDO slackpkg reinstall $@ sudocmd slackpkg reinstall $@
return ;; return ;;
*) *)
fatal "Do not known install command for $PMTYPE" fatal "Do not known install command for $PMTYPE"
...@@ -56,14 +56,14 @@ epm_reinstall_files() ...@@ -56,14 +56,14 @@ epm_reinstall_files()
case $PMTYPE in case $PMTYPE in
apt-rpm) apt-rpm)
docmd $SUDO rpm -Uvh --force $@ && return sudocmd rpm -Uvh --force $@ && return
docmd $SUDO apt-get --reinstall install $@ sudocmd apt-get --reinstall install $@
return ;; return ;;
apt-pkg) apt-pkg)
docmd $SUDO dpkg -i $@ sudocmd dpkg -i $@
return ;; return ;;
slackpkg) slackpkg)
docmd $SUDO installpkg $@ sudocmd installpkg $@
return ;; return ;;
esac esac
......
...@@ -24,41 +24,22 @@ epm_remove_low() ...@@ -24,41 +24,22 @@ epm_remove_low()
[ -z "$1" ] && return [ -z "$1" ] && return
case $PMTYPE in case $PMTYPE in
apt-rpm|yum-rpm|zypper-rpm|urpm-rpm) apt-rpm|yum-rpm|zypper-rpm|urpm-rpm)
docmd $SUDO rpm -ev $nodeps $@ sudocmd rpm -ev $nodeps $@
return ;; return ;;
apt-dpkg) apt-dpkg)
docmd $SUDO dpkg -P $@ sudocmd dpkg -P $@
return ;; return ;;
pkg_add) pkg_add)
docmd $SUDO pkg_delete -r $@ sudocmd pkg_delete -r $@
return ;; return ;;
emerge) emerge)
docmd $SUDO emerge -unmerge $@ sudocmd emerge -unmerge $@
return ;; return ;;
slackpkg) slackpkg)
docmd $SUDO removepkg $@ sudocmd removepkg $@
return ;; return ;;
*)
fatal "Do not known command for $PMTYPE"
;;
esac esac
return 1 return 1
}
epm_remove()
{
[ -n "$pkg_filenames" ] || fatal "Run remove without args"
epm_remove_low $pkg_filenames && return
if [ -n "$non_interactive" ] ; then
epm_remove_nonint $pkg_filenames
local RET=$?
# if not separate command, use usual command
[ "$RET" = "5" ] || return $RET
fi
epm_remove_names $pkg_filenames
} }
epm_remove_names() epm_remove_names()
...@@ -67,32 +48,32 @@ epm_remove_names() ...@@ -67,32 +48,32 @@ epm_remove_names()
case $PMTYPE in case $PMTYPE in
apt-rpm|apt-dpkg) apt-rpm|apt-dpkg)
docmd $SUDO apt-get remove --purge $@ sudocmd apt-get remove --purge $@
return ;; return ;;
urpm-rpm) urpm-rpm)
docmd $SUDO urpme $@ sudocmd urpme $@
return ;; return ;;
pkg_add) # without dependencies pkg_add) # without dependencies
docmd $SUDO pkg_delete $@ sudocmd pkg_delete $@
return ;; return ;;
emerge) emerge)
#docmd $SUDO emerge --unmerge $@ #sudocmd emerge --unmerge $@
docmd $SUDO emerge -aC $@ sudocmd emerge -aC $@
return ;; return ;;
pacman) pacman)
docmd $SUDO pacman -R $@ sudocmd pacman -R $@
return ;; return ;;
yum-rpm) yum-rpm)
docmd $SUDO yum remove $@ sudocmd yum remove $@
return ;; return ;;
zypper-rpm) zypper-rpm)
docmd $SUDO zypper remove $@ sudocmd zypper remove $@
return ;; return ;;
mpkg) mpkg)
docmd $SUDO mpkg remove $@ sudocmd mpkg remove $@
return ;; return ;;
slackpkg) slackpkg)
docmd $SUDO slackpkg remove $@ sudocmd slackpkg remove $@
return ;; return ;;
*) *)
fatal "Do not known command for $PMTYPE" fatal "Do not known command for $PMTYPE"
...@@ -105,27 +86,40 @@ epm_remove_nonint() ...@@ -105,27 +86,40 @@ epm_remove_nonint()
{ {
case $PMTYPE in case $PMTYPE in
apt-rpm|apt-dpkg) apt-rpm|apt-dpkg)
docmd $SUDO apt-get -y --force-yes remove --purge $@ sudocmd apt-get -y --force-yes remove --purge $@
return ;; return ;;
urpm-rpm) urpm-rpm)
docmd $SUDO urpme --auto $@ sudocmd urpme --auto $@
return ;; return ;;
pacman) pacman)
docmd $SUDO pacman -R --noconfirm $@ sudocmd pacman -R --noconfirm $@
return ;; return ;;
yum-rpm) yum-rpm)
docmd $SUDO yum -y remove $@ sudocmd yum -y remove $@
return ;; return ;;
zypper-rpm) zypper-rpm)
docmd $SUDO zypper --non-interactive remove $@ sudocmd zypper --non-interactive remove $@
return ;; return ;;
slackpkg) slackpkg)
docmd $SUDO slackpkg -batch=on -default_answer=yes remove $@ sudocmd slackpkg -batch=on -default_answer=yes remove $@
return ;; return ;;
*)
fatal "Do not known command for $PMTYPE"
;;
esac esac
return 5 return 5
} }
epm_remove()
{
[ -n "$pkg_filenames" ] || fatal "Run remove without args"
epm_remove_low $pkg_filenames && return
if [ -n "$non_interactive" ] ; then
epm_remove_nonint $pkg_filenames
local RET=$?
# if not separate command, use usual command
[ "$RET" = "5" ] || return $RET
fi
epm_remove_names $pkg_filenames
}
...@@ -21,20 +21,23 @@ ...@@ -21,20 +21,23 @@
epm_removerepo() epm_removerepo()
{ {
case $PMTYPE in case $PMTYPE in
apt-rpm|apt-dpkg) apt-rpm)
sudocmd apt-repo rm $pkg_filenames
;;
apt-dpkg)
echo "You need remove repo from /etc/apt/sources.list" echo "You need remove repo from /etc/apt/sources.list"
;; ;;
yum-rpm) yum-rpm)
echo "You need remove repo from /etc/yum.repos.d/" echo "You need remove repo from /etc/yum.repos.d/"
;; ;;
urpm-rpm) urpm-rpm)
docmd $SUDO urpmi.removemedia $pkg_names sudocmd urpmi.removemedia $pkg_filenames
;; ;;
zypper-rpm) zypper-rpm)
docmd $SUDO zypper removerepo $pkg_names sudocmd zypper removerepo $pkg_filenames
;; ;;
emerge) emerge)
docmd $SUDO layman -d$pkg_names sudocmd layman -d$pkg_filenames
;; ;;
pacman) pacman)
echo "You need remove repo from /etc/pacman.conf" echo "You need remove repo from /etc/pacman.conf"
......
...@@ -25,26 +25,30 @@ print_apt_sources_list() ...@@ -25,26 +25,30 @@ print_apt_sources_list()
#echo #echo
#echo "$i:" #echo "$i:"
grep -v "^#" $i grep -v "^#" $i
done | grep -v "^$" done | grep -v "^ *\$"
} }
epm_repolist() epm_repolist()
{ {
case $PMTYPE in case $PMTYPE in
apt-rpm|apt-dpkg) apt-rpm)
docmd print_apt_sources_list /etc/apt/sources.list /etc/apt/sources.list.d/* docmd apt-repo list
;;
apt-dpkg)
showcmd cat /etc/apt/sources.list*
print_apt_sources_list /etc/apt/sources.list /etc/apt/sources.list.d/*.list
;; ;;
yum-rpm) yum-rpm)
docmd yum repolist docmd yum repolist
;; ;;
urpm-rpm) urpm-rpm)
docmd urpmq --list-media docmd urpmq --list-url
;; ;;
zypper-rpm) zypper-rpm)
docmd zypper sl -d docmd zypper sl -d
;; ;;
emerge) emerge)
docmd layman -L docmd layman -L
;; ;;
pacman) pacman)
docmd cat /etc/pacman.conf docmd cat /etc/pacman.conf
......
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
#
load_helper epm-packages
# TODO: combine with -qa (the difference only in return status now)
epm_requires()
{
[ -n "$pkg_filenames" ] || fatal "Run query without names"
# by file package
case $PMTYPE in
apt-rpm|urpm-rpm|zypper-rpm|yum-rpm)
CMD="rpm -q --requires -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 file name
case $PMTYPE in
apt-rpm|urpm-rpm|zypper-rpm)
# FIXME: use hi level commands
CMD="rpm -q --requires"
;;
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
}
...@@ -18,13 +18,38 @@ ...@@ -18,13 +18,38 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
# #
# TODO: port or rewrite apt-file
# https://bugzilla.altlinux.org/show_bug.cgi?id=14449
local_content_search()
{
local SYSARCH
SYSARCH=$(uname -m)
[ "$SYSARCH" = "x86_64" ] || SYSARCH=i586
local REPODIR=/var/ftp/pub/ALTLinux/Sisyphus
local CI=$REPODIR/$SYSARCH/base/contents_index
local CINOA=$REPODIR/noarch/base/contents_index
local OUTCMD="less"
[ -n "$USETTY" ] || OUTCMD="cat"
test -r $CI && test -r $CINOA || fatal "Can't locate $CI or $CINOA"
{
[ -n "$USETTY" ] && echo "Search in $CI and $CINOA for $1..."
grep -h ".*$1.*\t" $CI $CINOA | sed -e "s|\(.*\)\t\(.*\)|\2: \1|g"
} | $OUTCMD
}
epm_search_file() epm_search_file()
{ {
[ -n "$pkg_filenames" ] || fatal "Run search without names" [ -n "$pkg_filenames" ] || fatal "Run search without names"
case $PMTYPE in case $PMTYPE in
apt-rpm|apt-dpkg) apt-rpm)
docmd $SUDO apt-file update local_content_search $pkg_filenames
return ;;
apt-dpkg)
sudocmd apt-file update
docmd apt-file search $pkg_filenames docmd apt-file search $pkg_filenames
return ;; return ;;
yum-rpm) yum-rpm)
......
...@@ -94,10 +94,10 @@ docmd() ...@@ -94,10 +94,10 @@ docmd()
} }
# Print command line and run command line with SUDO # Print command line and run command line with SUDO
docmds() sudocmd()
{ {
showcmd "$@" showcmd "$SUDO $@"
"$SUDO $@" $SUDO "$@"
} }
filter_strip_spaces() filter_strip_spaces()
......
...@@ -23,11 +23,11 @@ load_helper epm-install ...@@ -23,11 +23,11 @@ load_helper epm-install
epm_simulate() epm_simulate()
{ {
local CMD local CMD
[ -n "$pkg_filenames" ] || fatal "Run $epm_cmd without packages" [ -z "$pkg_filenames" ] && echo "Skip empty list" && return 2
local filenames="$(echo $pkg_filenames | filter_out_installed_packages)" local filenames="$(echo $pkg_filenames | filter_out_installed_packages)"
# FIXME: can't correct receive status 2 in mandriva?
[ -z "$filenames" ] && echo "Skip empty simulate list" && return 0 #&& return 2 [ -z "$filenames" ] && echo "All packages are already installed" && return 2
case $PMTYPE in case $PMTYPE in
apt-rpm|apt-dpkg) apt-rpm|apt-dpkg)
...@@ -57,6 +57,6 @@ epm_simulate() ...@@ -57,6 +57,6 @@ epm_simulate()
;; ;;
esac esac
docmd $SUDO $CMD $filenames sudocmd $CMD $filenames
} }
...@@ -24,31 +24,31 @@ epm_update() ...@@ -24,31 +24,31 @@ epm_update()
{ {
case $PMTYPE in case $PMTYPE in
apt-rpm) apt-rpm)
docmd $SUDO apt-get update || exit sudocmd apt-get update || exit
#docmd $SUDO apt-get -f install || exit #sudocmd apt-get -f install || exit
;; ;;
apt-dpkg) apt-dpkg)
docmd $SUDO apt-get update || exit sudocmd apt-get update || exit
#docmd $SUDO apt-get -f install || exit #sudocmd apt-get -f install || exit
#docmd $SUDO apt-get autoremove #sudocmd apt-get autoremove
;; ;;
yum-rpm) yum-rpm)
docmd $SUDO yum check-update sudocmd yum check-update
;; ;;
urpm-rpm) urpm-rpm)
docmd $SUDO urpmi.update -a sudocmd urpmi.update -a
;; ;;
pacman) pacman)
docmd $SUDO pacman -S -y sudocmd pacman -S -y
;; ;;
zypper-rpm) zypper-rpm)
docmd $SUDO zypper refresh sudocmd zypper refresh
;; ;;
emerge) emerge)
docmd $SUDO emerge --sync sudocmd emerge --sync
;; ;;
slackpkg) slackpkg)
docmd $SUDO slackpkg update sudocmd slackpkg update
;; ;;
*) *)
fatal "Do not known update command for $PMTYPE" fatal "Do not known update command for $PMTYPE"
......
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
epm_upgrade() epm_upgrade()
{ {
[ -n "$pkg_filenames" ] && fatal "No need any args for upgrade command"
echo "Run command for upgrade packages" echo "Run command for upgrade packages"
case $PMTYPE in case $PMTYPE in
apt-rpm|apt-dpkg) apt-rpm|apt-dpkg)
...@@ -32,8 +30,8 @@ epm_upgrade() ...@@ -32,8 +30,8 @@ epm_upgrade()
CMD="yum update" CMD="yum update"
;; ;;
urpm-rpm) urpm-rpm)
# or --auto-select # or --auto-select --replace-files
CMD="urpmi --auto-update --replace-files" CMD="urpmi --auto-update"
;; ;;
zypper-rpm) zypper-rpm)
CMD="zypper dist-upgrade" CMD="zypper dist-upgrade"
...@@ -55,5 +53,5 @@ epm_upgrade() ...@@ -55,5 +53,5 @@ epm_upgrade()
;; ;;
esac esac
docmd $SUDO $CMD sudocmd $CMD $pkg_filenames
} }
# This spec is backported to ALTLinux t6 automatically by rpmbph script. Do not edit it. # This spec is backported to ALTLinux t6 automatically by rpmbph script. Do not edit it.
# #
Name: eepm Name: eepm
Version: 0.9.5 Version: 1.0.2
Release: alt0.M60T.1 Release: alt0.M60T.1
Summary: Etersoft EPM package manager Summary: Etersoft EPM package manager
...@@ -22,6 +22,10 @@ Conflicts: epm ...@@ -22,6 +22,10 @@ Conflicts: epm
Provides: upm Provides: upm
%if %_vendor == "alt"
Requires: apt rpm apt-repo
%endif
%description %description
Etersoft EPM is the package manager for any platform Etersoft EPM is the package manager for any platform
and any platform version. It provides and any platform version. It provides
...@@ -47,9 +51,40 @@ with various distros. ...@@ -47,9 +51,40 @@ with various distros.
%_bindir/distr_info %_bindir/distr_info
%changelog %changelog
* Sat Aug 04 2012 Vitaly Lipatov <lav@altlinux.ru> 0.9.5-alt0.M60T.1 * Fri Oct 05 2012 Vitaly Lipatov <lav@altlinux.ru> 1.0.2-alt0.M60T.1
- backport to ALTLinux t6 (by rpmbph script) - backport to ALTLinux t6 (by rpmbph script)
* Tue Sep 18 2012 Vitaly Lipatov <lav@altlinux.ru> 1.0.2-alt1
- replace all docmd $SUDO with sudocmd call
- fix install package rpm-build-altlinux-compat via package fullname
* Tue Sep 18 2012 Vitaly Lipatov <lav@altlinux.ru> 1.0.1-alt1
- epm: add --force support for install
- drop extra dependencies
- introduce epm requires|deplist
- install: yum local install is obsoleted, use just yum install
* Fri Aug 17 2012 Vitaly Lipatov <lav@altlinux.ru> 1.0.0-alt1
- release 1.0
- upgrade: add support for additional options
- filelist: add error for non installed packages
- use apt-repo on ALT Linux for repo manipulation
- repolist: print url on mandriva
* Tue Aug 07 2012 Vitaly Lipatov <lav@altlinux.ru> 0.9.7-alt1
- epm: fix use epm_packages
- simulate: return 2 if have no work
- install: support --auto for install files too
- install: run pacman for files with --noconfirm
* Mon Aug 06 2012 Vitaly Lipatov <lav@altlinux.ru> 0.9.6-alt1
- query: default realization via epm package list
- simulate: it is ok to run with empty list
- query_file: try search in global base if failed in installed
- search_file: realize search_file on ALT Linux via grep local contents_index
- remove: allow fallback to next level if target does not supported
- install files: allow fallback to hilevel install, add urpm support
* Sat Aug 04 2012 Vitaly Lipatov <lav@altlinux.ru> 0.9.5-alt1 * Sat Aug 04 2012 Vitaly Lipatov <lav@altlinux.ru> 0.9.5-alt1
- epm-install: add show-command-only support - epm-install: add show-command-only support
- epm: update commands variations - epm: update commands variations
......
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