Commit graph

2602 commits

Author SHA1 Message Date
Luca Weiss
048f24cf50
CI: Add docs deployment job (MR 2316)
Tweaked-By: Oliver Smith <ollieparanoid@postmarketos.org>
2024-06-06 18:09:56 +02:00
Luca Weiss
e9faee3747
CI: correct yaml indentation (MR 2316)
Seems GitLab CI doesn't really care but still fix it.
2024-06-06 18:06:48 +02:00
Newbyte
c1ffe85749
CI: Use latest (stable) Alpine instead of Edge (MR 2317)
Alpine 3.20 has released now which should contain everything we need to
run our CI.

Closes https://gitlab.com/postmarketOS/pmaports/-/issues/2747
2024-05-29 01:24:00 +02:00
Oliver Smith
d1aca8630f
PMB_APK_FORCE_MISSING_REPOSITORIES: 1 -> "1"
Fixes: 0d6c03b2 ("PMB_APK_FORCE_MISSING_REPOSITORIES: new env var (MR 2318)")
2024-05-29 01:10:42 +02:00
Oliver Smith
0d6c03b201
PMB_APK_FORCE_MISSING_REPOSITORIES: new env var (MR 2318)
This is needed to bring up the v24.06 repositories at
build.postmarketos.org. With the latest apk version, apk refuses to
operate if an URL from /etc/apk/repositories cannot be fetched.

Before the repositories are created for the first time, they do not
exist, so we will just set PMB_APK_FORCE_MISSING_REPOSITORIES=1 in bpo
to be not blocked here.

I've also spent significant time on alternative implementations, but
they have problems:
- Let bpo create an empty APKINDEX before building the first package,
  but this was a larger code change, leading to lots of adjustments in
  the tests, and ultimately it seems it didn't work properly (it seems
  apk/abuild doesn't create a valid signed APKINDEX for one that has no
  packages).
- Do not set the --mirror-pmOS argument for the "final" repository, only
  the "wip" repository, until the "final" repository is available for
  the first time. This works fine for x86_64, but not for foreign arch
  repositories because then the cross compilers from the x86_64
  repository are not available. I've also tried to make a different env
  var that ensures we don't write the non-existing repository to
  /etc/apk/repositories from within pmbootstrap if initializing a
  foreign arch chroot, but then we would find a sane way to do this only
  for the "final" repository and not for the "wip" repository which
  leads to a lot more complexity than this patch.

So this is not the nicest solution (apk still tries to fetch the indexes
and gets a 404), but it is the simplest one and unblocks us from working
on v24.06. Also it doesn't add more complexity which is important in the
middle of the feature freeze we are currently in.

