Commit 0f23697b authored by Vitaly Lipatov's avatar Vitaly Lipatov

epm install/upgrade/download/downgrade: use temporary APT directory for tasks

parent 74638769
...@@ -89,16 +89,14 @@ __epm_downgrade_to_alt_archive() ...@@ -89,16 +89,14 @@ __epm_downgrade_to_alt_archive()
{ {
local date="$(echo "$1" | cut -d/ -f2)" local date="$(echo "$1" | cut -d/ -f2)"
shift shift
# normalize date: 2023-01-15 -> 2023/01/15
local datestr="$(echo "$date" | sed -e 's|-|/|g')"
echo "$datestr" | grep -qE "^20[0-3][0-9]/[01][0-9]/[0-3][0-9]$" || fatal "use follow date format: 2017/01/31 or 2017-01-31"
__epm_add_alt_apt_downgrade_preferences || return __epm_add_alt_apt_downgrade_preferences || return
load_helper epm-reposave load_helper epm-sh-backend
try_change_alt_repo
docmd epm repo set archive "$date" || return
load_helper epm-update
load_helper epm-upgrade load_helper epm-upgrade
__epm_update __use_tmp_apt_for_branch archive "$(echo "$DISTRVERSION" | tr '[:upper:]' '[:lower:]')" "$datestr" || return 1
epm_upgrade "$@" epm_upgrade "$@"
docmd epm repo restore
end_change_alt_repo
__epm_remove_apt_downgrade_preferences __epm_remove_apt_downgrade_preferences
return return
} }
......
...@@ -243,23 +243,21 @@ __epm_download_alt() ...@@ -243,23 +243,21 @@ __epm_download_alt()
# TODO: enable if install --download-only will works # TODO: enable if install --download-only will works
if is_taskarg "$@" ; then if is_taskarg "$@" ; then
load_helper epm-addrepo load_helper epm-sh-backend
load_helper epm-reposave local task_numbers=""
load_helper epm-removerepo local arg
load_helper epm-update for arg in "$@" ; do
load_helper epm-install local tn="$(get_tasknumber_from_arg "$arg")"
[ -n "$tn" ] && task_numbers="$task_numbers $tn"
done
local installlist="$(get_task_packages $*)" local installlist="$(get_task_packages $*)"
installlist="$(estrlist reg_exclude ".*-devel .*-devel-static .*-checkinstall .*-debuginfo" "$installlist")" installlist="$(estrlist reg_exclude ".*-devel .*-devel-static .*-checkinstall .*-debuginfo" "$installlist")"
[ -n "$verbose" ] && info 'Packages from task(s): $installlist' [ -n "$verbose" ] && info 'Packages from task(s): $installlist'
try_change_alt_repo __use_tmp_apt_for_tasks $task_numbers || return 1
epm_addrepo "$@" [ -n "$verbose" ] && cat "$__EPM_APT_TMPDIR/sources.list"
epm update epm_download $installlist
[ -n "$verbose" ] && epm repo list
docmd epm download $print_url $installlist
epm_removerepo "$@"
end_change_alt_repo
return return
fi fi
......
...@@ -272,6 +272,14 @@ epm_install_alt_kernel_module() ...@@ -272,6 +272,14 @@ epm_install_alt_kernel_module()
epm_install_alt_names() epm_install_alt_names()
{ {
[ -z "$1" ] && return
# check repo/package syntax (p10/pkg, sisyphus/pkg)
if __has_repo_syntax "$@" ; then
__process_repo_arguments epm_install_alt_names "$@"
return
fi
local kmlist='' local kmlist=''
local kilist='' local kilist=''
local installnames='' local installnames=''
...@@ -305,10 +313,13 @@ epm_install_alt_names() ...@@ -305,10 +313,13 @@ epm_install_alt_names()
epm_install_alt_kernel_module $kmlist || return epm_install_alt_kernel_module $kmlist || return
# install kernel images via update-kernel (handles modules automatically) # install kernel images via update-kernel (handles modules automatically)
local flavour if [ -n "$kilist" ] ; then
for flavour in $kilist ; do load_helper epm-kernel_update
docmd epm update-kernel -t "$flavour" || return local flavour
done for flavour in $kilist ; do
epm_kernel_update -t "$flavour" || return
done
fi
} }
# Unused hack for apt-repo # Unused hack for apt-repo
...@@ -368,10 +379,6 @@ prepare_task_packages() ...@@ -368,10 +379,6 @@ prepare_task_packages()
# copied from epm_upgrade_alt_tasks() # copied from epm_upgrade_alt_tasks()
epm_install_alt_tasks() epm_install_alt_tasks()
{ {
load_helper epm-addrepo
load_helper epm-reposave
load_helper epm-removerepo
load_helper epm-update
load_helper epm-install load_helper epm-install
prepare_task_packages "$@" prepare_task_packages "$@"
...@@ -399,16 +406,8 @@ epm_install_alt_tasks() ...@@ -399,16 +406,8 @@ epm_install_alt_tasks()
fi fi
local res local res
try_change_alt_repo __use_tmp_apt_for_tasks $unique_tasks || return 1
epm_addrepo $unique_tasks
__epm_update
(pkg_names="$installlist" epm_install) (pkg_names="$installlist" epm_install)
res=$? res=$?
# remove repos one by one (epm_removerepo doesn't handle lists)
local task
for task in $unique_tasks ; do
epm_removerepo $task
done
end_change_alt_repo
return $res return $res
} }
...@@ -203,7 +203,8 @@ __use_tmp_apt_for_tasks() ...@@ -203,7 +203,8 @@ __use_tmp_apt_for_tasks()
load_helper epm-update load_helper epm-update
__setup_tmp_apt_dir __setup_tmp_apt_dir
{ __get_system_sourceslist ; __generate_task_sourceslist "$@" ; } > "$__EPM_APT_TMPDIR/sources.list" { __get_system_sourceslist ; __generate_task_sourceslist "$@" ; } > "$__EPM_APT_TMPDIR/sources.list"
__epm_update || { warning "Failed to update package index for tasks" ; return 1 ; } # tolerate partial failures (some system repos may have broken GPG keys etc.)
__epm_update || warning "Some repos failed to update, but continuing anyway"
} }
# call: __process_repo_arguments <function> args... # call: __process_repo_arguments <function> args...
......
...@@ -39,10 +39,7 @@ __check_upgrade_conditions() ...@@ -39,10 +39,7 @@ __check_upgrade_conditions()
epm_upgrade_alt_tasks() epm_upgrade_alt_tasks()
{ {
load_helper epm-addrepo load_helper epm-sh-backend
load_helper epm-reposave
load_helper epm-removerepo
load_helper epm-update
load_helper epm-install load_helper epm-install
local installlist="$(get_task_packages "$@")" local installlist="$(get_task_packages "$@")"
...@@ -64,14 +61,17 @@ epm_upgrade_alt_tasks() ...@@ -64,14 +61,17 @@ epm_upgrade_alt_tasks()
return 22 return 22
fi fi
local task_numbers=""
local arg
for arg in "$@" ; do
local tn="$(get_tasknumber_from_arg "$arg")"
[ -n "$tn" ] && task_numbers="$task_numbers $tn"
done
local res local res
try_change_alt_repo __use_tmp_apt_for_tasks $task_numbers || return 1
epm_addrepo "$@"
__epm_update
(pkg_names="$installlist" epm_install) (pkg_names="$installlist" epm_install)
res=$? res=$?
epm_removerepo "$@"
end_change_alt_repo
return $res return $res
} }
...@@ -163,7 +163,7 @@ __epm_upgrade_do() ...@@ -163,7 +163,7 @@ __epm_upgrade_do()
__epm_alt_download_to_cache $APTOPTIONS dist-upgrade __epm_alt_download_to_cache $APTOPTIONS dist-upgrade
fi fi
CMD="apt-get $APTOPTIONS $noremove $force_yes dist-upgrade" CMD="apt-get $__EPM_APT_REPO_OPTIONS $APTOPTIONS $noremove $force_yes dist-upgrade"
;; ;;
apm-rpm) apm-rpm)
CMD="apm system upgrade" CMD="apm system upgrade"
......
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