Commit df821445 authored by Vitaly Lipatov's avatar Vitaly Lipatov

epm filelist/search-file: move content index update to epm update

parent 94f1e3bd
...@@ -29,7 +29,8 @@ __alt_local_content_filelist() ...@@ -29,7 +29,8 @@ __alt_local_content_filelist()
load_helper epm-sh-altlinux load_helper epm-sh-altlinux
load_helper epm-sh-altlinux-contents-index load_helper epm-sh-altlinux-contents-index
update_alt_contents_index check_alt_contents_index || init_alt_contents_index
update_repo_if_needed
local CI="$(cat $ALT_CONTENTS_INDEX_LIST)" local CI="$(cat $ALT_CONTENTS_INDEX_LIST)"
# TODO: safe way to use less or bat # TODO: safe way to use less or bat
......
...@@ -32,7 +32,9 @@ __alt_local_content_search() ...@@ -32,7 +32,9 @@ __alt_local_content_search()
load_helper epm-sh-altlinux-contents-index load_helper epm-sh-altlinux-contents-index
load_helper epm-search load_helper epm-search
update_alt_contents_index check_alt_contents_index || init_alt_contents_index
update_repo_if_needed
local CI="$(cat $ALT_CONTENTS_INDEX_LIST)" local CI="$(cat $ALT_CONTENTS_INDEX_LIST)"
info "Searching for $1 ... " info "Searching for $1 ... "
...@@ -49,11 +51,15 @@ epm_search_file() ...@@ -49,11 +51,15 @@ epm_search_file()
local CMD local CMD
[ -n "$pkg_filenames" ] || fatal "Search file: file name is missed" [ -n "$pkg_filenames" ] || fatal "Search file: file name is missed"
case $PMTYPE in case $BASEDISTRNAME in
apt-rpm) "alt")
__alt_local_content_search $pkg_filenames __alt_local_content_search $pkg_filenames
return ;; return ;;
esac
case $PMTYPE in
apt-dpkg|aptitude-dpkg) apt-dpkg|aptitude-dpkg)
# move to update?
assure_exists apt-file assure_exists apt-file
sudocmd apt-file update sudocmd apt-file update
docmd apt-file search $pkg_filenames docmd apt-file search $pkg_filenames
......
...@@ -38,14 +38,10 @@ get_alt_repo_path() ...@@ -38,14 +38,10 @@ get_alt_repo_path()
# convert "http://download.etersoft.ru/pub/ALTLinux/p8/branch x86_64" to /tmp/epm/ALTLinux/p8/branch/x86_64 # convert "http://download.etersoft.ru/pub/ALTLinux/p8/branch x86_64" to /tmp/epm/ALTLinux/p8/branch/x86_64
get_local_alt_mirror_path() get_local_alt_mirror_path()
{ {
# FIXME: by some reason missed in ALT docker image (no login?) echo "$epm_cachedir/contents_index/$(get_alt_repo_path "$1")"
[ -n "$TMPDIR" ] || TMPDIR=/tmp
# TODO: /var/cache/eepm
echo "$TMPDIR/eepm/$(get_alt_repo_path "$1")"
} }
ALT_CONTENTS_INDEX_LIST=$TMPDIR/eepm/contents_index_list ALT_CONTENTS_INDEX_LIST=$epm_cachedir/contents_index/contents_index_list
# URL TARGETDIR OPTIONS # URL TARGETDIR OPTIONS
rsync_alt_contents_index() rsync_alt_contents_index()
...@@ -71,12 +67,6 @@ get_url_to_etersoft_mirror() ...@@ -71,12 +67,6 @@ get_url_to_etersoft_mirror()
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/|")"
} }
__init_contents_index_list()
{
mkdir -p "$(dirname $ALT_CONTENTS_INDEX_LIST)"
truncate -s0 $ALT_CONTENTS_INDEX_LIST
}
# "comment" "file" # "comment" "file"
__add_to_contents_index_list() __add_to_contents_index_list()
{ {
...@@ -96,11 +86,25 @@ __add_better_to_contents_index_list() ...@@ -96,11 +86,25 @@ __add_better_to_contents_index_list()
} }
check_alt_contents_index()
{
[ -f "$ALT_CONTENTS_INDEX_LIST" ]
}
init_alt_contents_index()
{
sudocmd mkdir -p "$(dirname $ALT_CONTENTS_INDEX_LIST)"
sudocmd chmod a+rw "$(dirname $ALT_CONTENTS_INDEX_LIST)"
sudocmd truncate -s0 $ALT_CONTENTS_INDEX_LIST
sudocmd chmod a+rw $ALT_CONTENTS_INDEX_LIST
update_alt_contents_index
}
# fills ALT_CONTENTS_INDEX_LIST # fills ALT_CONTENTS_INDEX_LIST
update_alt_contents_index() update_alt_contents_index()
{ {
load_helper epm-repolist load_helper epm-repolist
__init_contents_index_list check_alt_contents_index || return
# TODO: fix for Etersoft/LINUX@Etersoft # TODO: fix for Etersoft/LINUX@Etersoft
# TODO: fix for rsync # TODO: fix for rsync
info "Retrieving contents_index ..." info "Retrieving contents_index ..."
......
...@@ -47,7 +47,7 @@ __save_available_packages() ...@@ -47,7 +47,7 @@ __save_available_packages()
{ {
[ -d "$epm_vardir" ] || return 0 [ -d "$epm_vardir" ] || return 0
info "Retrieve all available packages (for autocompletion) ..." info "Retrieving list of all available packages (for autocompletion) ..."
load_helper epm-list_available load_helper epm-list_available
short=--short epm_list_available | sort | sudorun tee $epm_vardir/available-packages >/dev/null short=--short epm_list_available | sort | sudorun tee $epm_vardir/available-packages >/dev/null
} }
...@@ -61,8 +61,8 @@ epm_update() ...@@ -61,8 +61,8 @@ epm_update()
local ret=0 local ret=0
warmup_hibase warmup_hibase
case $PMTYPE in case $BASEDISTRNAME in
apt-rpm) "alt")
# TODO: hack against cd to cwd in apt-get on ALT # TODO: hack against cd to cwd in apt-get on ALT
cd / cd /
sudocmd apt-get update sudocmd apt-get update
...@@ -71,6 +71,27 @@ case $PMTYPE in ...@@ -71,6 +71,27 @@ case $PMTYPE in
[ "$ret" = "0" ] || return [ "$ret" = "0" ] || return
__check_for_epm_version __check_for_epm_version
#sudocmd apt-get -f install || exit #sudocmd apt-get -f install || exit
__epm_touch_pkg
__save_available_packages
load_helper epm-sh-altlinux-contents-index
init_alt_contents_index
return $ret
;;
esac
case $PMTYPE in
apt-rpm)
# TODO: hack against cd to cwd in apt-get on ALT
cd /
sudocmd apt-get update
ret="$?"
cd - >/dev/null
[ "$ret" = "0" ] || return
;; ;;
apt-dpkg) apt-dpkg)
sudocmd apt-get update || return sudocmd apt-get update || return
......
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