Commit 1e1ab246 authored by Vitaly Lipatov's avatar Vitaly Lipatov

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

parents 61b7d98e 7774bf05
...@@ -406,7 +406,9 @@ pkg_filenames=$(strip_spaces "$pkg_files $pkg_names") ...@@ -406,7 +406,9 @@ pkg_filenames=$(strip_spaces "$pkg_files $pkg_names")
if [ -z "$epm_cmd" ] ; then if [ -z "$epm_cmd" ] ; then
print_version print_version
echo echo
fatal "Unknown command $@. Run $ $PROGNAME --help for get help" fatstr="Unknown command in $@ arg(s)"
[ -n "$*" ] || fatstr="That program needs be running with some command"
fatal "$fatstr. Run $ $PROGNAME --help to get help."
fi fi
# Use eatmydata for write specific operations # Use eatmydata for write specific operations
......
#!/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
...@@ -37,7 +37,7 @@ __alt_local_content_filelist() ...@@ -37,7 +37,7 @@ __alt_local_content_filelist()
{ {
[ -n "$USETTY" ] && info "Search in $CI for $1..." [ -n "$USETTY" ] && info "Search in $CI for $1..."
grep -h -- ".*$1$" $CI | sed -e "s|\(.*\)\t\(.*\)|\1|g" __local_ercat $CI | grep -h -- ".*$1$" | sed -e "s|\(.*\)\t\(.*\)|\1|g"
} | $OUTCMD } | $OUTCMD
} }
...@@ -64,7 +64,7 @@ __epm_filelist_remote() ...@@ -64,7 +64,7 @@ __epm_filelist_remote()
docmd_foreach __deb_local_content_filelist $@ docmd_foreach __deb_local_content_filelist $@
;; ;;
*) *)
fatal "Query filelist for non installed packages does not realized" fatal "Query filelist for non installed packages is not implemented yet."
;; ;;
esac esac
} }
...@@ -134,7 +134,7 @@ __epm_filelist_name() ...@@ -134,7 +134,7 @@ __epm_filelist_name()
return return
;; ;;
slackpkg) slackpkg)
is_installed $@ || fatal "Query filelist for non installed packages does not realized" is_installed $@ || fatal "Query filelist for non installed packages is not implemented yet"
docmd awk 'BEGIN{desk=1}{if(/^FILE LIST:$/){desk=0} else if (desk==0) {print}}' /var/log/packages/${pkg_filenames}* | less docmd awk 'BEGIN{desk=1}{if(/^FILE LIST:$/){desk=0} else if (desk==0) {print}}' /var/log/packages/${pkg_filenames}* | less
return return
;; ;;
......
...@@ -29,7 +29,7 @@ __epm_info_rpm_low() ...@@ -29,7 +29,7 @@ __epm_info_rpm_low()
} }
# TODO: separate to _files and _names parts # TODO: separate to _files and _names parts
# realize _files part per package, not by PMTYPE (see filelist) # implement _files part per package, not by PMTYPE (see filelist)
epm_info() epm_info()
{ {
......
...@@ -29,7 +29,7 @@ case $PMTYPE in ...@@ -29,7 +29,7 @@ case $PMTYPE in
docmd dpkg-query -W --showformat="\${Size}.\${Package}-\${Version}\n" $pkg_filenames | sort -n docmd dpkg-query -W --showformat="\${Size}.\${Package}-\${Version}\n" $pkg_filenames | sort -n
;; ;;
*) *)
fatal "Sorted package list are not realized for $PMTYPE" fatal "Sorted package list function is not implemented for $PMTYPE"
;; ;;
esac esac
} }
......
...@@ -118,7 +118,7 @@ __do_query() ...@@ -118,7 +118,7 @@ __do_query()
;; ;;
aptcyg) aptcyg)
#CMD="apt-cyg packageof" #CMD="apt-cyg packageof"
# do not realized locally # is not implemented locally
return 1 return 1
;; ;;
*) *)
......
#!/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,27 +17,19 @@ ...@@ -17,27 +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/>.
# #
__local_ercat() # TODO: see epm-search (colorify for all distro)
# args: index_lists word grep_string
__alt_search_file_output()
{ {
local i # grep only on left part (filename), then revert order and grep with color
for i in $* ; do __local_ercat $1 | grep -h -- ".*$2.*[[:space:]]" | sed -e "s|\(.*\)\t\(.*\)|\2: \1|g" $3
case "$i" in
*.xz)
xzcat $i
;;
*.lz4)
lz4cat $i
;;
*)
cat $i
;;
esac
done
} }
__alt_local_content_search() __alt_local_content_search()
{ {
load_helper epm-sh-altlinux load_helper epm-sh-altlinux
load_helper epm-search
info "Locate contents index file(s) ..." info "Locate contents index file(s) ..."
local CI="$(get_local_alt_contents_index)" local CI="$(get_local_alt_contents_index)"
...@@ -47,13 +39,12 @@ __alt_local_content_search() ...@@ -47,13 +39,12 @@ __alt_local_content_search()
info "Searching in" info "Searching in"
echo "$CI" echo "$CI"
echo "for $1... " echo "for $1... "
#[ -n "$USETTY" ] || OUTCMD="cat"
# OUTCMD="cat"
# { # FIXME: do it better
# note! tabulation below! local MGS
__local_ercat $CI | grep -h -- ".*$1.* " | sed -e "s|\(.*\)\t\(.*\)|\2: \1|g" MGS=$(eval __epm_search_make_grep $quoted_args)
# } | $OUTCMD showcmd "$ cat contents_index $MGS"
eval "__alt_search_file_output \"$CI\" \"$(eval get_firstarg $quoted_args)\" $MGS"
} }
epm_search_file() epm_search_file()
...@@ -72,12 +63,12 @@ case $PMTYPE in ...@@ -72,12 +63,12 @@ case $PMTYPE in
return ;; return ;;
yum-rpm) yum-rpm)
# TODO # TODO
info "Search by full packages list does not realized" info "Search by full packages list is not implemented yet"
CMD="yum provides" CMD="yum provides"
;; ;;
dnf-rpm) dnf-rpm)
# TODO # TODO
info "Search by full packages list does not realized" info "Search by full packages list is not implemented yet"
CMD="dnf provides" CMD="dnf provides"
;; ;;
urpm-rpm) urpm-rpm)
......
...@@ -25,21 +25,59 @@ get_local_alt_mirror_path() ...@@ -25,21 +25,59 @@ get_local_alt_mirror_path()
{ {
local DN1=$(dirname "$1") local DN1=$(dirname "$1")
local DN2=$(dirname $DN1) local DN2=$(dirname $DN1)
local DN3=$(dirname $DN2)
local BN0=$(basename "$1") # arch local BN0=$(basename "$1") # arch
local BN1=$(basename $DN1) # branch/Sisyphus local BN1=$(basename $DN1) # branch/Sisyphus
local BN2=$(basename $DN2) local BN2=$(basename $DN2) # p8/ALTLinux
local BN3=$(basename $DN3) # ALTLinux/
[ "$BN1" = "branch" ] && echo "/tmp/eepm/$BN2/$BN1/$BN0" || echo "/tmp/eepm/$BN1/$BN0" [ "$BN1" = "branch" ] && echo "/tmp/eepm/$BN3/$BN2/$BN1/$BN0" || echo "/tmp/eepm/$BN2/$BN1/$BN0"
} }
# args: url target_file __local_ercat()
{
local i
for i in $* ; do
case "$i" in
*.xz)
a= xzcat $i
;;
*.lz4)
a= lz4cat $i
;;
*.failed)
# just ignore
;;
*)
cat $i
;;
esac
done
}
# something like gzip
compress_file_inplace()
{
local OFILE="$1"
if epm assure lz4 </dev/null ; then
docmd lz4 --rm "$OFILE" "$OFILE.lz4" || return
else
epm assure xz </dev/null || return
docmd xz "$OFILE" || return
fi
return 0
}
# args: url/path target_file
# result: will set FILE # result: will set FILE
download_alt_contents_index() download_alt_contents_index()
{ {
local URL="$1"
local TD="$2" local TD="$2"
local OFILE="$TD/$(basename "$1")" local OFILE="$TD/$(basename "$URL")"
local DONE="$TD/done.$(basename "$1")"
local DONE=$(echo $OFILE*)
# TODO: check if too old # TODO: check if too old
if [ -r "$DONE" ] ; then if [ -r "$DONE" ] ; then
return return
...@@ -47,40 +85,26 @@ download_alt_contents_index() ...@@ -47,40 +85,26 @@ download_alt_contents_index()
mkdir -p "$TD" mkdir -p "$TD"
docmd eget -O "$OFILE" "$1" || return if echo "$URL" | grep -q "^file:/" ; then
# plain file by default URL=$(echo "$URL" | sed -e "s|^file:||")
echo "" >$DONE [ -s "$URL" ] || { touch $OFILE.failed ; return 1; }
ln -s "$URL" "$OFILE" || { touch $OFILE.failed ; return 1; }
# try compress
if epm assure lz4 ; then
docmd lz4 --rm "$OFILE" "$OFILE.lz4" || return
echo "lz4" >$DONE
else else
epm assure xz || return docmd eget -O "$OFILE" "$URL" || { rm -fv $OFILE ; touch $OFILE.failed ; return 1; }
docmd xz "$ofile" || return
echo "xz" >$DONE
fi fi
compress_file_inplace "$OFILE"
} }
get_local_alt_contents_index() get_local_alt_contents_index()
{ {
load_helper epm-repolist load_helper epm-repolist
# print out from local mirror local LOCALPATH
epm_repolist | grep "rpm.*file:/" | sed -e "s|^rpm.*file:||g" | while read LOCALPATH ARCH other ; do
test -d "$LOCALPATH/$ARCH" || continue
FILE="$LOCALPATH/$ARCH/base/contents_index"
if [ -r "$FILE" ] ; then
echo "$FILE"
else
info "TODO for girar server: There is no $(basename $FILE) file in $(dirname $FILE)"
fi
done
# print out from mirrored contents_index epm_repolist | grep -E "rpm.*(ftp://|http://|https://|file:/)" | sed -e "s@^rpm.*\(ftp://\|http://\|https://\|file:\)@\1@g" | while read URL ARCH other ; do
epm_repolist | grep -E "rpm[[:space:]]*(ftp|http|https)://" | sed -e "s@^rpm.*\(ftp\|http\|https://\)@\1@g" | while read URL ARCH other ; do
LOCALPATH=$(get_local_alt_mirror_path "$URL/$ARCH") LOCALPATH=$(get_local_alt_mirror_path "$URL/$ARCH")
download_alt_contents_index $URL/$ARCH/base/contents_index $LOCALPATH download_alt_contents_index $URL/$ARCH/base/contents_index $LOCALPATH || continue
echo "$LOCALPATH/contents_index*" echo "$LOCALPATH/contents_index*"
done done
......
...@@ -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/>.
# #
# TODO: will it has local only mode?
load_helper epm-print load_helper epm-print
epm_whatdepends() epm_whatdepends()
...@@ -44,6 +46,7 @@ case $PMTYPE in ...@@ -44,6 +46,7 @@ case $PMTYPE in
CMD="urpmq --whatrequires" CMD="urpmq --whatrequires"
;; ;;
dnf-rpm) dnf-rpm)
# check command: dnf repoquery --whatrequires
CMD="repoquery --whatrequires" CMD="repoquery --whatrequires"
;; ;;
emerge) emerge)
......
# 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.0.4 Version: 2.0.5
Release: alt0.M80P.1 Release: alt0.M80P.1
Summary: Etersoft EPM package manager Summary: Etersoft EPM package manager
...@@ -68,9 +68,14 @@ chmod a+x %buildroot%_datadir/%name/tools_* ...@@ -68,9 +68,14 @@ chmod a+x %buildroot%_datadir/%name/tools_*
%_sysconfdir/bash_completion.d/cerv %_sysconfdir/bash_completion.d/cerv
%changelog %changelog
* Thu Mar 09 2017 Vitaly Lipatov <lav@altlinux.ru> 2.0.4-alt0.M80P.1 * Fri Mar 10 2017 Vitaly Lipatov <lav@altlinux.ru> 2.0.5-alt0.M80P.1
- backport to ALTLinux p8 (by rpmbph script) - backport to ALTLinux p8 (by rpmbph script)
* Fri Mar 10 2017 Vitaly Lipatov <lav@altlinux.ru> 2.0.5-alt1
- epm sf: make compressed cache for local file too
- rewrite epm sf, colorify it
- more correct message when empty run
* Thu Mar 09 2017 Vitaly Lipatov <lav@altlinux.ru> 2.0.4-alt1 * Thu Mar 09 2017 Vitaly Lipatov <lav@altlinux.ru> 2.0.4-alt1
- epm-policy: move to hilevel package name - epm-policy: move to hilevel package name
- implement local cache for contents index for ALT repos - implement local cache for contents index for ALT repos
......
...@@ -451,7 +451,7 @@ case $DISTRNAME in ...@@ -451,7 +451,7 @@ case $DISTRNAME in
ArchLinux) ArchLinux)
CMD="pacman" CMD="pacman"
;; ;;
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific) Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific|GosLinux)
CMD="yum-rpm" CMD="yum-rpm"
which dnf 2>/dev/null >/dev/null && test -d /var/lib/dnf/yumdb && CMD=dnf-rpm which dnf 2>/dev/null >/dev/null && test -d /var/lib/dnf/yumdb && CMD=dnf-rpm
;; ;;
...@@ -507,8 +507,9 @@ is_active_systemd() ...@@ -507,8 +507,9 @@ is_active_systemd()
[ -x "$SYSTEMCTL" ] || return [ -x "$SYSTEMCTL" ] || return
[ -d "$SYSTEMD_CGROUP_DIR" ] || return [ -d "$SYSTEMD_CGROUP_DIR" ] || return
a= mountpoint -q "$SYSTEMD_CGROUP_DIR" || return a= mountpoint -q "$SYSTEMD_CGROUP_DIR" || return
readlink /sbin/init | grep -q 'systemd' || return
# some hack # some hack
ps ax | grep '[s]ystemd' | grep -v 'systemd-udev' >/dev/null ps ax | grep '[s]ystemd' | grep -q -v 'systemd-udev'
} }
# File bin/serv-common: # File bin/serv-common:
...@@ -1099,7 +1100,7 @@ if distro altlinux-release ; then ...@@ -1099,7 +1100,7 @@ if distro altlinux-release ; then
if has Sisyphus ; then DISTRIB_RELEASE="Sisyphus" if has Sisyphus ; then DISTRIB_RELEASE="Sisyphus"
elif has "ALT Linux 7." ; then DISTRIB_RELEASE="p7" elif has "ALT Linux 7." ; then DISTRIB_RELEASE="p7"
elif has "ALT Linux 8." ; then DISTRIB_RELEASE="p8" elif has "ALT Linux 8." ; then DISTRIB_RELEASE="p8"
elif has "ALT Workstation K 8." ; then DISTRIB_RELEASE="p8" elif has "ALT .*8.[0-9]" ; then DISTRIB_RELEASE="p8"
elif has "Simply Linux 6." ; then DISTRIB_RELEASE="p6" elif has "Simply Linux 6." ; then DISTRIB_RELEASE="p6"
elif has "Simply Linux 7." ; then DISTRIB_RELEASE="p7" elif has "Simply Linux 7." ; then DISTRIB_RELEASE="p7"
elif has "Simply Linux 8." ; then DISTRIB_RELEASE="p8" elif has "Simply Linux 8." ; then DISTRIB_RELEASE="p8"
...@@ -1695,7 +1696,7 @@ case $DISTRNAME in ...@@ -1695,7 +1696,7 @@ case $DISTRNAME in
ALTLinux) ALTLinux)
CMD="service-chkconfig" CMD="service-chkconfig"
;; ;;
Ubuntu|Debian|Mint) Ubuntu|Debian|Mint|AstraLinux)
CMD="service-update" CMD="service-update"
;; ;;
Mandriva|ROSA) Mandriva|ROSA)
...@@ -1710,7 +1711,7 @@ case $DISTRNAME in ...@@ -1710,7 +1711,7 @@ case $DISTRNAME in
# ArchLinux) # ArchLinux)
# CMD="pacman" # CMD="pacman"
# ;; # ;;
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific) Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific|GosLinux)
CMD="service-chkconfig" CMD="service-chkconfig"
;; ;;
VoidLinux) VoidLinux)
...@@ -1766,7 +1767,7 @@ $(get_help HELPOPT) ...@@ -1766,7 +1767,7 @@ $(get_help HELPOPT)
print_version() print_version()
{ {
echo "Service manager version 2.0.0" echo "Service manager version 2.0.5"
echo "Running on $($DISTRVENDOR) with $SERVICETYPE" echo "Running on $($DISTRVENDOR) with $SERVICETYPE"
echo "Copyright (c) Etersoft 2012, 2013, 2016" echo "Copyright (c) Etersoft 2012, 2013, 2016"
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."
......
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