Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
eepm
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
eepm
Commits
d3842cf8
Commit
d3842cf8
authored
Dec 07, 2021
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move repo fix code from release_upgrade to repofix
parent
ed23dd4f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
70 deletions
+74
-70
epm-release_upgrade
bin/epm-release_upgrade
+7
-68
epm-repofix
bin/epm-repofix
+67
-2
No files found.
bin/epm-release_upgrade
View file @
d3842cf8
...
...
@@ -69,16 +69,6 @@ assure_safe_run()
return
0
}
__replace_text_in_alt_repo
()
{
local
i
for
i
in
/etc/apt/sources.list /etc/apt/sources.list.d/
*
.list
;
do
[
-s
"
$i
"
]
||
continue
regexp_subst
"
$1
"
"
$i
"
done
}
__wcount
()
{
echo
"
$*
"
|
wc
-w
...
...
@@ -110,42 +100,6 @@ __detect_alt_release_by_repo()
return
1
}
__replace_alt_version_in_repo
()
{
local
i
assure_exists apt-repo
#echo "Upgrading $DISTRNAME from $1 to $2 ..."
docmd apt-repo list |
sed
-e
"s|
\(
$1
\)
|{
\1
}->{
$2
}|g"
|
grep
-E
--color
--
"
$1
"
# ask and replace only we will have changes
if
a
=
''
apt-repo list |
grep
-E
-q
--
"
$1
"
;
then
__replace_text_in_alt_repo
"/^ *#/! s!
$1
!
$2
!g"
fi
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!
\[
p10
\.
?[0-9]?
\]
!
$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
if
[
-n
"
$TO
"
]
;
then
# TODO: switch it in repo code
TO
=
"
$(
__repofix_filter_vendor
"
$TO
"
)
"
__alt_replace_sign_name
"[
$TO
]"
fi
}
__get_conflict_release_pkg
()
{
...
...
@@ -213,15 +167,6 @@ get_fix_release_pkg()
fi
}
__switch_repo_to
()
{
local
TO
=
"
$1
"
__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
"p10
\.
?[0-9]?/branch/"
"
$TO
/branch/"
__alt_repofix
$TO
}
__check_system
()
{
local
TO
=
"
$1
"
...
...
@@ -277,6 +222,12 @@ __epm_ru_update()
docmd epm update
}
__switch_repo_to
()
{
epm_reposwitch
"
$@
"
__epm_ru_update
||
fatal
}
get_next_release
()
{
local
FROM
=
"
$1
"
...
...
@@ -323,7 +274,6 @@ __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
__epm_ru_update
||
fatal
docmd epm
install
rpm apt
"
$(
get_fix_release_pkg
--force
"
$TO
"
)
"
||
fatal
"Check the errors and run '# epm release-upgrade' again"
__do_upgrade
end_change_alt_repo
...
...
@@ -334,7 +284,6 @@ __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
__epm_ru_update
||
fatal
docmd epm
install
rpm apt
"
$(
get_fix_release_pkg
--force
"
$TO
"
)
"
||
fatal
"Check the errors and run '# epm release-upgrade' again"
__do_upgrade
end_change_alt_repo
...
...
@@ -346,7 +295,6 @@ __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
__epm_ru_update
||
fatal
docmd epm
install
rpm apt
"
$(
get_fix_release_pkg
--force
"
$TO
"
)
"
||
fatal
"Check the errors and run '# epm release-upgrade' again"
__do_upgrade
end_change_alt_repo
...
...
@@ -357,7 +305,6 @@ __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
__epm_ru_update
||
fatal
docmd epm
install
rpm apt
"
$(
get_fix_release_pkg
--force
"
$TO
"
)
"
||
fatal
"Check the errors and run '# epm release-upgrade' again"
if
epm installed libcrypt
;
then
# glibc-core coflicts libcrypt
...
...
@@ -377,7 +324,6 @@ __switch_alt_to_distro()
docmd epm remove gdb
||
fatal
fi
__switch_repo_to
$TO
__epm_ru_update
||
fatal
__do_upgrade
end_change_alt_repo
docmd epm
install
rpm apt
"
$(
get_fix_release_pkg
--force
"
$TO
"
)
"
||
fatal
"Check the errors and run '# epm release-upgrade' again"
...
...
@@ -391,8 +337,6 @@ __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
echo
'%_priority_distbranch p10'
>
/etc/rpm/macros.d/p10
__epm_ru_update
||
fatal
__do_upgrade
end_change_alt_repo
docmd epm
install
rpm apt
"
$(
get_fix_release_pkg
"
$TO
"
)
"
||
fatal
"Check the errors and run '# epm release-upgrade' again"
...
...
@@ -403,7 +347,6 @@ __switch_alt_to_distro()
confirm_info
"Downgrade
$DISTRNAME
from
$FROM
to
$TO
..."
docmd epm
install
"
$(
get_fix_release_pkg
"
$FROM
"
)
"
__switch_repo_to
$TO
__epm_ru_update
||
fatal
docmd epm downgrade rpm apt
"
$(
get_fix_release_pkg
--force
"
$TO
"
)
"
||
fatal
"Check the errors and run '# epm release-upgrade' again"
if
epm installed libcrypt
>
/dev/null
;
then
# glibc-core coflicts libcrypt
...
...
@@ -418,7 +361,6 @@ __switch_alt_to_distro()
confirm_info
"Downgrade
$DISTRNAME
from
$FROM
to
$TO
..."
docmd epm
install
"
$(
get_fix_release_pkg
"
$FROM
"
)
"
__switch_repo_to
$TO
__epm_ru_update
||
fatal
docmd epm downgrade rpm apt
"
$(
get_fix_release_pkg
--force
"
$TO
"
)
"
||
fatal
"Check the errors and run '# epm release-upgrade' again"
#if epm installed libcrypt >/dev/null ; then
# # glibc-core coflicts libcrypt
...
...
@@ -433,8 +375,6 @@ __switch_alt_to_distro()
confirm_info
"Downgrade
$DISTRNAME
from
$FROM
to
$TO
..."
docmd epm
install
"
$(
get_fix_release_pkg
"
$FROM
"
)
"
__switch_repo_to
$TO
rm
-fv
/etc/rpm/macros.d/p10
__epm_ru_update
||
fatal
docmd epm downgrade rpm apt
"
$(
get_fix_release_pkg
--force
"
$TO
"
)
"
||
fatal
"Check the errors and run '# epm release-upgrade' again"
docmd epm
$force_yes
$non_interactive
downgrade
||
fatal
"Check the error and run '# epm downgrade'"
end_change_alt_repo
...
...
@@ -445,8 +385,6 @@ __switch_alt_to_distro()
confirm_info
"Downgrade
$DISTRNAME
from
$FROM
to
$TO
..."
docmd epm
install
"
$(
get_fix_release_pkg
"
$FROM
"
)
"
__switch_repo_to
$TO
[
"
$TO
"
=
"p10"
]
&&
echo
'%_priority_distbranch p10'
>
/etc/rpm/macros.d/p10
__epm_ru_update
||
fatal
docmd epm
install
rpm apt
"
$(
get_fix_release_pkg
--force
"
$TO
"
)
"
||
fatal
"Check the errors and run '# epm release-upgrade' again"
docmd epm
$force_yes
$non_interactive
downgrade
||
fatal
"Check the error and run '# epm downgrade'"
end_change_alt_repo
...
...
@@ -457,6 +395,7 @@ __switch_alt_to_distro()
confirm_info
"Upgrade
$DISTRNAME
from
$FROM
to
$TO
..."
docmd epm
install
rpm apt
"
$(
get_fix_release_pkg
"
$FROM
"
)
"
||
fatal
docmd epm upgrade
||
fatal
# TODO: epm_reposwitch??
__replace_alt_version_in_repo
"
$FROM
/branch/"
"
$TO
/"
__alt_repofix
"alt"
[
-s
/etc/rpm/macros.d/p10
]
&&
rm
-fv
/etc/rpm/macros.d/p10
...
...
bin/epm-repofix
View file @
d3842cf8
#!/bin/sh
#
# Copyright (C) 2015-2016, 2020 Etersoft
# Copyright (C) 2015-2016, 2020 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2015-2016, 2020
, 2021
Etersoft
# Copyright (C) 2015-2016, 2020
, 2021
Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
...
...
@@ -19,6 +19,16 @@
load_helper epm-query
__replace_text_in_alt_repo
()
{
local
i
for
i
in
/etc/apt/sources.list /etc/apt/sources.list.d/
*
.list
;
do
[
-s
"
$i
"
]
||
continue
regexp_subst
"
$1
"
"
$i
"
done
}
__repofix_check_vendor
()
{
local
i
...
...
@@ -44,6 +54,61 @@ __repofix_filter_vendor()
echo
"
$br
"
}
__replace_alt_version_in_repo
()
{
local
i
assure_exists apt-repo
#echo "Upgrading $DISTRNAME from $1 to $2 ..."
apt-repo list |
sed
-e
"s|
\(
$1
\)
|{
\1
}->{
$2
}|g"
|
grep
-E
--color
--
"
$1
"
# ask and replace only we will have changes
if
a
=
''
apt-repo list |
grep
-E
-q
--
"
$1
"
;
then
__replace_text_in_alt_repo
"/^ *#/! s!
$1
!
$2
!g"
fi
#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!
\[
p10
\.
?[0-9]?
\]
!
$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
if
[
-n
"
$TO
"
]
;
then
# TODO: switch it in repo code
TO
=
"
$(
__repofix_filter_vendor
"
$TO
"
)
"
__alt_replace_sign_name
"[
$TO
]"
fi
}
#__switch_repo_to()
epm_reposwitch
()
{
local
TO
=
"
$1
"
[
-n
"
$TO
"
]
||
fatal
"run repo switch with arg (p9, p10, Sisyphus)"
__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
"p10
\.
?[0-9]?/branch/"
"
$TO
/branch/"
__alt_repofix
$TO
if
[
"
$TO
"
=
"p10"
]
;
then
echo
'%_priority_distbranch p10'
>
/etc/rpm/macros.d/p10
else
rm
-fv
/etc/rpm/macros.d/p10
fi
#epm repo list
}
# source-list vendor path
# example: /etc/apt/source.list p7 ALTLinux\/Sisyphus
__try_fix_apt_source_list
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment