Skip to content
Snippets Groups Projects

core: pkgrepo: support arbitrarily named pmaports directories

Merged Caleb Connolly requested to merge caleb/custom-pmaports into master
1 file
+ 4
8
Compare changes
  • Side-by-side
  • Inline
  • 1efd1378
    config: init: dont clobber config · 1efd1378
    Caleb Connolly authored
    When pmbootstrap starts up, it loads the config file (or uses the
    defaults) and then merged some arguments (e.g. --work) into it. However
    in config.init.frontend() we were creating yet another new Config, but
    it's too late to merge args in at this point...
    
    Rework this slightly to fix that major oversight and remove the totally
    unnecessary hack of calling pmb.config.load() again.
    
    This fixes calling pmbootstrap init with --work
    
    Signed-off-by: default avatarCaleb Connolly <caleb@postmarketos.org>
+ 4
8
@@ -83,7 +83,7 @@ def ask_for_username(default_user: str) -> str:
return ret
def ask_for_work_path(args: PmbArgs) -> tuple[Path, bool]:
def ask_for_work_path(default: Path | None) -> tuple[Path, bool]:
"""Ask for the work path, until we can create it (when it does not exist) and write into it.
:returns: (path, exists)
@@ -98,9 +98,7 @@ def ask_for_work_path(args: PmbArgs) -> tuple[Path, bool]:
)
while True:
try:
work = os.path.expanduser(
pmb.helpers.cli.ask("Work path", None, get_context().config.work, False)
)
work = os.path.expanduser(pmb.helpers.cli.ask("Work path", None, default, False))
work = os.path.realpath(work)
exists = os.path.exists(work)
@@ -697,11 +695,9 @@ def frontend(args: PmbArgs) -> None:
require_programs()
# Work folder (needs to be first, so we can create chroots early)
config = pmb.config.load(args.config)
# Update context to point to new config
get_context().config = config
config = get_context().config
config.work, work_exists = ask_for_work_path(args)
config.work, work_exists = ask_for_work_path(config.work)
# If the work dir is not the default, reset aports and make
# it relative to the work dir
Loading