Commit 1841bca5 authored by Vitaly Lipatov's avatar Vitaly Lipatov

backported to p7 as 1.5.16-alt0.M70P.1 (with rpmbph script)

parents f207ecba ba7c9b33
--dump-options for write simple bash completition
add epm site / epmurl in replace to rpmurl add epm site / epmurl in replace to rpmurl
yum remove $(package-cleanup --orphans yum remove $(package-cleanup --orphans
......
...@@ -58,7 +58,7 @@ print_version() ...@@ -58,7 +58,7 @@ print_version()
{ {
echo "EPM package manager version @VERSION@" echo "EPM package manager version @VERSION@"
echo "Running on $($DISTRVENDOR) ('$PMTYPE' package manager uses '$PKGFORMAT' package format)" echo "Running on $($DISTRVENDOR) ('$PMTYPE' package manager uses '$PKGFORMAT' package format)"
echo "Copyright (c) Etersoft 2012-2014" echo "Copyright (c) Etersoft 2012-2015"
echo "This program may be freely redistributed under the terms of the GNU AGPLv3." echo "This program may be freely redistributed under the terms of the GNU AGPLv3."
} }
...@@ -246,7 +246,7 @@ check_command() ...@@ -246,7 +246,7 @@ check_command()
downgrade) # HELPCMD: downgrade [all] packages to the repo state downgrade) # HELPCMD: downgrade [all] packages to the repo state
epm_cmd=downgrade epm_cmd=downgrade
;; ;;
download) # HELPCMD: download package(s) file to the current dir download) # HELPCMD: download package(s) file to the current dir
epm_cmd=download epm_cmd=download
;; ;;
simulate) # HELPCMD: simulate install with check requires simulate) # HELPCMD: simulate install with check requires
...@@ -255,6 +255,9 @@ check_command() ...@@ -255,6 +255,9 @@ check_command()
audit) # HELPCMD: audits installed packages against known vulnerabilities audit) # HELPCMD: audits installed packages against known vulnerabilities
epm_cmd=audit epm_cmd=audit
;; ;;
site|url) # HELPCMD: open package's site in a browser (use -p for open packages.altlinux.org site)
epm_cmd=site
;;
-V|checkpkg|integrity) # HELPCMD: check package file integrity (checksum) -V|checkpkg|integrity) # HELPCMD: check package file integrity (checksum)
epm_cmd=checkpkg epm_cmd=checkpkg
;; ;;
......
...@@ -47,9 +47,9 @@ __epm_assure() ...@@ -47,9 +47,9 @@ __epm_assure()
{ {
if is_dirpath "$1" ; then if is_dirpath "$1" ; then
if [ -r "$1" ] ; then if [ -e "$1" ] ; then
if [ -n "$verbose" ] ; then if [ -n "$verbose" ] ; then
info "File $1 is exists." info "File or directory $1 is already exists."
epm qf "$1" epm qf "$1"
fi fi
return 0 return 0
...@@ -57,7 +57,6 @@ __epm_assure() ...@@ -57,7 +57,6 @@ __epm_assure()
[ -n "$2" ] || fatal "You need run with package name param when use with absolute path" [ -n "$2" ] || fatal "You need run with package name param when use with absolute path"
# TODO: below we install in some semimanual way
docmd epm --auto --skip-installed install "$2" docmd epm --auto --skip-installed install "$2"
return return
fi fi
...@@ -74,18 +73,13 @@ __epm_assure() ...@@ -74,18 +73,13 @@ __epm_assure()
# TODO: use package name normalization # TODO: use package name normalization
info "Installing appropriate package for $1 command..." info "Installing appropriate package for $1 command..."
# TODO: why we can't use epm install here? it can be non interactive and skip-installed
# QUESTION: how we can this package is installed if its not?
load_helper epm-install
local PACKAGE="$2" local PACKAGE="$2"
[ -n "$PACKAGE" ] || PACKAGE="$1" [ -n "$PACKAGE" ] || PACKAGE="$1"
#epm install $2
# copied from epm_install local PACKAGEVERSION="$3"
local names="$(echo "$PACKAGE" | filter_out_installed_packages)" warning "TODO: check for PACKAGEVERSION is missed"
non_interactive=1 epm_install_names $names docmd epm --auto --skip-installed install "$PACKAGE"
} }
...@@ -94,5 +88,5 @@ epm_assure() ...@@ -94,5 +88,5 @@ epm_assure()
[ -n "$pkg_filenames" ] || fatal "Assure: Missing params. Check $0 --help for info." [ -n "$pkg_filenames" ] || fatal "Assure: Missing params. Check $0 --help for info."
# use helper func for extract separate params # use helper func for extract separate params
__epm_assure $pkg_filenames __epm_assure $(eval echo $quoted_args)
} }
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2014 Etersoft # Copyright (C) 2014, 2015 Etersoft
# Copyright (C) 2014 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2014, 2015 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
...@@ -24,6 +24,8 @@ __is_repo_info_download() ...@@ -24,6 +24,8 @@ __is_repo_info_download()
if [ -r /var/cache/apt ] ; then if [ -r /var/cache/apt ] ; then
# FIXME: only if root permissions # FIXME: only if root permissions
test -r /var/cache/apt/pkgcache.bin || return test -r /var/cache/apt/pkgcache.bin || return
# if repo older than 1 day, return false
test -n "$(find /var/cache/apt/pkgcache.bin -ctime +1)" || return
fi fi
;; ;;
*) *)
......
...@@ -19,17 +19,15 @@ ...@@ -19,17 +19,15 @@
# copied from etersoft-build-utils/bin/rpmqf # copied from etersoft-build-utils/bin/rpmqf
# use and modify TOFILE recursively
__do_query_real_file() __do_query_real_file()
{ {
local LINKTO1 LINKTO
local TOFILE local TOFILE
# get canonical path # get canonical path
if [ -e "$1" ] ; then if [ -e "$1" ] ; then
TOFILE=$1 TOFILE="$1"
else else
TOFILE=`which $1 2>/dev/null || echo $1` TOFILE=$(which "$1" 2>/dev/null || echo "$1")
if [ "$TOFILE" != "$1" ] ; then if [ "$TOFILE" != "$1" ] ; then
info "Note: $1 is placed as $TOFILE" info "Note: $1 is placed as $TOFILE"
fi fi
...@@ -37,10 +35,12 @@ __do_query_real_file() ...@@ -37,10 +35,12 @@ __do_query_real_file()
# get value of symbolic link # get value of symbolic link
if [ -L "$TOFILE" ] ; then if [ -L "$TOFILE" ] ; then
__do_query $TOFILE local LINKTO
LINKTO=`readlink "$TOFILE"` __do_query "$TOFILE"
LINKTO=$(readlink -f "$TOFILE")
info "Note: $TOFILE is link to $LINKTO" info "Note: $TOFILE is link to $LINKTO"
__do_query_real_file "$LINKTO" __do_query_real_file "$LINKTO"
return
fi fi
FULLFILEPATH="$TOFILE" FULLFILEPATH="$TOFILE"
...@@ -158,7 +158,7 @@ epm_query_file() ...@@ -158,7 +158,7 @@ epm_query_file()
for pkg in $pkg_filenames ; do for pkg in $pkg_filenames ; do
__do_query_real_file "$pkg" __do_query_real_file "$pkg"
__do_query $FULLFILEPATH || pkg_filenames=$FULLFILEPATH epm_search_file __do_query "$FULLFILEPATH" || pkg_filenames="$FULLFILEPATH" epm_search_file
done done
} }
...@@ -36,8 +36,7 @@ __check_yum_result() ...@@ -36,8 +36,7 @@ __check_yum_result()
{ {
grep "^No package" $1 && return 1 grep "^No package" $1 && return 1
grep "^Complete!" $1 && return 0 grep "^Complete!" $1 && return 0
grep "^Exiting on user Command" $1 && return 0 grep "Exiting on user [Cc]ommand" $1 && return 0
grep "^Exiting on user command" $1 && return 0
# dnf issue # dnf issue
grep "^Operation aborted." $1 && return 0 grep "^Operation aborted." $1 && return 0
# return default result by default # return default result by default
......
#!/bin/sh
#
# Copyright (C) 2015 Etersoft
# Copyright (C) 2015 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
load_helper epm-query
run_command_if_exists()
{
local CMD="$1"
shift
if which "$CMD" 2>/dev/null >/dev/null ; then
docmd "$CMD" "$@"
return 0
fi
return 1
}
open_browser()
{
local i
for i in xdg-open firefox chromium links ; do
run_command_if_exists $i "$@" && return
done
}
# FIXME: Copied from etersoft-build-utils
# Query variables from rpm package
querypackage()
{
local FORMAT="%{$2}"
local INSTALLED="-p"
# if name empty, use third param as format string
[ -n "$2" ] || FORMAT="$3"
# if not file, drop -p for get from rpm base
[ -e "$1" ] || INSTALLED=""
rpmquery $INSTALLED --queryformat "$FORMAT" $1
}
# FIXME: Copied from etersoft-build-utils
# return source package name by binary rpm package file
get_sourcepkg_name()
{
local FILE="$1"
local PKGVERSION=$(querypackage "$FILE" VERSION)
querypackage "$FILE" sourcerpm | sed -e "s|-$PKGVERSION.*||g"
}
query_package_url()
{
local URL
case $PMTYPE in
*-rpm)
querypackage "$1" URL
#LANG=C epm info "$1"
return
;;
esac
fatal "rpm based distro supported only. TODO: Realize via web service?"
}
get_locale()
{
local loc
loc=$(a= natspec --locale 2>/dev/null)
[ -n "$loc" ] || loc=$LANG
echo $loc
}
get_pao_url()
{
local loc
loc=$(get_locale | cut -c1-2)
case $loc in
en|ru|uk|br)
loc=$loc
;;
*)
loc=en
esac
echo "http://packages.altlinux.org/$loc/Sisyphus/srpms"
}
query_altlinux_url()
{
local URL
case $PMTYPE in
*-rpm)
local srpm=$(get_sourcepkg_name "$1")
[ -n "$srpm" ] || fatal "Can't get source name for $1"
echo "$(get_pao_url)/$srpm"
return
;;
esac
fatal "rpm based distro supported only. TODO: Realize via web service?"
}
epm_site()
{
[ -n "$pkg_filenames" ] || fatal "Info: missing package(s) name"
PAO=
for f in $pkg_names $pkg_files ; do
[ "$f" = "-p" ] && PAO="$f" && continue
if [ -n "$PAO" ] ; then
pkg_url=$(query_altlinux_url $f)
else
pkg_url=$(query_package_url $f)
fi
[ -n "$pkg_url" ] && open_browser "$pkg_url" && continue
warning "Can't get URL for $f package"
done
#for f in $pkg_names ; do
# LANG=C epm info $f
#done
# TODO: -p for p.a.o (see rpmurl)
}
# This spec is backported to ALTLinux p7 automatically by rpmbph script. Do not edit it. # This spec is backported to ALTLinux p7 automatically by rpmbph script. Do not edit it.
# #
Name: eepm Name: eepm
Version: 1.5.13 Version: 1.5.16
Release: alt0.M70P.1 Release: alt0.M70P.1
Summary: Etersoft EPM package manager Summary: Etersoft EPM package manager
...@@ -67,9 +67,21 @@ chmod a+x %buildroot%_datadir/%name/{serv-,epm-}* ...@@ -67,9 +67,21 @@ chmod a+x %buildroot%_datadir/%name/{serv-,epm-}*
%_sysconfdir/bash_completion.d/cerv %_sysconfdir/bash_completion.d/cerv
%changelog %changelog
* Tue Jul 21 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.13-alt0.M70P.1 * Sun Aug 16 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.16-alt0.M70P.1
- backport to ALTLinux p7 (by rpmbph script) - backport to ALTLinux p7 (by rpmbph script)
* Sun Aug 16 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.16-alt1
- run update if repo info older than 1 day
- epm-query_file: fix read link
- add epm url|site command (with -p arg for open at packages.altlinux.org)
* Wed Aug 12 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.15-alt1
- epm-assure: fix for dir checking support
- epm query file: fix recursion result and more quoting
* Fri Jul 24 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.14-alt1
- simulate: allow Exiting on user Command in any place of the line
* Tue Jul 21 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.13-alt1 * Tue Jul 21 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.13-alt1
- epm-assure: add support for checking any path on a file system - epm-assure: add support for checking any path on a file system
- small fixes - small fixes
......
...@@ -304,7 +304,7 @@ assure_exists() ...@@ -304,7 +304,7 @@ assure_exists()
eget() eget()
{ {
$PROGDIR/tools-eget "$@" $SHAREDIR/tools-eget "$@"
} }
get_package_type() get_package_type()
...@@ -398,7 +398,7 @@ case $DISTRNAME in ...@@ -398,7 +398,7 @@ case $DISTRNAME in
;; ;;
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific) Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific)
CMD="yum-rpm" CMD="yum-rpm"
#which dnf 2>/dev/null >/dev/null && CMD=dnf-rpm which dnf 2>/dev/null >/dev/null && test -d /var/lib/dnf/yumdb && CMD=dnf-rpm
;; ;;
Slackware) Slackware)
CMD="slackpkg" CMD="slackpkg"
...@@ -574,6 +574,30 @@ serv_list_startup() ...@@ -574,6 +574,30 @@ serv_list_startup()
esac esac
} }
# File bin/serv-restart:
serv_restart()
{
local SERVICE="$1"
shift
case $SERVICETYPE in
service-chkconfig|service-upstart)
sudocmd service $SERVICE restart "$@"
;;
service-initd|service-update)
sudocmd $INITDIR/$SERVICE restart "$@"
;;
systemd)
sudocmd systemctl restart $SERVICE "$@"
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
;;
esac
}
# File bin/serv-start: # File bin/serv-start:
serv_start() serv_start()
...@@ -1147,7 +1171,7 @@ $(get_help HELPOPT) ...@@ -1147,7 +1171,7 @@ $(get_help HELPOPT)
print_version() print_version()
{ {
echo "Service manager version 1.5.10" echo "Service manager version 1.5.15"
echo "Running on $($DISTRVENDOR)" echo "Running on $($DISTRVENDOR)"
echo "Copyright (c) Etersoft 2012, 2013" echo "Copyright (c) Etersoft 2012, 2013"
echo "This program may be freely redistributed under the terms of the GNU AGPLv3." echo "This program may be freely redistributed under the terms of the GNU AGPLv3."
...@@ -1182,7 +1206,9 @@ check_command() ...@@ -1182,7 +1206,9 @@ check_command()
serv_cmd=usage serv_cmd=usage
withoutservicename=1 withoutservicename=1
;; ;;
#restart) # HELPCMD: restart service restart) # HELPCMD: restart service
serv_cmd=restart
;;
#reload) # HELPCMD: reload service #reload) # HELPCMD: reload service
start) # HELPCMD: start service start) # HELPCMD: start service
serv_cmd=start serv_cmd=start
......
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