Related: bpo issue 137
Related: d76213e643
Related: https://postmarketos.org/blog/2024/05/19/pmOS-update-2024-05/#pmbootstrap-230-and-feature-freeze
2024-05-29 00:12:55 +02:00
Clayton Craft
3eca24f1ed
kconfigcheck: add NLS_ASCII for efi check (MR 2310)
This option is required for kernels to support mounting the ESP as /boot
after pmaports bb6d7a05b
2024-05-19 19:20:22 +02:00
Val Packett
1b2024e7d8
pmb: install: unbreak rsync option (MR 2311)
Fixes "UnboundLocalError: cannot access local variable 'filesystem'
where it is not associated with a value".
2024-05-19 18:58:34 +02:00
Newbyte
9252400292
Prepare 2.3.1 release 2024-05-18 18:34:09 +02:00
Robert Eckelmann
e7c8b2d5dc
pyproject.toml: add docs to the parts to be excluded (MR 2312)
as reported in #2355 pmmbootstrap wheel installs files to /usr/lib/python3.12/site-packages/docs
2024-05-18 18:21:04 +02:00
Oliver Smith
fd73ecbfd3
pmb.config.apk_tools_min_version: add v3.20
Prepare for postmarketOS v24.06.
2024-05-15 20:54:16 +02:00
Oliver Smith
e64583458c
pmb.config.apk_tools_min_version: update
Set the current apk versions as min version.
2024-05-15 20:54:11 +02:00
Newbyte
6dce84647b
Prepare 2.3.0 release 2024-05-15 18:43:22 +02:00
Newbyte
0df75422b4
treewide: Rename unmaintained to archived (MR 2308)
See https://gitlab.com/postmarketOS/pmaports/-/merge_requests/5046
2024-05-15 17:06:37 +02:00
Robert Eckelmann
d28174bf95
ci: add job to generate docs (MR 2266) 2024-05-14 14:36:24 +02:00
Robert Eckelmann
974b76c00a
docs: add new configuration for generating docs using sphinx (MR 2266) 2024-05-14 14:36:23 +02:00
Robert Eckelmann
044d3b5a6a
pmb.*: various comment reformatting to assist with generating docs (MR 2266) 2024-05-14 14:36:22 +02:00
Clayton Craft
415e7364f4
pmb.parse: add get_parser for returning ArgumentParser obj (MR 2266)
This is needed for sphinx autoprogram since that expects an
argparse.ArgumentParser, and arguments() returns some argparse
"Namespace" obj. Useful for sphinx/autoprogram and maybe other things
later that want to get at pmb's full args.
2024-05-14 14:36:18 +02:00
Pablo Correa Gómez
a5575a28f9
pmb: install: add options for default charset in vfat /boot partitions (MR 2304)
linux-lts and linux-edge in alpine use "utf-8", that might change, but
add the options regardless, so we can be safe (people can always edit them!)

Fixes https://gitlab.com/postmarketOS/pmaports/-/issues/2782
[ci:skip-build]: already built successfully in CI
2024-05-07 10:00:12 -07:00
Pablo Correa Gómez
93a9cea50f
pmb: install: add some sane mount options to default /boot in /etc/fstab (MR 2304)
We don't want executables, suid executables, or devices. We neither
want symbolic links in fat partitions. These have been taken from
systemd

Ref: pmaports#2782
2024-05-07 10:00:12 -07:00
Pablo Correa Gómez
d6b9ffbc78
pmb: install: allow to mount fat{16,32} /boot from /etc/fstab (MR 2304)
The "fat16" and "fat32" mount types do not exist. It is "vfat"
2024-05-07 10:00:12 -07:00
Clayton Craft
70a5e6ebf7
pmb.config: kconfig check: turn off RT_GROUP_SCHED in 'community' (MR 2305)
See: https://gitlab.com/postmarketOS/pmaports/-/issues/2652
2024-05-06 10:21:41 -07:00
Clayton Craft
69cb189bdb
test: disable cross compile test (MR 2307)
This test is *only* failing in gitlab CI and I haven't been able to
figure out why (see [1]). Everything else (e.g. bpo, building packages
locally) seems to work fine. Since this is blocking pmbootstrap MRs, I'm
going to disable the test until we can figure out wtf is going on with
running it in gitlab CI.

1. https://gitlab.com/postmarketOS/pmbootstrap/-/issues/2346
[ci:skip-build]: already built successfully in CI
2024-05-02 10:38:47 -07:00
Brandon Boese
a2f9d780e3
gitignore: Ignore KDevelop files and folder (MR 2302) 2024-04-30 08:15:31 +02:00
Oliver Smith
08771c2ebc
pmb.build.is_necessary: tweak log msgs (MR 2295)
* Replace aports -> pmaports
* Make the "binary repo has newer version" message much shorter, and
  mention "pmbootstrap pull". If users didn't mess with their pmaports
  repository (checkout a custom branch, make commits), this command
  will update to the latest commit and resolve the warning. This also
  ties into MR 2294 where I removed a feature from "pmbootstrap status"
  that would complain about the last fetch of pmaports.git being too old
  and was also recommending "pmbootstrap pull". I think having it here
  in the warning makes more sense, as more people will see it.
2024-04-24 21:37:58 +02:00
Oliver Smith
21f70e9ba6
pmb.build.is_necessary: tweak comments (MR 2295)
* Remove obvious / not helpful line:
  "# Get package name, version, define start of debug message"
