Skip to content
Snippets Groups Projects
Commit 74c8aaab authored by Luca Weiss's avatar Luca Weiss
Browse files

pmb.helpers: Handle workdir version suffix from 2.3.x

For the gitlab.com -> gitlab.postmarketos.org migration we needed to
also migrate the workdir in pmb v2 since pmb v3 is not ready yet.

Therefore we need to handle that "7-2.x" workdir version and migrate
correctly when switching to pmbootstrap v3.

See !2445
parent 35cd6408
No related branches found
No related tags found
No related merge requests found
Pipeline #208654 passed
......@@ -82,10 +82,16 @@ def migrate_work_folder():
# Read current version
context = get_context()
current = 0
suffix: str | None = None
path = context.config.work / "version"
if os.path.exists(path):
with open(path) as f:
current = int(f.read().rstrip())
# pmb 2.3.x added a suffix due to conflicting work versions
# We need to be able to handle that going forward
version_parts = f.read().rstrip().split("-")
current = int(version_parts[0])
if len(version_parts) == 2:
suffix = version_parts[1]
# Compare version, print warning or do nothing
required = pmb.config.work_version
......@@ -96,7 +102,8 @@ def migrate_work_folder():
" (from version " + str(current) + " to " + str(required) + ")!"
)
if current == 6:
# version 6 and version 7 from 2.3.x branch are equivalent for this and we need to migrate
if current == 6 or (current == 7 and suffix == "2.x"):
# Ask for confirmation
logging.info("Changelog:")
logging.info("* Major refactor for pmb 3.0.0")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment