Commit acd36d79 authored by Vitaly Lipatov's avatar Vitaly Lipatov

epm-repofix: rewrite, update for p11/c10f?

parent 4180f8a4
...@@ -50,7 +50,10 @@ __repofix_filter_vendor() ...@@ -50,7 +50,10 @@ __repofix_filter_vendor()
br="cert8" br="cert8"
;; ;;
c9*) c9*)
br="cert9" br="cert8"
;;
c10*)
br="cert8"
;; ;;
Sisyphus) Sisyphus)
br="alt" br="alt"
...@@ -80,8 +83,7 @@ __alt_replace_sign_name() ...@@ -80,8 +83,7 @@ __alt_replace_sign_name()
__replace_text_in_alt_repo "/^ *#/! s!\[sisyphus\]!$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!\[updates\]!$TO!g"
__replace_text_in_alt_repo "/^ *#/! s!\[cert[789]\]!$TO!g" __replace_text_in_alt_repo "/^ *#/! s!\[cert[789]\]!$TO!g"
__replace_text_in_alt_repo "/^ *#/! s!\[p10\.?[0-9]?\]!$TO!g" __replace_text_in_alt_repo "/^ *#/! s!\[[tcp][1-3]?[6-90][.f]?[0-9]?\]!$TO!g"
__replace_text_in_alt_repo "/^ *#/! s!\[[tpc][6-9]\.?[0-9]?\]!$TO!g"
} }
__alt_repofix() __alt_repofix()
...@@ -95,6 +97,8 @@ __alt_repofix() ...@@ -95,6 +97,8 @@ __alt_repofix()
fi fi
} }
__alt_branch_reg='[tcp][1-3]?[6-90][.f]?[0-9]?'
#__switch_repo_to() #__switch_repo_to()
epm_reposwitch() epm_reposwitch()
{ {
...@@ -102,22 +106,21 @@ epm_reposwitch() ...@@ -102,22 +106,21 @@ epm_reposwitch()
[ -n "$TO" ] || fatal "run repo switch with arg (p9, p10, Sisyphus)" [ -n "$TO" ] || fatal "run repo switch with arg (p9, p10, Sisyphus)"
[ "$TO" = "sisyphus" ] && TO="Sisyphus" [ "$TO" = "sisyphus" ] && TO="Sisyphus"
if [ "$TO" = "Sisyphus" ] ; then if [ "$TO" = "Sisyphus" ] ; then
__replace_alt_version_in_repo "[tpc][5-9]\.?[0-9]?/branch/" "$TO/" __replace_alt_version_in_repo "$__alt_branch_reg/branch/" "$TO/"
__replace_alt_version_in_repo "p10\.?[0-9]?/branch/" "$TO/"
else else
__replace_alt_version_in_repo "Sisyphus/" "$TO/branch/" __replace_alt_version_in_repo "Sisyphus/" "$TO/branch/"
__replace_alt_version_in_repo "[tpc][5-9]\.?[0-9]?/branch/" "$TO/branch/" __replace_alt_version_in_repo "$__alt_branch_reg/branch/" "$TO/branch/"
if [ "$TO" != "p10" ] ; then
__replace_alt_version_in_repo "p10\.?[0-9]?/branch/" "$TO/branch/"
fi
fi fi
__alt_repofix "$TO" __alt_repofix "$TO"
# TODO: improve for c10f1?
if [ "$TO" = "p10" ] ; then if [ "$TO" = "p10" ] ; then
echo '%_priority_distbranch p10' >/etc/rpm/macros.d/p10 echo '%_priority_distbranch $TO' >/etc/rpm/macros.d/$TO
elif [ "$TO" = "p11" ] ; then
echo '%_priority_distbranch p11' >/etc/rpm/macros.d/p11
else else
rm -fv /etc/rpm/macros.d/p10 rm -fv /etc/rpm/macros.d/{p10,p11}
fi fi
#epm repo list #epm repo list
} }
...@@ -145,7 +148,7 @@ __fix_alt_sources_list() ...@@ -145,7 +148,7 @@ __fix_alt_sources_list()
{ {
# for beauty spaces # for beauty spaces
local SUBST_ALT_RULE1='s!^(.*)[/ ](ALTLinux|LINUX\@Etersoft)[/ ]*(Sisyphus)[/ ](x86_64|i586|x86_64-i586|noarch|aarch64) !\1 \2/\3/\4 !gi' local SUBST_ALT_RULE1='s!^(.*)[/ ](ALTLinux|LINUX\@Etersoft)[/ ]*(Sisyphus)[/ ](x86_64|i586|x86_64-i586|noarch|aarch64) !\1 \2/\3/\4 !gi'
local SUBST_ALT_RULE2='s!^(.*)[/ ](ALTLinux|LINUX\@Etersoft)[/ ]*([tcp][6-9]\.?[0-9]?[/ ]branch|[tcp]1[012][/ ]branch)[/ ](x86_64|i586|x86_64-i586|noarch|aarch64) !\1 \2/\3/\4 !gi' local SUBST_ALT_RULE2='s!^(.*)[/ ](ALTLinux|LINUX\@Etersoft)[/ ]*('$__alt_branch_reg'[/ ]branch)[/ ](x86_64|i586|x86_64-i586|noarch|aarch64) !\1 \2/\3/\4 !gi'
local i local i
for i in "$@" ; do for i in "$@" ; do
...@@ -154,6 +157,7 @@ __fix_alt_sources_list() ...@@ -154,6 +157,7 @@ __fix_alt_sources_list()
# TODO: only for uncommented strings # TODO: only for uncommented strings
#sed -i -r -e "$SUBST_ALT_RULE" $i #sed -i -r -e "$SUBST_ALT_RULE" $i
regexp_subst "/^ *#/! s| pub|/pub|" $i regexp_subst "/^ *#/! s| pub|/pub|" $i
regexp_subst "/^ *#/! s| distributions|/distributions|" $i
regexp_subst "/^ *#/! $SUBST_ALT_RULE1" $i regexp_subst "/^ *#/! $SUBST_ALT_RULE1" $i
regexp_subst "/^ *#/! $SUBST_ALT_RULE2" $i regexp_subst "/^ *#/! $SUBST_ALT_RULE2" $i
...@@ -175,12 +179,13 @@ __subst_with_repo_url() ...@@ -175,12 +179,13 @@ __subst_with_repo_url()
{ {
local NURL="$2" local NURL="$2"
echo "$1" | sed \ echo "$1" | sed \
-e "s|h\?f\?t\?tp://mirror.yandex.ru/* altlinux|$NURL|" \ -e "s|//mirror.yandex.ru/* altlinux|$NURL|" \
-e "s|h\?f\?t\?tp://ftp.altlinux.org/pub/distributions/* ALTLinux|$NURL|" \ -e "s|//ftp.altlinux.org/pub/distributions/* ALTLinux|$NURL|" \
-e "s|h\?f\?t\?tp://ftp.basealt.ru/pub/distributions/* ALTLinux|$NURL|" \ -e "s|//ftp.basealt.ru/pub/distributions/* ALTLinux|$NURL|" \
-e "s|h\?f\?t\?tp://ftp.etersoft.ru/pub/* ALTLinux|$NURL|" \ -e "s|//update.altsp.su/pub/distributions/* ALTLinux|$NURL|" \
-e "s|h\?f\?t\?tp://download.etersoft.ru/pub/* ALTLinux|$NURL|" \ -e "s|//ftp.etersoft.ru/pub/* ALTLinux|$NURL|" \
-e "s|h\?f\?t\?tp://mirror.eterfund.org/download.etersoft.ru/pub/* ALTLinux|$NURL|" -e "s|//download.etersoft.ru/pub/* ALTLinux|$NURL|" \
-e "s|//mirror.eterfund.org/download.etersoft.ru/pub/* ALTLinux|$NURL|"
} }
__change_repo() __change_repo()
...@@ -209,19 +214,21 @@ case $BASEDISTRNAME in ...@@ -209,19 +214,21 @@ case $BASEDISTRNAME in
# TODO: move to repo change # TODO: move to repo change
case "$1" in case "$1" in
"etersoft") "etersoft")
__change_repo etersoft "http://download.etersoft.ru/pub ALTLinux" __change_repo etersoft "//download.etersoft.ru/pub ALTLinux"
;; ;;
"eterfund.org") "eterfund.org")
__change_repo eterfund.org "https://mirror.eterfund.org/download.etersoft.ru/pub ALTLinux" __change_repo eterfund.org "//mirror.eterfund.org/download.etersoft.ru/pub ALTLinux"
;; ;;
"yandex") "yandex")
__change_repo mirror.yandex "http://mirror.yandex.ru altlinux" __change_repo mirror.yandex "//mirror.yandex.ru altlinux"
;; ;;
"basealt") "basealt")
__change_repo ftp.basealt "http://ftp.basealt.ru/pub/distributions ALTLinux" __change_repo ftp.basealt "//ftp.basealt.ru/pub/distributions ALTLinux"
;; ;;
"altlinux.org") "altlinux.org")
__change_repo ftp.altlinux "http://ftp.altlinux.org/pub/distributions ALTLinux" __change_repo ftp.altlinux "//ftp.altlinux.org/pub/distributions ALTLinux"
;;
"")
;; ;;
*) *)
fatal "Unsupported change key $1" fatal "Unsupported change key $1"
......
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