Move aports into own repository (pmaports)
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
pmbootstrap init
workflow:
New - 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) - 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
-
pmbootstrap/aports
is not in the repo anymore, and added to.gitignore
- if
pmbootstrap/aports
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 - 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 thepmaports
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 inargs.pmaports
- new file
pmb/config/pmaports.py
has all the pmaports related checks
Implementation details
pmb.helpers.git.clone()
:
Extended - NOTE: this function is also used for cloning Alpine's aports
repository when running
pmbootstrap aportgen gcc-armhf
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 - the additional stuff (merging with user's config file, applying
defaults, extending it with
args.cache
etc.) has been moved to the new filepmb/helpers/args.py
and split up into multiple functions -
args.from_argparse
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 inpmbootstrap init
. - the new
args.py
has a length comment on top describing the format of theargs
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 -
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)
Merge request reports
Activity
added 1 commit
- 77fc261e - Move aports into own repository (pmaports)
By Oliver Smith on 2018-08-23T21:44:37
Two things that are not clear from reading the description:
-
will there be a symlink made from the pmaports folder to the pmbootstrap folder so you can easily access the aports?
-
Will the history of the aports be preserved for the pmaports repo? There are nice git commands that can do that.
By Luca Weiss on 2018-08-24T06:59:10
Edited by Administrator-
will there be a symlink made from the pmaports folder to the pmbootstrap folder so you can easily access the aports?
Yes, see "New
pmbootstrap init
workflow":- if pmbootstrap/aports does not exist, try to symlink it to the cloned repo
On the terminal, it looks like this:
$ git clone https://gitlab.postmarketos.org/postmarketos/pmbootstrap.git $ cd pmbootstrap $ ./pmbootstrap.py init [19:11:28] Location of the 'work' path. Multiple chroots (native, device arch, device rootfs) will be created in there. [19:11:28] Work path [/home/user/.local/var/pmbootstrap]: [19:11:29] pmbootstrap does everything in Alpine Linux chroots, so your host system does not get modified. In order to work with these chroots, pmbootstrap calls 'sudo' internally. To see the commands it runs, you can run 'pmbootstrap log' in a second terminal. [19:11:29] Setting up the native chroot and cloning the package build recipies (pmaports)... [sudo] password for user: [19:11:29] (native) install alpine-base [19:11:30] (native) install git [19:11:31] (native) git clone https://gitlab.com/postmarketOS/pmaports.git [19:11:33] NOTE: pmaports path: /home/user/.local/var/pmbootstrap/cache_git/pmaports [19:11:33] Target device (either an existing one, or a new one for porting). ... $ file aports aports: symbolic link to /home/user/.local/var/pmbootstrap/cache_git/pmaports
Will the history of the aports be preserved for the pmaports repo? There are nice git commands that can do that.
Yep, @GrantM11235 showed how to do it in #383 (comment 95390707).
The new repository exists already (that's how the test cases can run through in this MR):
https://gitlab.com/postmarketOS/pmaports
I hope we can merge this rather soon, but when new aports change in the pmbootstrap repository in the meantime, I will change them in that new repository as well.
By Oliver Smith on 2018-09-05T07:56:24
Edited by AdministratorWhen the
--aports
arg is pointed to a non-existent directory it logs the first init message.$ pmbootstrap --aports ~/src/not_a_dir/ init
[15:07:13] Setting up the native chroot and cloning the package build recipies (pmaports)... [15:07:13] NOTE: pmaports path: /home/r/src/not_a_dir/ [15:07:13] ERROR: We have split the aports repository from the pmbootstrap repository (#383). Please run 'pmbootstrap init' again to clone it.
I've got the default pmaports initialized. I've tried to pass
--aports
a directory that doesn't exist. So that error message isn't accurately describing what has happened.By ryang on 2018-08-24T19:17:58
Edited by AdministratorWorks great, but I can reproduce the error as mentioned by @ryang2678.
Other than that, this is definitely promising.
One question, right now I wasn't asked for what version of the pmaports repo to clone (like 3.8, edge, etc). This makes sense now as we don't yet have a non-edge release, but can I assume that once we do have such a release, the user will be asked for it?
By Bart Ribbers on 2018-08-26T11:01:08
One question, right now I wasn't asked for what version of the pmaports repo to clone (like 3.8, edge, etc). This makes sense now as we don't yet have a non-edge release, but can I assume that once we do have such a release, the user will be asked for it?
Yeah, it makes sense to implement that when we have multiple branches.
By Oliver Smith on 2018-08-26T21:43:17
added 1 commit
- cd6273d0 - Check if --aports path exists, more docstrings
By Oliver Smith on 2018-08-28T20:07:25
added 1 commit
- ab48ad0b - Revert "Check if --aports path exists, more docstrings"
By Oliver Smith on 2018-08-28T20:12:42
TODOs:
- fix the bug @ryang2678 pointed out
- add tests to pmaports repository again (https://gitlab.com/postmarketOS/pmaports/merge_requests/1)
- add new commits from pmbootstrap to pmaports repository
By Oliver Smith on 2018-09-04T07:17:40
Edited by Administratoradded 10 commits
-
ab48ad0b...6991c135 - 8 commits from branch
master
- 358a763d - Move aports into own repository (pmaports)
- 4ae5eb32 - bye bye aports
By Oliver Smith on 2018-08-30T22:20:56
-
ab48ad0b...6991c135 - 8 commits from branch
added 2 commits
By Oliver Smith on 2018-08-30T22:24:23
I did a lot of work in adjusting the test cases and CI for pmaports (https://gitlab.com/postmarketOS/pmaports/merge_requests/1), and that's looking pretty good now (still WIP though). The bug @ryang2678 found is fixed here. For some reason, the CI in this MR is now failing with something related to the gitlab cache, clearing the cache did not help:
Creating cache default-1... venv: found 1998 matching files FATAL: open ../../../../../postmarketOS/pmbootstrap/default-1/archive_353320690: no such file or directory Failed to create cache Uploading artifacts... Incorrect Usage: flag provided but not defined: -artifact-format NAME: gitlab-runner artifacts-uploader - create and upload build artifacts (internal) USAGE: gitlab-runner artifacts-uploader [command options] [arguments...] OPTIONS: --id value The build ID to upload artifacts for (default: "93537347") [$CI_JOB_ID] --token value Build token (default: "xxxxxxxxxxxxxxxxxxxx") [$CI_JOB_TOKEN] --url value GitLab CI URL (default: "https://gitlab.com/") [$CI_SERVER_URL] --tls-ca-file value File containing the certificates to verify the peer when using HTTPS (default: "/home/pmos/builds/postmarketOS/pmbootstrap.tmp/CI_SERVER_TLS_CA_FILE") [$CI_SERVER_TLS_CA_FILE] --tls-cert-file value File containing certificate for TLS client auth with runner when using HTTPS [$CI_SERVER_TLS_CERT_FILE] --tls-key-file value File containing private key for TLS client auth with runner when using HTTPS [$CI_SERVER_TLS_KEY_FILE] --path value Add paths to archive (default: "[log.txt, log_testsuite.txt, dmesg.txt, pmbootstrap.cfg]") FATAL: flag provided but not defined: -artifact-format --untracked Add git untracked files --verbose Detailed information --retry value How many times to retry upload (default: "2") --retry-time value How long to wait between retries (default: "1s") --name value The name of the archive (default: "artifacts") --expire-in value When to expire artifacts (default: "1 week") ERROR: Job failed: Process exited with: 1. Reason was: ()
@craftyguy: you're good with gitlab CI, do you have an idea why this is failing?
@all: would someone like to do a code review?
By Oliver Smith on 2018-08-31T00:37:47
Couple of things:
-
the CI tests removed here seemed important (else they wouldn't have been added, right?) but they don't seem to be re-implemented in the pmaports repo. There should be a way to still run them in some fashion, right?
-
I was going to help review python changes, but there's >500 files changes in this MR and I cannot find any python changes without spending hours (slight exageration, ?) collapsing things in gitlab's 'changes' section for this MR.
For #2 (closed), I can pull the branch and grep for the py files. But I wanted to point that out since it's a shortcoming of gitlab/web git review processes.
By clayton craft on 2018-08-31T02:43:52
-
Thanks for fixing it @craftyguy!
- the CI tests removed here seemed important (else they wouldn't have been added, right?) but they don't seem to be re-implemented in the pmaports repo. There should be a way to still run them in some fashion, right?
Yes, they are important. I'm working on adding them again here: https://gitlab.com/postmarketOS/pmaports/merge_requests/1
- I was going to help review python changes, but there's >500 files changes in this MR and I cannot find any python changes without spending hours (slight exageration, ?) collapsing things in gitlab's 'changes' section for this MR.
Right, going through all these files won't work - but I've put it in two commits, so one can click on "commits" and then look at the one with the code changes.
By Oliver Smith on 2018-08-31T20:11:40
Awesome! Yeah, whenever you run
pmbootstrap
(not only oninit
), it will check if thepmaports
version (as defined inpmaports.cfg
) has at least the version required inpmb.config.min_version_pmaports
:def check_version_pmaports(args): # Compare versions real = args.pmaports["version"] min = pmb.config.pmaports_min_version if pmb.parse.version.compare(real, min) >= 0: return # Outated error logging.info("NOTE: your pmaports folder has version " + real + ", but" + " version " + min + " is required.") raise RuntimeError("Please update your local pmaports repository. Usually" " with: 'git -C \"" + args.aports + "\" pull'")
By Oliver Smith on 2018-09-01T22:34:31
Yeah that works but I was more thinking along the line of the code that runs
apk update
if the repositories are (a day?) old so you'll not working on an outdated aports checkout. I don't think the required pmaports will be bumped weekly.Edit: @z3ntu beat me to it, that's what I meant.
By Martijn Braam on 2018-09-01T22:40:47
Edited by AdministratorThis still doesn't update the pmaports repo daily/weekly which will probably cause problems where problems are already fixed (e.g. alpine soname bumps) but the users don't have that.
if we have a soname bump, then the
pkgrel
will be increased in thepmaports
version, and the new binary package will be built.pmbootstrap
will use the package from the binary repo with the newer version in case thepmaports
checkout is outdated.So this should be fine, or am I missing something?
By Oliver Smith on 2018-09-01T22:53:35
Edited by AdministratorIn the soname case that would work (and probably in most other cases). But it would still be nice to have a warning when the pmaports checkout is old so you don't accidentally only do
git pull
on the pmbootstrap repo and keep working on an old pmaports repo.By Martijn Braam on 2018-09-01T23:14:07
I think it would be weird for new users to see every day that they need to update the
pmaports
repository with this rather long command, and not having it automated.But you have a point there, if someone wants to work on an existing aport, they should start their work on the latest version of the aport.
I would solve this with good documentation in the wiki TBH, because now that we do have the extra repository for the aports, contribution merge requests requires a bit more thinking anyway (one needs to enter the pmaports repository and do their changes there). We could bump the work folder version to explain this to existing users once (and display the link). What do you think about that?
By Oliver Smith on 2018-09-01T23:28:57
@GrantM11235: how would that work with using various branches?
EDIT: in other words, I think this would be problematic when the user is working on a custom branch, that would have merge conflicts with the upstream pmaports repository. That's why I came up with the minimum version concept - just let the local pmaports version lack behind the upstream one on purpose until the user really needs to update it. This way the user is also less likely to get aports checked out of which binary packages don't exist yet. I do understand that this changes the workflow quite a bit, but I don't see a way around it that would work for all the edge cases like handling different branches. But as always I'm happy for more feedback, maybe there is a more elegant way to do it!
By Oliver Smith on 2018-09-01T23:49:15
Edited by AdministratorIn my view pmbootstrap becomes much more mature over time and the user will be able to use it without being required to update pmboostrap very often. From the user perspective they will from now on primarily be working with the pmaports repo.
In the end not much is different from the user perspective. The aports were managed by the user before when it was under pmbootstrap but now it becomes standalone.
By ryang on 2018-09-02T00:21:54
added 5 commits
-
eeef055a...5ad6302b - 2 commits from branch
master
- a9f6cd36 - Move aports into own repository (pmaports)
- ac4d8980 - bye bye aports
- a76583e7 - add aportgen test case again
By Oliver Smith on 2018-09-04T06:01:57
Toggle commit list-
eeef055a...5ad6302b - 2 commits from branch
So I've added a few finishing touches in this repository (added the
aportgen
test case and rewrote it to work independent of changes in thepmaports
repository). Also in thepmaports
repository, where the test cases are integrated again, and the new commits frompmbootstrap
are there as well.I think this is good to go and will merge this tomorrow morning (so in ~22 hours), unless anyone has a good reason why we should not do it. After that I'll adjust documentation in the wiki to tell people to manually update the repository. I like the way @ryang2678 put it - instead of updating the pmbootstrap repository, users need to update their pmaports repository now.
This MR is also a big step towards pmbootstrap 1.0.
By Oliver Smith on 2018-09-04T07:24:02
added 5 commits
-
a76583e7...520f34a2 - 2 commits from branch
master
- 286c451c - Move aports into own repository (pmaports)
- 08419c54 - bye bye aports
- 1894a48c - add aportgen test case again
By Oliver Smith on 2018-09-05T04:35:25
Toggle commit list-
a76583e7...520f34a2 - 2 commits from branch
mentioned in merge request !1681 (closed)
By Oliver Smith on 2018-09-05T07:10:09
mentioned in merge request !1666 (closed)
By Oliver Smith on 2018-09-05T07:10:57
mentioned in merge request !1643 (closed)
By Oliver Smith on 2018-09-05T07:11:30
mentioned in merge request !1623 (closed)
By Oliver Smith on 2018-09-05T07:12:12
mentioned in merge request !1294 (closed)
By Oliver Smith on 2018-09-05T07:12:51
mentioned in merge request !1610 (closed)
By Oliver Smith on 2018-09-05T07:13:14
mentioned in merge request pmaports!2 (merged)
By Oliver Smith on 2018-09-05T07:26:42