Skip to content
Snippets Groups Projects
  • Caleb Connolly's avatar
    42158637
    chroot: apk: use apk.static in all cases (MR 2463) · 42158637
    Caleb Connolly authored
    
    In 0b4fb911 (chroot: always run apk static v2 (MR 2423)) we adjusted
    install_run_apk() to run apk static on the host and pass in the local
    binary repo with "--repository". This function can call apk in two ways,
    either with the progress bar handling or without, the second case was
    never updated and still ran apk inside the chroot incorrectly and with
    an incorrect --repository flag.
    
    Let's finish the job by refactoring helpers/apk.py to support all our
    usecases and pointing everything to it, removing the last few situations
    where we call "pmb.chroot.root(["apk", ...]).
    
    The apk_with_progress() function is replaced by a generic "run()"
    function which takes a boolean to indicate if we should render apk
    progress.
    
    Additionally, a new cache_clean() function is added so that "pmbootstrap
    zap --pkgs-online-mismatch" can FINALLY be refactored to not rely on a
    chroot existing. This requires some hacks but nothing serious, see the
    comments in the function for details.
    
    The chroot.init() code is now simplified since handling the --root,
    --arch, --cache-dir, and --repository flags is now all done by
    apk._prepare_cmd() as and when appropriate.
    
    Lastly, this fixes a (previously unnoticed) bug where apk.static was
    actually using /var/cache/apk on your host machine for its cache... This
    is definitely not good behaviour....
    
    Signed-off-by: default avatarCaleb Connolly <caleb@postmarketos.org>
    chroot: apk: use apk.static in all cases (MR 2463)
    Caleb Connolly authored
    
    In 0b4fb911 (chroot: always run apk static v2 (MR 2423)) we adjusted
    install_run_apk() to run apk static on the host and pass in the local
    binary repo with "--repository". This function can call apk in two ways,
    either with the progress bar handling or without, the second case was
    never updated and still ran apk inside the chroot incorrectly and with
    an incorrect --repository flag.
    
    Let's finish the job by refactoring helpers/apk.py to support all our
    usecases and pointing everything to it, removing the last few situations
    where we call "pmb.chroot.root(["apk", ...]).
    
    The apk_with_progress() function is replaced by a generic "run()"
    function which takes a boolean to indicate if we should render apk
    progress.
    
    Additionally, a new cache_clean() function is added so that "pmbootstrap
    zap --pkgs-online-mismatch" can FINALLY be refactored to not rely on a
    chroot existing. This requires some hacks but nothing serious, see the
    comments in the function for details.
    
    The chroot.init() code is now simplified since handling the --root,
    --arch, --cache-dir, and --repository flags is now all done by
    apk._prepare_cmd() as and when appropriate.
    
    Lastly, this fixes a (previously unnoticed) bug where apk.static was
    actually using /var/cache/apk on your host machine for its cache... This
    is definitely not good behaviour....
    
    Signed-off-by: default avatarCaleb Connolly <caleb@postmarketos.org>