Skip to content
Snippets Groups Projects

core: pkgrepo: support arbitrarily named pmaports directories

Merged Caleb Connolly requested to merge caleb/custom-pmaports into master
5 files
+ 49
15
Compare changes
  • Side-by-side
  • Inline
Files
5
  • There was an oversight when this API was originally created and it
    implicitly assumed that the pmaports repository was always named
    "pmaports". This unfortunately broke some peoples workflows.
    
    Introduce a new "pkgrepo_name()" function and adjust the codebase to use
    it, as well as adjusting pkgrepo internally to special case the
    "pmaports" repo so that it's always named pmaports no matter what the
    directory itself is named.
    
    This is probably more complexity than we should be dealing with here, we
    should probably create a new type to encode this behaviour.
    
    Fixes: #2412
    Signed-off-by: default avatarCaleb Connolly <caleb@postmarketos.org>
+ 3
3
import enum
from pathlib import Path
from pmb.core.pkgrepo import pkgrepo_paths
from pmb.core.pkgrepo import pkgrepo_name, pkgrepo_paths
import pmb.helpers.run
import pmb.chroot
@@ -126,10 +126,10 @@ def mount_pmaports(chroot: Chroot = Chroot.native()) -> dict[str, Path]:
"""
dest_paths = {}
for repo in pkgrepo_paths(skip_extras=True):
destination = Path("/mnt") / repo.name
destination = Path("/mnt") / pkgrepo_name(repo)
outside_destination = chroot / destination
pmb.helpers.mount.bind(repo, outside_destination, umount=True)
dest_paths[repo.name] = destination
dest_paths[pkgrepo_name(repo)] = destination
return dest_paths
Loading