Motivation

This allows switching of postmarketOS aports (pmaports) branches independently of the pmbootstrap code. Besides that, it's the base work for several improvements that can be done in the future:

multiple postmarketOS (pmaports) versions maintained in parallel, based on Alpine's stable versions (3.8, 3.7, ...)

users will be able to easily switch between aport releases

proper packaging of pmbootstrap for package managers

pmbootstrap stable releases (1.0 version)

split up packaging issues into own issue tracker

New workflows

New pmbootstrap init workflow:

ask for the work dir as usually (first question)

initialize the work folder and start logging to it, so pmbootstrap log is already working (related changes below)

is already working (related changes below) if the aports folder (new default: $WORK/cache_git/pmaports ) does not exist: explain that sudo will be used to set up the chroot set up the native alpine chroot install git clone the pmaports repo

) does not exist: pmbootstrap/aports is not in the repo anymore, and added to .gitignore

is not in the repo anymore, and added to if pmbootstrap/aports does not exist, try to symlink it to the cloned repo

does not exist, try to symlink it to the cloned repo now continue as usually by asking for the device etc.

New checks that run at the beginning of pmbootstrap:

check for a legacy pmbootstrap/aports folder that is not a symlink

folder that is not a symlink compatibility of the pmbootstrap version with the pmaports repository

in order to check that, a new file pmaports.cfg will be in the repository, and it contains the minimum pmbootstrap version as well as the pmaports version

will be in the repository, and it contains the minimum pmbootstrap version as well as the version pmbootstrap has the pmbootstrap version and minimum pmaports version stored in pmb/config/__init__.py

the pmaports.cfg is read during startup and placed in args.pmaports

is read during startup and placed in new file pmb/config/pmaports.py has all the pmaports related checks

Implementation details

Extended pmb.helpers.git.clone() :

NOTE: this function is also used for cloning Alpine's aports repository when running pmbootstrap aportgen gcc-armhf for example

for example make shallow clones optional ( git clone --depth=1 )

) add option to chown the resulting folder to the host system's user

Changes for initializing logging early:

pmb/parse/arguments.py only takes care of filling the variable with command line arguments now

only takes care of filling the variable with command line arguments now the additional stuff (merging with user's config file, applying defaults, extending it with args.cache etc.) has been moved to the new file pmb/helpers/args.py and split up into multiple functions

etc.) has been moved to the new file and split up into multiple functions args.from_argparse holds the arguments from before extending the variable

holds the arguments from before extending the variable now it's possible to initialize args multiple times, and we use that to re-initialize it after setting the work folder in pmbootstrap init .

multiple times, and we use that to re-initialize it after setting the work folder in . the new args.py has a length comment on top describing the format of the args variable

Other changes:

remove apk-tools git clone url (code that used this has been removed long ago), add pmaports clone URL

fix existing test cases that build a custom aports folder by copying the pmaports.cfg file to the test folder

file to the test folder test/testcases_fast.sh : use new pmaports path for existing device check

How to review

the deleted aports are in an extra commit, looking only at the commit with the code changes makes a review feasible

How to test

switch to this branch, play around with pmbootstrap, see if it clones the repo correctly and try out some edge cases. (People who usually don't review the Python code changes: testing this would provide value feedback as well!)

Closes #383 (closed)