Commit e6753fbd authored by Vitaly Lipatov's avatar Vitaly Lipatov

commit packed 3.9.1

parent e36dfc42
...@@ -2239,8 +2239,8 @@ epm_epm_install() { ...@@ -2239,8 +2239,8 @@ epm_epm_install() {
__alt_local_content_filelist() __alt_local_content_filelist()
{ {
local CI="$(get_local_alt_contents_index_rsync)" update_alt_contents_index
[ -n "$CI" ] || fatal "Have no local contents index. Check epm repo --help." local CI="$(cat $ALT_CONTENTS_INDEX_LIST)"
# TODO: safe way to use less # TODO: safe way to use less
#local OUTCMD="less" #local OUTCMD="less"
...@@ -6813,14 +6813,10 @@ __alt_search_file_output() ...@@ -6813,14 +6813,10 @@ __alt_search_file_output()
__alt_local_content_search() __alt_local_content_search()
{ {
info "Locate contents index file(s) ..." update_alt_contents_index
local CI="$(get_local_alt_contents_index_rsync)" local CI="$(cat $ALT_CONTENTS_INDEX_LIST)"
# TODO use something like
[ -n "$CI" ] || fatal "Have no local contents index. Check epm repo --help."
info "Searching in" info "Searching for $1 ... "
echo "$CI"
echo "for $1... "
# FIXME: do it better # FIXME: do it better
local MGS local MGS
...@@ -6889,6 +6885,39 @@ docmd $CMD $pkg_filenames ...@@ -6889,6 +6885,39 @@ docmd $CMD $pkg_filenames
# File bin/epm-sh-altlinux: # File bin/epm-sh-altlinux:
tasknumber()
{
local num="$(echo "$1" | sed -e "s| *#*||g")"
isnumber "$num" && echo "$*"
}
get_task_arepo_packages()
{
local res
epm assure apt-repo
epm assure curl
info "TODO: please, improve apt-repo to support arepo (i586-) packages for apt-repo list task"
showcmd "curl -s -f http://git.altlinux.org/tasks/$tn/plan/arepo-add-x86_64-i586 | cut -f1"
# TODO: retrieve one time
res="$(a='' curl -s -f http://git.altlinux.org/tasks/$tn/plan/arepo-add-x86_64-i586 2>/dev/null)" || { warning "There is a download error for x86_64-i586 arepo." ; return ; }
echo "$res" | cut -f1
}
get_task_packages()
{
local arch="$($DISTRVENDOR -a)"
local tn
for tn in $(tasknumber "$@") ; do
showcmd apt-repo list task "$tn"
a='' apt-repo list task "$tn" >/dev/null || continue
a='' apt-repo list task "$tn"
[ "$arch" = "x86_64" ] && get_task_arepo_packages "$tn"
done
}
# File bin/epm-sh-altlinux-contents-index:
get_alt_repo_path() get_alt_repo_path()
{ {
...@@ -6906,9 +6935,12 @@ get_alt_repo_path() ...@@ -6906,9 +6935,12 @@ get_alt_repo_path()
get_local_alt_mirror_path() get_local_alt_mirror_path()
{ {
echo "/tmp/eepm/$(get_alt_repo_path "$1")" # TODO: /var/cache/eepm
echo "$TMPDIR/eepm/$(get_alt_repo_path "$1")"
} }
ALT_CONTENTS_INDEX_LIST=$TMPDIR/eepm/contents_index_list
__local_ercat() __local_ercat()
{ {
local i local i
...@@ -6920,6 +6952,9 @@ __local_ercat() ...@@ -6920,6 +6952,9 @@ __local_ercat()
*.lz4) *.lz4)
a='' lz4cat $i a='' lz4cat $i
;; ;;
*.gz)
a='' zcat $i
;;
*.failed) *.failed)
# just ignore # just ignore
;; ;;
...@@ -6930,128 +6965,85 @@ __local_ercat() ...@@ -6930,128 +6965,85 @@ __local_ercat()
done done
} }
compress_file_inplace()
{
local OFILE="$1"
if epm assure lz4 </dev/null ; then
#docmd lz4 --rm "$OFILE" "$OFILE.lz4" || return
# due old lz4
docmd lz4 -f "$OFILE" "$OFILE.lz4" || return
rm -fv "$OFILE"
else
epm assure xz </dev/null || fatal "Can't install nor lz4, nor xz compressor"
docmd xz -f "$OFILE" || return
fi
return 0
}
download_alt_contents_index()
{
local URL="$1"
local TD="$2"
local OFILE="$TD/$(basename "$URL")"
local DONE=$(echo $OFILE*)
# TODO: check if too old
if [ -r "$DONE" ] ; then
return
fi
mkdir -p "$TD"
if echo "$URL" | grep -q "^file:/" ; then
URL=$(echo "$URL" | sed -e "s|^file:||")
[ -s "$URL" ] || { touch $OFILE.failed ; return 1; }
ln -sf "$URL" "$OFILE" || { touch $OFILE.failed ; return 1; }
else
docmd eget -O "$OFILE" "$URL" || { rm -fv $OFILE ; touch $OFILE.failed ; return 1; }
fi
rm -f $OFILE.failed
compress_file_inplace "$OFILE"
}
rsync_alt_contents_index() rsync_alt_contents_index()
{ {
local URL="$1" local URL="$1"
local TD="$2" local TD="$2"
assure_exists rsync assure_exists rsync
a= rsync --partial --inplace -z -av --progress "$URL" "$TD" mkdir -p "$(dirname "$TD")"
test -s "$TD" if [ -n "$verbose" ] ; then
docmd rsync --partial --inplace -z -a --progress "$URL" "$TD"
else
a= rsync --partial --inplace -z -a --progress "$URL" "$TD" >/dev/null 2>/dev/null
fi
} }
get_url_to_etersoft_mirror() get_url_to_etersoft_mirror()
{ {
local REPOPATH local REPOPATH
local ETERSOFT_MIRROR="rsync://download.etersoft.ru/pub" local ETERSOFT_MIRROR="rsync://download.etersoft.ru/pub"
local ALTREPO=$(get_alt_repo_path "$1")
echo "$ALTREPO" | grep -q "^ALTLinux" || return
echo "$ETERSOFT_MIRROR/$(get_alt_repo_path "$1" | sed -e "s|^ALTLinux/|ALTLinux/contents_index/|")" echo "$ETERSOFT_MIRROR/$(get_alt_repo_path "$1" | sed -e "s|^ALTLinux/|ALTLinux/contents_index/|")"
} }
get_local_alt_contents_index_rsync() __init_contents_index_list()
{ {
mkdir -p "$(dirname $ALT_CONTENTS_INDEX_LIST)"
# TODO: fix for Etersoft/LINUX@Etersoft truncate -s0 $ALT_CONTENTS_INDEX_LIST
epm_repolist | grep -v " task$" | grep -E "rpm.*(ftp://|http://|https://|file:/)" | sed -e "s@^rpm.*\(ftp://\|http://\|https://\|file:\)@\1@g" | while read -r URL ARCH other ; do
if echo "$URL" | grep -q "^file:/" ; then
# first check for local mirror
local LOCALPATH="$(echo "$URL" | sed -e "s|^file:||")/$ARCH/base"
local LOCALPATHGZIP="$(echo "$LOCALPATH" | sed -e "s|/ALTLinux/|/ALTLinux/contents_index/|")"
[ -s "$LOCALPATHGZIP/contents_index.gz" ] && echo "$LOCALPATHGZIP/contents_index.gz" && continue
[ -s "$LOCALPATH/contents_index" ] && echo "$LOCALPATH/contents_index"
else
local LOCALPATH="$(get_local_alt_mirror_path "$URL/$ARCH")"
local REMOTEURL="$(get_url_to_etersoft_mirror "$URL/$ARCH")/base"
rsync_alt_contents_index $REMOTEURL/contents_index.gz $LOCALPATH/contents_index.gz >/dev/null 2>/dev/null </dev/null && echo "$LOCALPATH/contents_index.gz" && continue
[ -n "$verbose" ] && info "Note: Can't retrieve $REMOTEURL/contents_index.gz, fallback to $URL/$ARCH/base/contents_index"
rsync_alt_contents_index $URL/$ARCH/base/contents_index $LOCALPATH/contents_index >/dev/null 2>/dev/null </dev/null && echo "$LOCALPATH/contents_index" && continue
fi
done
} }
get_local_alt_contents_index() __add_to_contents_index_list()
{ {
echo " $1 -> $2"
local LOCALPATH echo "$2" >>$ALT_CONTENTS_INDEX_LIST
epm_repolist | grep -v " task$" | grep -E "rpm.*(ftp://|http://|https://|file:/)" | sed -e "s@^rpm.*\(ftp://\|http://\|https://\|file:\)@\1@g" | while read -r URL ARCH other ; do
LOCALPATH=$(get_local_alt_mirror_path "$URL/$ARCH")
download_alt_contents_index $URL/$ARCH/base/contents_index $LOCALPATH >&2 </dev/null || continue
echo "$LOCALPATH/contents_index*"
done
} }
__add_better_to_contents_index_list()
tasknumber()
{ {
local num="$(echo "$1" | sed -e "s| *#*||g")" if [ -s "$2" ] && [ -s "$3" ] ; then
isnumber "$num" && echo "$*" [ "$2" -ot "$3" ] && __add_to_contents_index_list "$1" "$3" && return
__add_to_contents_index_list "$1" "$2" && return
fi
[ -s "$2" ] && __add_to_contents_index_list "$1" "$2" && return
[ -s "$3" ] && __add_to_contents_index_list "$1" "$3" && return
} }
get_task_arepo_packages()
{
local res
epm assure apt-repo
epm assure curl
info "TODO: please, improve apt-repo to support arepo (i586-) packages for apt-repo list task" update_alt_contents_index()
showcmd "curl -s -f http://git.altlinux.org/tasks/$tn/plan/arepo-add-x86_64-i586 | cut -f1"
# TODO: retrieve one time
res="$(a='' curl -s -f http://git.altlinux.org/tasks/$tn/plan/arepo-add-x86_64-i586 2>/dev/null)" || { warning "There is a download error for x86_64-i586 arepo." ; return ; }
echo "$res" | cut -f1
}
get_task_packages()
{ {
local arch="$($DISTRVENDOR -a)" __init_contents_index_list
local tn # TODO: fix for Etersoft/LINUX@Etersoft
for tn in $(tasknumber "$@") ; do # TODO: fix for rsync
showcmd apt-repo list task "$tn" info "Retrieving contents_index ..."
a='' apt-repo list task "$tn" >/dev/null || continue epm_repolist | grep -v " task$" | grep -E "rpm.*(ftp://|http://|https://|rsync://|file:/)" | sed -e "s@^rpm.*\(ftp://\|http://\|https://\)@rsync://@g" | sed -e "s@^rpm.*\(file:\)@@g" | while read -r URL1 URL2 component ; do
a='' apt-repo list task "$tn" [ "$component" = "debuginfo" ] && continue
[ "$arch" = "x86_64" ] && get_task_arepo_packages "$tn" URL="$URL1/$URL2"
if echo "$URL" | grep -q "^/" ; then
# first check for local mirror
local LOCALPATH="$(echo "$URL/base")"
local LOCALPATHGZIP="$(echo "$LOCALPATH" | sed -e "s|/ALTLinux/|/ALTLinux/contents_index/|")"
__add_better_to_contents_index_list "$URL" "$LOCALPATHGZIP/contents_index.gz" "$LOCALPATH/contents_index"
else
local LOCALPATH="$(get_local_alt_mirror_path "$URL")"
local REMOTEURL="$(get_url_to_etersoft_mirror "$URL")"
if [ -n "$REMOTEURL" ] ; then
rsync_alt_contents_index $REMOTEURL/base/contents_index.gz $LOCALPATH/contents_index.gz && __add_to_contents_index_list "$REMOTEURL" "$LOCALPATH/contents_index.gz" && continue
[ -n "$verbose" ] && info "Note: Can't retrieve $REMOTEURL/base/contents_index.gz, fallback to $URL/base/contents_index"
fi
# fix rsync URL firstly
local RSYNCURL="$(echo "$URL" | sed -e "s|rsync://\(ftp.basealt.ru\|basealt.org\|altlinux.ru\)/pub/distributions/ALTLinux|rsync://\1/ALTLinux|")" #"
rsync_alt_contents_index $RSYNCURL/base/contents_index $LOCALPATH/contents_index && __add_to_contents_index_list "$RSYNCURL" "$LOCALPATH/contents_index" && continue
__add_better_to_contents_index_list "(cached)" "$LOCALPATH/contents_index.gz" "$LOCALPATH/contents_index"
fi
done done
if [ ! -s "$ALT_CONTENTS_INDEX_LIST" ] ; then
fatal "Have no local contents index. Check epm repo --help."
fi
} }
# File bin/epm-sh-install: # File bin/epm-sh-install:
...@@ -9365,7 +9357,7 @@ Examples: ...@@ -9365,7 +9357,7 @@ Examples:
print_version() print_version()
{ {
echo "EPM package manager version 3.9.0 https://wiki.etersoft.ru/Epm" echo "EPM package manager version 3.9.1 https://wiki.etersoft.ru/Epm"
echo "Running on $($DISTRVENDOR -e) ('$PMTYPE' package manager uses '$PKGFORMAT' package format)" echo "Running on $($DISTRVENDOR -e) ('$PMTYPE' package manager uses '$PKGFORMAT' package format)"
echo "Copyright (c) Etersoft 2012-2020" echo "Copyright (c) Etersoft 2012-2020"
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."
...@@ -9375,7 +9367,7 @@ print_version() ...@@ -9375,7 +9367,7 @@ print_version()
Usage="Usage: epm [options] <command> [package name(s), package files]..." Usage="Usage: epm [options] <command> [package name(s), package files]..."
Descr="epm - EPM package manager" Descr="epm - EPM package manager"
EPMVERSION=3.9.0 EPMVERSION=3.9.1
verbose= verbose=
quiet= quiet=
nodeps= nodeps=
......
...@@ -2800,7 +2800,7 @@ print_version() ...@@ -2800,7 +2800,7 @@ print_version()
local on_text="(host system)" local on_text="(host system)"
local virt="$($DISTRVENDOR -i)" local virt="$($DISTRVENDOR -i)"
[ "$virt" = "(unknown)" ] || [ "$virt" = "(host system)" ] || on_text="(under $virt)" [ "$virt" = "(unknown)" ] || [ "$virt" = "(host system)" ] || on_text="(under $virt)"
echo "Service manager version 3.9.0 https://wiki.etersoft.ru/Epm" echo "Service manager version 3.9.1 https://wiki.etersoft.ru/Epm"
echo "Running on $($DISTRVENDOR -e) $on_text with $SERVICETYPE" echo "Running on $($DISTRVENDOR -e) $on_text with $SERVICETYPE"
echo "Copyright (c) Etersoft 2012-2019" echo "Copyright (c) Etersoft 2012-2019"
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