This prefers gitlab CI's target branch from the env, and falls back to
the old target branch detection mechanism (using pmaports.cfg, etc) if
it's not set. This fixes CI in gitlab where the target branch is
something different than expected, e.g. if using stacked branches.
[ci:skip-build]: already built successfully in CI
Apparently some callers of `get_package_version` expect it to return
None if a package wasn't found... e.g. when CI is testing a branch that
introduces a new aport and it's trying to get the upstream version for
it, which doesn't exist.
This leads to a spectacular crash in CI:
upstream = get_package_version(args, package, commit, False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/clayton/src/pmaports/./.ci/lib/check_changed_aports_versions.py", line 47, in get_package_version
return parsed["pkgver"] + "-r" + parsed["pkgrel"]
~~~~~~^^^^^^^^^^
TypeError: 'NoneType' object is not subscriptable
When I refactored this method in 07812a918 I goofed up and changed this
behavior, so let's restore it to fix the crash.
The apkbuild parser returns `pkgrel` key as a `str`, not an `int`,
so the `!= 0` check would always succeed even if the file set it to `0`.
[ci:skip-build]: already built successfully in CI
In 11682fb0ab, the timeout was set to 10
hours. This means that the CI no longer just runs for one hour. However,
we are still limited by GitLab's runners which only give us three hours
of CI time per job, so given the status quo, this is the most likely
duration for someone who hasn't set up their own CI runners.
Note that the URLs in these scripts are not only for information, but
they are also used as marker by pmbootstrap so it knows these are
compatible with 'pmbootstrap ci'. I just fixed the typo in the
pmbootstrap code as well and made a new release, use pmbootstrap 1.50.0
or above to have it recognize these scripts with 'pmbootstrap ci' again.
Adjust all CI scripts that make use of .ci/common.py to
'pmbootstrap ci'. Move all scripts that are not direct entry points to
running CI scripts to .ci/lib.
Comment out the dtb check, as it is failing. Apparently it didn't run
properly before. Let's fix this after this CI change is done.
Add a wrapper .ci/wiki.sh, that pmbootstrap ci can run and use it in
gitlab-ci.yml. Add a .ci/lib/gitlab_prepare_ci.sh script that makes a
user available with sudo, as expected by the pmbootstrap ci compatible
scripts. Set up binfmt_misc too while at it, it will be needed for
running pmbootstrap.
The next patches will adjust the rest of the CI scripts and move the old
scripts in the .ci/lib dir, so only the scripts that should be called
directly are in the .ci dir.
Related: https://postmarketos.org/pmb-ci