* Remove "old" in "Get old version from APKINDEX" because it may be
  newer than the version in pmaports
* Replace "Aports [folder]" with pmaports (in some parts of pmbootstrap
  code, pmaports is still referred to as aports, this was one of them)
2024-04-24 21:37:58 +02:00
Oliver Smith
d55bc245d1
pmb.build.is_necessary: replace version_{new,old} (MR 2295)
Give more meaningful names to the variables:
* version_new -> version_pmaports
* version_old -> version_binary

This makes the code less confusing for the case where version_binary is
actually newer than version_pmaports. This is a relict from the time
before there was a binary package repository, in that case the version
from pmaports would always be the newer one, built from source, compared
to the local binary package that was probably built before.
2024-04-24 21:37:53 +02:00
Oliver Smith
105b5ec0bf
testdata/APKBUILD.var-replacements: add custom var (MR 2300)
Extend the testdata and test case to show that the parser can now handle
custom variables.
2024-04-17 17:05:09 +02:00
Oliver Smith
85ee201cf5
APKBUILD parser: recognize all top-level variables (MR 2300)
A common pattern in APKBUILDs, is to introduce custom variables prefixed
with underscores that get then used in makedepends and other variables.

For example:

  _wlrootsmakedepends="
	eudev-dev
  	# ...
  	"
  makedepends="
  	# ...
  	$_wlrootsmakedepends
  	"

Adjust the APKBUILD parser code, so it parses all top-level variables
and can use them further below when referenced inside other variables.
Before returning the parsed APKBUILD data, remove all variables that are
not in pmbootstrap's list of known APKBUILD parsing attributes (so the
result is the same).

I've compared "pmbootstrap apkbuild_parse" (which parses all APKBUILDs
in the currently checked out pmaports dir), before and after this
change, and the result is the same except for having more variables
successfully replaced.

- Performance Note-
This new implementation is actually faster than the previous one,
because we don't need to iterate through all known keys on each line of
the APKBUILDs. On my machine, average of 3 runs, parsing all APKBUILDs
of current pmaports master takes about half as long as with the previous
implementation.

  $ time pmbootstrap -q apkbuild_parse >/dev/null

-> old code: 0.954
-> new code: 0.483
2024-04-17 17:05:09 +02:00
Oliver Smith
8efee86388
test/test_parse_apkbuild: fix running standalone (MR 2300)
Add the "args" pytest.fixture to each test as argument, so it runs the
related code of initializing logging and the cache (see top of the
test_parse_apkbuild.py). Without this, running the test file without any
prior tests (that do these initializations) is not possible:

  $ pytest -xvv test/test_parse_apkbuild.py
  …
  >       if path in pmb.helpers.other.cache["apkbuild"]:
  E       TypeError: 'NoneType' object is not subscriptable
2024-04-17 17:05:05 +02:00
Oliver Smith
db163aded6
Print ERROR: infront of {NonBug,BuildFailed}Error (MR 2298)
Make the handling of the custom NonBugError and BuildFailedError
exceptions more consistent with the handling of other exceptions, by
printing "ERROR: " infront of the actual error text. Then we don't need
to duplicate that where we raise the errors. pmbootstrap prints "ERROR"
in red.
2024-04-16 19:41:13 +00:00
Clayton Craft
888026e95d
pmb.config.apkbuild_attributes: add sha512sums (MR 2296)
Useful for pmaports CI, see:
https://gitlab.com/postmarketOS/pmaports/-/merge_requests/4994#note_1842433422
2024-04-16 19:09:40 +00:00
Oliver Smith
0d320d0613
pmbootstrap status: rework (MR 2294)
Reimplement "pmbootstrap status" to be just a simple and useful status
overview. The previous version ran a bunch of checks every time, and
would fail on these even if pmaports was used for normal development:
  * "non-official" branch checked out in pmaports
  * pmaports.git is not clean

The information about aports.git was also considered not so useful upon
revisiting this command, since it is only used for "pmbootstrap
aportgen". Most users don't need this, and if the user runs this
command, it will tell if aports.git is outdated.

