Skip to content
Snippets Groups Projects
Unverified Commit cd4a0312 authored by Caleb Connolly's avatar Caleb Connolly :recycle:
Browse files

init: call apk_static.init() from main()


Calling apk_static.init() for every chroot we init doesn't make a whole
lot of sense. Move this call to pmb main() so we only ever do it once,
and properly untie this from chroot initialization.

Additionally, move the apk_static module from pmb/chroot to pmb/helpers
which is a much more suitable location.

Signed-off-by: default avatarCaleb Connolly <caleb@postmarketos.org>
parent 450ab274
No related branches found
No related tags found
No related merge requests found
Pipeline #209094 passed
......@@ -14,8 +14,8 @@ if TYPE_CHECKING:
from . import config
from . import parse
from . import types
from .config import init as config_init
from .helpers import apk_static
from .helpers import frontend
from .helpers import logging
from .helpers import mount
......@@ -97,6 +97,9 @@ def main() -> int:
elif not os.path.exists(context.config.work):
raise NonBugError("Work path not found, please run 'pmbootstrap init' to create it.")
# Fetch apk.static if necessary
apk_static.init()
# Migrate work folder if necessary
if args.action not in ["shutdown", "zap", "log"]:
other.migrate_work_folder()
......
......@@ -4,7 +4,6 @@ from pathlib import Path
import pmb.aportgen.core
import pmb.build
import pmb.chroot.apk
import pmb.chroot.apk_static
import pmb.helpers.run
import pmb.parse.apkindex
from pmb.core import Chroot
......
......@@ -4,7 +4,6 @@ from pathlib import Path
import pmb.aportgen.core
import pmb.build
import pmb.chroot.apk
import pmb.chroot.apk_static
from pmb.core.arch import Arch
import pmb.helpers.run
import pmb.parse.apkindex
......
......@@ -4,7 +4,6 @@ from pathlib import Path
import pmb.aportgen.core
import pmb.build
import pmb.chroot.apk
import pmb.chroot.apk_static
import pmb.helpers.run
import pmb.parse.apkindex
from pmb.core import Chroot
......
......@@ -6,7 +6,6 @@ from __future__ import annotations
import os
from pathlib import Path
import traceback
import pmb.chroot.apk_static
from pmb.core.arch import Arch
from pmb.helpers import logging
from collections.abc import Sequence
......
......@@ -9,7 +9,6 @@ import os
import pmb.chroot
import pmb.chroot.binfmt
import pmb.chroot.apk
import pmb.chroot.apk_static
import pmb.config
import pmb.config.workdir
import pmb.helpers.repo
......@@ -141,9 +140,6 @@ def init(chroot: Chroot, usr_merge=UsrMerge.AUTO):
warn_if_chroots_outdated()
return
# Require apk-tools-static
pmb.chroot.apk_static.init()
logging.info(f"({chroot}) Creating chroot")
# Initialize cache
......
......@@ -161,7 +161,8 @@ def init() -> None:
"""
Download, verify, extract $WORK/apk.static.
"""
# Get and parse the APKINDEX
# Get and parse the APKINDEX. alpine_apkindex_path() will implicitly
# download the APKINDEX file if it's missing.
apkindex = pmb.helpers.repo.alpine_apkindex_path("main")
index_data = pmb.parse.apkindex.package("apk-tools-static", indexes=[apkindex])
......
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