Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Arch Linux
repod
Commits
17639163
Unverified
Commit
17639163
authored
Oct 09, 2019
by
Maxim Baz
Browse files
db-move: allow moving to existing pkgbase, but only if version is increased
parent
3e7edd6c
Changes
1
Hide whitespace changes
Inline
Side-by-side
dbscripts/db-move
View file @
17639163
...
...
@@ -7,6 +7,8 @@ from fcntl import LOCK_EX, flock
from
pathlib
import
Path
from
sys
import
argv
,
exit
from
pyalpm
import
vercmp
from
lib.dbwrite
import
generate_dbs
...
...
@@ -45,9 +47,14 @@ async def main(repo_from, repo_to, pkgbases) -> int:
f
"pkgbase '
{
pkgbase
}
' is not present in the source repo '
{
repo_from
}
'"
)
if
pkgbase
in
meta
[
repo_to
]:
raise
RuntimeError
(
f
"pkgbase '
{
pkgbase
}
' is already present in the destination repo '
{
repo_to
}
'"
)
# verify version is increasing
curver
=
meta
[
repo_to
][
pkgbase
][
"version"
]
newver
=
meta
[
repo_from
][
pkgbase
][
"version"
]
if
vercmp
(
newver
,
curver
)
<
1
:
raise
RuntimeError
(
f
"Cannot move package '
{
pkgbase
}
' of version '
{
newver
}
'"
+
f
" to override existing version '
{
curver
}
', version is not increased"
)
# move package info within `meta` objects and update json files
Path
(
metadir
/
repo_to
).
mkdir
(
exist_ok
=
True
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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