All of the above made the previous version unpleasant to use and I
suspect most people stopped using the command after trying it out a few
times and seeing the irrelevant but loud NOK complaints.

New version:

  $ pmbootstrap status
  Channel: edge (pmaports: master_staging_systemd)
  Device:  qemu-amd64 (x86_64, kernel: virt)
  UI:      console
  systemd: no (default for selected UI)

Old version (without --details it only shows NOK checks):

  $ pmbootstrap status --details
  [00:55:20] *** CONFIG ***
  [00:55:20] Device: qemu-amd64 (x86_64, "QEMU amd64")
  [00:55:20] Kernel: virt
  [00:55:20] User Interface: console
  [00:55:20]
  [00:55:20] *** GIT REPOS ***
  [00:55:20] Path: /home/user/.local/var/pmbootstrap/cache_git
  [00:55:20] - aports_upstream (master)
  [00:55:20] - pmaports (master)
  [00:55:20]
  [00:55:20] *** CHECKS ***
  [00:55:20] [OK ] Chroots zapped recently (or non-existing)
  [00:55:20] [OK ] aports_upstream: on official channel branch
  [00:55:20] [OK ] aports_upstream: workdir is clean
  [00:55:20] [OK ] aports_upstream: tracking proper remote branch 'origin/master'
  [00:55:20] [OK ] aports_upstream: up to date with remote branch
  [00:55:20] [OK ] aports_upstream: remote information updated recently (via git fetch/pull)
  [00:55:20] [OK ] pmaports: on official channel branch
  [00:55:20] [OK ] pmaports: workdir is clean
  [00:55:20] [OK ] pmaports: tracking proper remote branch 'origin/master'
  [00:55:20] [OK ] pmaports: up to date with remote branch
  [00:55:20] [OK ] pmaports: remote information updated recently (via git fetch/pull)
  [00:55:20]
  [00:55:20] NOTE: chroot is still active (use 'pmbootstrap shutdown' as necessary)
  [00:55:20] DONE!
2024-04-16 18:54:35 +00:00
Newbyte
56dfdd4ad3
CI: Always update packages (MR 2297)
In case the Docker image is outdated, this means we get the latest
bug fixes and such anyway.
2024-04-16 18:39:48 +00:00
Newbyte
63759a11f5
CI: Stop adding testing repository in before_script (MR 2297)
Both Ruff and Codespell have been moved to the community
repository in Alpine:

 - https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/62711
 - https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/64338
2024-04-16 18:39:48 +00:00
Newbyte
b7dd9bec69
CI: Use yaml anchor for global before_script (MR 2297)
The local before_script variable overrides the global one, which I
assume wasn't the intent when the local before_script was added to
mr-settings. As such, add an achor to ensure that the global one is run
too.
2024-04-16 18:39:43 +00:00
Clayton Craft
ca844038f1
Revert "pmb.build._package: build depends of subpackages (MR 2292)"
This patch caused a regression[1] that needs to be debugged/fixed, so
reverting in the meantime.

This reverts commit 8b0dfe489a.

1. https://gitlab.com/postmarketOS/pmbootstrap/-/issues/2341
2024-04-15 23:31:14 -07:00
Oliver Smith
8b0dfe489a
pmb.build._package: build depends of subpackages (MR 2292)
Make sure that we build depends of subpackages, to avoid errors like the
following:

* postmarketos-base has a subpackage postmarketos-base-nftables, which
  depends on postmarketos-config-nftables
* when pmbootstrap builds postmarketos-base with all its dependencies,
  it did not realize it depends on postmarketos-config-nftables through
  the subpackage, but it built it anyway
* when trying to install postmarketos-base-nftables, apk complains that
  there is no postmarketos-config-nftables:
  ERROR: unable to select packages:
    postmarketos-config-nftables (no such package):
      required by: postmarketos-base-nftables-32-r2[postmarketos-config-nftables]

This also adds the missing depenendencies to "pmbootstrap repo_missing",
which bpo uses to resolve dependencies.

