Skip to content

pmbootstrap install: don't screw up /etc/apk/world, related refactoring

Administrator requested to merge fix-apk-world into master

Three commits. This is the important one, the others just refactor related code in pmbootstrap install so the package list building is in one block and the comments aren't outdated anymore.

pmbootstrap install: don't screw up /etc/apk/world

Do not attempt to upgrade packages in the rootfs chroot when running
"pmbootstrap install".

This was responsible for placing every single package in /etc/apk/world
(which should only hold the packages explicitly installed), because the
upgrade function was literally implemented as getting a list of
installed packages and explicitly running pmb.chroot.apk.install on each
of them. The intention was to rebuild these packages if they were outdated,
I guess I didn't realize that this makes /etc/apk/world unusable when I
introduced this three years ago in 51bdc243 ("Properly rebuild/install
packages when something changed").

Remove pmb.chroot.apk.upgrade altogether, because:
1) pmb.install.install builds and upgrades outdated pmaports
2) pmb.install.install is the only user of pmb.chroot.apk.upgrade
3) 'pmbootstrap init' is warning that the chroots do not get upgraded
   automatically, so let's not go against that expectation. users who
   want an updated rootfs chroot can simply run zap and install again.

Fixes #1865 (closed)

How to test

#!/bin/sh -ex

pmbootstrap -q config ui none
pmbootstrap -q config device qemu-amd64
pmbootstrap -q -y zap

yes | pmbootstrap install
yes | pmbootstrap install

pmbootstrap chroot -r -- cat /etc/apk/world

Without fix:

+ pmbootstrap chroot -r -- cat /etc/apk/world
[21:12:04] (rootfs_qemu-amd64) % cat /etc/apk/world                              
/bin/sh                      
alpine-base                               
alpine-baselayout                                        
alpine-conf                                                                                                                                                                                                        
alpine-keys                                                                                                                                                                                                        
apk-tools                                                                                                                                                                                                          
argon2-libs                    
blkid                                    
brotli-libs            
busybox           
busybox-extras          
busybox-initscripts                           
busybox-suid                           
bzip2                                                                        
ca-certificates                                             
ca-certificates-bundle                            
ca-certificates-cacert                                                                                  
cfdisk                                              
charging-sdl
chrony
chrony-openrc
cmd:NetworkManager
cmd:addpart
cmd:agetty
cmd:apk
cmd:arptables
cmd:arptables-nft
cmd:arptables-nft-restore
cmd:arptables-nft-save
cmd:arptables-restore
cmd:arptables-save
cmd:badblocks
cmd:bbsuid
cmd:blkdiscard
cmd:blkid
cmd:blkzone
cmd:blockdev
cmd:bunzip2
cmd:busybox
...

With fix:

+ pmbootstrap chroot -r -- cat /etc/apk/world
[21:14:21] (rootfs_qemu-amd64) % cat /etc/apk/world
alpine-base
device-qemu-amd64
device-qemu-amd64-kernel-virt
postmarketos-base
[21:14:21] NOTE: chroot is still active (use 'pmbootstrap shutdown' as necessary)
[21:14:21] Done
Edited by Administrator

Merge request reports

Loading