Commit 98ce0d60 authored by Vitaly Lipatov's avatar Vitaly Lipatov

epm-release_upgrade: drop signs if there are unknown vendor ID during update from repo

parent 8f2f68a3
......@@ -81,22 +81,29 @@ __replace_alt_version_in_repo()
docmd apt-repo list
}
__alt_replace_sign_name()
{
local TO="$1"
__replace_text_in_alt_repo "/^ *#/! s!\[alt\]!$TO!g"
__replace_text_in_alt_repo "/^ *#/! s!\[sisyphus\]!$TO!g"
__replace_text_in_alt_repo "/^ *#/! s!\[updates\]!$TO!g"
__replace_text_in_alt_repo "/^ *#/! s!\[cert[789]\]!$TO!g"
__replace_text_in_alt_repo "/^ *#/! s!\[[tpc][6-9]\.?[0-9]?\]!$TO!g"
}
__alt_repofix()
{
local TO="$1"
epm --quiet repo fix >/dev/null
# TODO: switch it in repo code
TO="$(__repofix_filter_vendor "$TO")"
# replace sign name
if [ -n "$TO" ] ; then
__replace_text_in_alt_repo "/^ *#/! s!\[alt\]![$TO]!g"
__replace_text_in_alt_repo "/^ *#/! s!\[sisyphus\]![$TO]!g"
__replace_text_in_alt_repo "/^ *#/! s!\[updates\]![$TO]!g"
__replace_text_in_alt_repo "/^ *#/! s!\[[tpc][6-9]\.?[0-9]?\]![$TO]!g"
# TODO: switch it in repo code
TO="$(__repofix_filter_vendor "$TO")"
__alt_replace_sign_name "[$TO]"
fi
}
__get_conflict_release_pkg()
{
epm qf --quiet --short /etc/fedora-release | head -n1
......@@ -177,6 +184,15 @@ __check_system()
fi
}
__epm_ru_update()
{
docmd epm update && return
epm update 2>&1 | grep "E: Unknown vendor ID" || return
info "Drop vendor signs"
__alt_replace_sign_name ""
docmd epm update
}
get_next_release()
{
local FROM="$1"
......@@ -214,7 +230,7 @@ __switch_alt_to_distro()
confirm_info "Upgrade $DISTRNAME from $FROM to $TO ..."
docmd epm install rpm apt "$(get_fix_release_pkg "$FROM")" || fatal
__switch_repo_to $TO
docmd epm update || fatal
__epm_ru_update || fatal
docmd epm install rpm apt "$(get_fix_release_pkg --force "$TO")" || fatal "Check an error and run epm release-upgrade again"
docmd epm upgrade || fatal "Check an error and run epm release-upgrade again"
docmd epm update-kernel
......@@ -225,7 +241,7 @@ __switch_alt_to_distro()
confirm_info "Upgrade $DISTRNAME from $FROM to $TO ..."
docmd epm install rpm apt "$(get_fix_release_pkg "$FROM")" || fatal
__switch_repo_to $TO
docmd epm update || fatal
__epm_ru_update || fatal
docmd epm install rpm apt "$(get_fix_release_pkg --force "$TO")" || fatal "Check an error and run epm release-upgrade again"
__check_system
docmd epm upgrade || fatal "Check an error and run epm release-upgrade again"
......@@ -236,7 +252,7 @@ __switch_alt_to_distro()
confirm_info "Upgrade $DISTRNAME from $FROM to $TO ..."
docmd epm install rpm apt "$(get_fix_release_pkg "$FROM")" || fatal
__switch_repo_to $TO
docmd epm update || fatal
__epm_ru_update || fatal
docmd epm install rpm apt "$(get_fix_release_pkg --force "$TO")" || fatal "Check an error and run epm release-upgrade again"
__check_system
docmd epm upgrade || fatal "Check an error and run epm release-upgrade again"
......@@ -247,7 +263,7 @@ __switch_alt_to_distro()
confirm_info "Upgrade $DISTRNAME from $FROM to $TO ..."
docmd epm install rpm apt "$(get_fix_release_pkg "$FROM")" || fatal
__switch_repo_to $TO
docmd epm update || fatal
__epm_ru_update || fatal
docmd epm install rpm apt "$(get_fix_release_pkg --force "$TO")" || fatal "Check an error and run epm release-upgrade again"
__check_system
if epm installed libcrypt >/dev/null ; then
......@@ -265,7 +281,7 @@ __switch_alt_to_distro()
info "Workaround for https://bugzilla.altlinux.org/show_bug.cgi?id=35492 ..."
docmd epm remove gdb || fatal
__switch_repo_to $TO
docmd epm update || fatal
__epm_ru_update || fatal
__check_system
docmd epm upgrade || fatal "Check an error and run epm release-upgrade again"
docmd epm install rpm apt "$(get_fix_release_pkg --force "$TO")" || fatal "Check an error and run epm release-upgrade again"
......@@ -276,7 +292,7 @@ __switch_alt_to_distro()
confirm_info "Downgrade $DISTRNAME from $FROM to $TO ..."
docmd epm install "$(get_fix_release_pkg "$FROM")" || fatal
__switch_repo_to $TO
docmd epm update || fatal
__epm_ru_update || fatal
docmd epm downgrade rpm apt "$(get_fix_release_pkg --force "$TO")" || fatal "Check an error and run epm release-upgrade again"
__check_system
if epm installed libcrypt >/dev/null ; then
......@@ -291,7 +307,7 @@ __switch_alt_to_distro()
confirm_info "Downgrade $DISTRNAME from $FROM to $TO ..."
docmd epm install "$(get_fix_release_pkg "$FROM")" || fatal
__switch_repo_to $TO
docmd epm update || fatal
__epm_ru_update || fatal
docmd epm downgrade rpm apt "$(get_fix_release_pkg --force "$TO")" || fatal "Check an error and run epm release-upgrade again"
__check_system
#if epm installed libcrypt >/dev/null ; then
......@@ -306,7 +322,7 @@ __switch_alt_to_distro()
confirm_info "Downgrade $DISTRNAME from $FROM to $TO ..."
docmd epm install "$(get_fix_release_pkg "$FROM")" || fatal
__switch_repo_to $TO
docmd epm update || fatal
__epm_ru_update || fatal
docmd epm install rpm apt "$(get_fix_release_pkg --force "$TO")" || fatal "Check an error and run epm release-upgrade again"
__check_system
docmd epm downgrade
......@@ -319,7 +335,7 @@ __switch_alt_to_distro()
docmd epm upgrade || fatal
__replace_alt_version_in_repo "$FROM/branch/" "$TO/"
__alt_repofix "sisyphus"
docmd epm update || fatal
__epm_ru_update || fatal
docmd epm install rpm apt "$(get_fix_release_pkg --force "$TO")" || fatal "Check an error and run epm release-upgrade again"
#local ADDPKG
#ADDPKG=$(epm -q --short make-initrd sssd-ad 2>/dev/null)
......@@ -353,7 +369,7 @@ epm_release_upgrade()
case $DISTRNAME in
ALTLinux)
docmd epm update || fatal
__epm_ru_update || fatal
# try to detect current release by repo
if [ "$DISTRVERSION" = "Sisyphus" ] || [ -z "$DISTRVERSION" ] ; then
......
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