Fixes: issue 2084
2024-04-12 14:03:15 +02:00
Oliver Smith
8bafa93bb2
pmbootstrap init: remove text about daily zapping (MR 2293)
Now that pmbootstrap displays a warning on stale chroots, we don't need
to show this at the end of "pmbootstrap init".
2024-04-11 21:50:35 +00:00
Oliver Smith
ed8e7c1f85
pmb.chroot.init: warn about outdated chroots (MR 2293)
Prepare to remove the outdated chroot check from "pmbootstrap status".
Display it when the user enters a stale chroot instead. This way the
user is more likely to see it, and we can make "pmbootstrap status" more
minimal (by removing all checks, in future patches).

Related: issue 1903
2024-04-11 21:50:30 +00:00
Newbyte
2972f1d36e
pmb: Handle BuildFailedError (MR 2288)
Also breaks out hinting printing code into its own function to avoid
repetition.

Closes https://gitlab.com/postmarketOS/pmbootstrap/-/issues/2068
2024-04-10 20:49:21 +00:00
Newbyte
d5badd1b0e
pmb.build._package: Raise BuildFailedError when build fails (MR 2288)
This allows us to differentiate between the build failing and any other
runtime error that may be raised from calling this function.
2024-04-10 20:49:21 +00:00
Newbyte
ac68535870
pmb.helpers.exceptions: Add BuildFailedError (MR 2288) 2024-04-10 20:49:07 +00:00
Oliver Smith
ae75f3b884
build: fix !pmb:crossdirect (MR 2291)
With the !pmb:crossdirect option, the crossdirect compilation method
gets disabled. This means there is no /native directory mounted inside
the foreign arch chroot, all binaries inside the foreign arch chroot are
supposed to run in QEMU. Handle this in the apk_wrapper.sh script that
we use to redirect abuild-apk to /native/usr/bin/abuild-apk.

Fix for (currently with master_staging_systemd branch):
  >>> upower: Analyzing dependencies...
  /usr/local/bin/abuild-apk: line 11: /native/usr/bin/abuild-apk: not found
2024-04-06 09:01:55 +00:00
Newbyte
b473f8786e
test.test_apk: Replace osk-sdl with unl0kr in apk install test (MR 2289)
See https://gitlab.com/postmarketOS/pmbootstrap/-/issues/2333
2024-04-04 10:59:58 +02:00
Newbyte
fe5fa422d9
pmb.install._install: Replace osk-sdl with unl0kr in nofde explanation (MR 2289)
See https://gitlab.com/postmarketOS/pmbootstrap/-/issues/2333
2024-04-04 10:59:58 +02:00
Newbyte
bd4d818cca
pmb.helpers.repo_missing: Replace osk-sdl with unl0kr in example (MR 2289)
See https://gitlab.com/postmarketOS/pmbootstrap/-/issues/2333
2024-04-04 10:59:58 +02:00
Newbyte
8a518c5304
pmb.flasher.frontend: Replace osk-sdl with Unl0kr in FDE reminder (MR 2289)
See https://gitlab.com/postmarketOS/pmbootstrap/-/issues/2333
2024-04-04 10:59:58 +02:00
Newbyte
d0277bd315
README: Replace osk-sdl with tinydm in newapkbuild example (MR 2289)
See https://gitlab.com/postmarketOS/pmbootstrap/-/issues/2333
2024-04-04 10:59:58 +02:00
Newbyte
d02801a8b3
pmb.chroot.apk: Use unl0kr instead of osk-sdl in example (MR 2289)
See https://gitlab.com/postmarketOS/pmbootstrap/-/issues/2333
2024-04-04 10:59:58 +02:00
Oliver Smith
11c2206970
require_bootstrap: ensure apkindex exists (MR 2287)
When the user attempts to build a package with systemd enabled,
pmbootstrap checks first if the postmarketos-base-systemd package is in
any of the APKINDEX files. Fetch the APKINDEXes before trying to find
the package in them.

I'm running into this currently with bpo, when attempting to build any
package from the master_staging_systemd branch.
2024-04-03 19:08:48 +00:00