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")
if [ -z "$epm_cmd" ] ; then
print_version
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
# Use eatmydata for write specific operations
......
#!/bin/sh
#
# Copyright (C) 2012-2016 Etersoft
# Copyright (C) 2012-2016 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012-2017 Etersoft
# Copyright (C) 2012-2017 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
......@@ -37,7 +37,7 @@ __alt_local_content_filelist()
{
[ -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
}
......@@ -64,7 +64,7 @@ __epm_filelist_remote()
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
}
......@@ -134,7 +134,7 @@ __epm_filelist_name()
return
;;
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
return
;;
......
......@@ -29,7 +29,7 @@ __epm_info_rpm_low()
}
# 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()
{
......
......@@ -29,7 +29,7 @@ case $PMTYPE in
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
}
......
......@@ -118,7 +118,7 @@ __do_query()
;;
aptcyg)
#CMD="apt-cyg packageof"
# do not realized locally
# is not implemented locally
return 1
;;
*)
......
#!/bin/sh
#
# Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012, 2016 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2016, 2017 Etersoft
# Copyright (C) 2012, 2016, 2017 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
......@@ -17,27 +17,19 @@
# 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
for i in $* ; do
case "$i" in
*.xz)
xzcat $i
;;
*.lz4)
lz4cat $i
;;
*)
cat $i
;;
esac
done
# grep only on left part (filename), then revert order and grep with color
__local_ercat $1 | grep -h -- ".*$2.*[[:space:]]" | sed -e "s|\(.*\)\t\(.*\)|\2: \1|g" $3
}
__alt_local_content_search()
{
load_helper epm-sh-altlinux
load_helper epm-search
info "Locate contents index file(s) ..."
local CI="$(get_local_alt_contents_index)"
......@@ -47,13 +39,12 @@ __alt_local_content_search()
info "Searching in"
echo "$CI"
echo "for $1... "
#[ -n "$USETTY" ] || OUTCMD="cat"
# OUTCMD="cat"
# {
# note! tabulation below!
__local_ercat $CI | grep -h -- ".*$1.* " | sed -e "s|\(.*\)\t\(.*\)|\2: \1|g"
# } | $OUTCMD
# FIXME: do it better
local MGS
MGS=$(eval __epm_search_make_grep $quoted_args)
showcmd "$ cat contents_index $MGS"
eval "__alt_search_file_output \"$CI\" \"$(eval get_firstarg $quoted_args)\" $MGS"
}
epm_search_file()
......@@ -72,12 +63,12 @@ case $PMTYPE in
return ;;
yum-rpm)
# TODO
info "Search by full packages list does not realized"
info "Search by full packages list is not implemented yet"
CMD="yum provides"
;;
dnf-rpm)
# TODO
info "Search by full packages list does not realized"
info "Search by full packages list is not implemented yet"
CMD="dnf provides"
;;
urpm-rpm)
......
......@@ -25,21 +25,59 @@ get_local_alt_mirror_path()
{
local DN1=$(dirname "$1")
local DN2=$(dirname $DN1)
local DN3=$(dirname $DN2)
local BN0=$(basename "$1") # arch
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
download_alt_contents_index()
{
local URL="$1"
local TD="$2"
local OFILE="$TD/$(basename "$1")"
local DONE="$TD/done.$(basename "$1")"
local OFILE="$TD/$(basename "$URL")"
local DONE=$(echo $OFILE*)
# TODO: check if too old
if [ -r "$DONE" ] ; then
return
......@@ -47,40 +85,26 @@ download_alt_contents_index()
mkdir -p "$TD"
docmd eget -O "$OFILE" "$1" || return
# plain file by default
echo "" >$DONE
# try compress
if epm assure lz4 ; then
docmd lz4 --rm "$OFILE" "$OFILE.lz4" || return
echo "lz4" >$DONE
if echo "$URL" | grep -q "^file:/" ; then
URL=$(echo "$URL" | sed -e "s|^file:||")
[ -s "$URL" ] || { touch $OFILE.failed ; return 1; }
ln -s "$URL" "$OFILE" || { touch $OFILE.failed ; return 1; }
else
epm assure xz || return
docmd xz "$ofile" || return
echo "xz" >$DONE
docmd eget -O "$OFILE" "$URL" || { rm -fv $OFILE ; touch $OFILE.failed ; return 1; }
fi
compress_file_inplace "$OFILE"
}
get_local_alt_contents_index()
{
load_helper epm-repolist
# print out from local mirror
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
local LOCALPATH
# print out from mirrored contents_index
epm_repolist | grep -E "rpm[[:space:]]*(ftp|http|https)://" | sed -e "s@^rpm.*\(ftp\|http\|https://\)@\1@g" | while read URL ARCH other ; do
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
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*"
done
......
......@@ -17,6 +17,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# TODO: will it has local only mode?
load_helper epm-print
epm_whatdepends()
......@@ -44,6 +46,7 @@ case $PMTYPE in
CMD="urpmq --whatrequires"
;;
dnf-rpm)
# check command: dnf repoquery --whatrequires
CMD="repoquery --whatrequires"
;;
emerge)
......
# This spec is backported to ALTLinux p8 automatically by rpmbph script from etersoft-build-utils.
#
Name: eepm
Version: 2.0.4
Version: 2.0.5
Release: alt0.M80P.1
Summary: Etersoft EPM package manager
......@@ -68,9 +68,14 @@ chmod a+x %buildroot%_datadir/%name/tools_*
%_sysconfdir/bash_completion.d/cerv
%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)
* 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
- epm-policy: move to hilevel package name
- implement local cache for contents index for ALT repos
......
......@@ -451,7 +451,7 @@ case $DISTRNAME in
ArchLinux)
CMD="pacman"
;;
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific)
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific|GosLinux)
CMD="yum-rpm"
which dnf 2>/dev/null >/dev/null && test -d /var/lib/dnf/yumdb && CMD=dnf-rpm
;;
......@@ -507,8 +507,9 @@ is_active_systemd()
[ -x "$SYSTEMCTL" ] || return
[ -d "$SYSTEMD_CGROUP_DIR" ] || return
a= mountpoint -q "$SYSTEMD_CGROUP_DIR" || return
readlink /sbin/init | grep -q 'systemd' || return
# 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:
......@@ -1099,7 +1100,7 @@ if distro altlinux-release ; then
if has Sisyphus ; then DISTRIB_RELEASE="Sisyphus"
elif has "ALT Linux 7." ; then DISTRIB_RELEASE="p7"
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 7." ; then DISTRIB_RELEASE="p7"
elif has "Simply Linux 8." ; then DISTRIB_RELEASE="p8"
......@@ -1695,7 +1696,7 @@ case $DISTRNAME in
ALTLinux)
CMD="service-chkconfig"
;;
Ubuntu|Debian|Mint)
Ubuntu|Debian|Mint|AstraLinux)
CMD="service-update"
;;
Mandriva|ROSA)
......@@ -1710,7 +1711,7 @@ case $DISTRNAME in
# ArchLinux)
# CMD="pacman"
# ;;
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific)
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific|GosLinux)
CMD="service-chkconfig"
;;
VoidLinux)
......@@ -1766,7 +1767,7 @@ $(get_help HELPOPT)
print_version()
{
echo "Service manager version 2.0.0"
echo "Service manager version 2.0.5"
echo "Running on $($DISTRVENDOR) with $SERVICETYPE"
echo "Copyright (c) Etersoft 2012, 2013, 2016"
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