Commit graph

2910 commits

Author SHA1 Message Date
jane400
3a9284da8a
pmb.parse.deviceinfo: add default for gpu_accelerated (MR 2340)
this fixes pmb.config.init: ask_for_ui.
2024-06-30 17:36:32 +02:00
jane400
0a1e3eeeb1
pmb.config: add default ui option for ask_for_ui (MR 2340)
Tweaked-By: Oliver Smith <ollieparanoid@postmarketos.org>
2024-06-30 17:36:08 +02:00
gompa
8390a093d8
Fix quotation reuse (MR 2336)
Python 3.10.12 fails without this patch:

File "/media/gompa/73d88639-a730-456c-a428-6d500b4020b7/pmbootstrap/pmb/parse/arguments.py", line 844 help="Alpine Linux mirror, default: " f"{default_config.mirrors["alpine"]}",
SyntaxError: f-string: unmatched '['

Related: https://peps.python.org/pep-0701/
(Commit message written by Oliver)
2024-06-24 21:55:53 +02:00
Newbyte
8c0bc2e0e8
pmb.helpers.frontend: Print paths as a shell-friendly string (MR 2337)
Instead of

    [PosixPath('/home/newbyte/.local/var/pmbootstrap/cache_git/pmaports')]

you get

    /home/neboula/.local/var/pmbootstrap/cache_git/pmaports

like before.

Fixes envkernel.sh failing during activation.

Closes https://gitlab.com/postmarketOS/pmbootstrap/-/issues/2378
2024-06-24 21:12:31 +02:00
Newbyte
d50ce1c59b
pmb: Annotate args (MR 2337)
Checking if TYPE_CHECKING avoids the circular dependency.
2024-06-24 20:59:06 +02:00
Newbyte
235d25618f
pmb.build.kconfig: Annotate None return types (MR 2337)
Otherwise mypy doesn't check the return type
2024-06-24 20:45:21 +02:00
Newbyte
706a853db0
pmb.build.kconfig: Install make and gcc (MR 2337)
Otherwise pmbootstrap can't run these a few lines later. I don't know
how this worked before, but this makes $ pmbootstrap kconfig migrate
function again.
2024-06-24 20:35:51 +02:00
Newbyte
cf35e12c03
pmb.build.kconfig.get_arch: Return Arch instead of str (MR 2337)
crosscompile() in autodetect.py expects <arch> to be an Arch type
instead of a str, which is also probably what we want to move the entire
codebase towards. As such, let's convert this string into an Arch here.
2024-06-24 20:26:47 +02:00
Newbyte
b07fb4b24f
pmb.build._package: Move comment to docstring (MR 2337)
This explains a parameter, so let's put it in the right place.
2024-06-24 20:23:01 +02:00
Newbyte
ca6d0eba28
pmb.build: Properly type cross-compilation types (MR 2337) 2024-06-24 20:23:01 +02:00
Hugo Osvaldo Barrera
d6d088b68b
Remove needless lint exceptions (MR 2334)
- Ruff won't complain about long lines which end in a long URL.
- The typing exception is no longer required.
2024-06-24 13:14:40 +02:00
Oliver Smith
c4e7878832
ci/ruff format: display diff when it would make changes (MR 2331) 2024-06-24 13:12:04 +02:00
Oliver Smith
0155c4227a
kconfig edit: don't run check right afterwards (MR 2329)
This is currently broken, and I'm about to rewrite a lot of related
code. Just don't run the check for now, we can bring this back
afterwards if we want to.
2024-06-23 19:16:26 +02:00
Oliver Smith
5acd280823
pmb.build.kconfig.menuconfig: fix f-string + arch (MR 2329)
Fix for:
  TypeError: can only concatenate str (not "Arch") to str
2024-06-23 19:16:26 +02:00
Oliver Smith
a8413c61a5
pmb.chroot.run.user: fix missing return (MR 2329)
Fix broken output_return=True, causing "pmbootstrap kconfig edit" to
break.
2024-06-23 19:16:26 +02:00
Oliver Smith
2cf80bb534
gitlab-ci: remove 'allow_failure: true' (MR 2327)
Now that it is all passing, let's keep it that way!
2024-06-23 19:13:57 +02:00
Oliver Smith
18fa4e58a3
Ruff: fix typing.Xxx is deprecated, use xxx instead (MR 2327) 2024-06-23 19:13:57 +02:00
Hugo Osvaldo Barrera
61cb4f4abb
Enable the UP family of lints (MR 2327)
These are based on the originally from pyupgrade. They replace older
syntax with newer (and more concise) syntax. Some of the replaced syntax
is deprecated.
2024-06-23 19:13:57 +02:00
Hugo Osvaldo Barrera
cebd784d84
Prefer f-strings (MR 2327) 2024-06-23 19:13:57 +02:00
Hugo Osvaldo Barrera
8057715e83
Use Python 3.8-style type annotations (MR 2327) 2024-06-23 19:13:57 +02:00
Hugo Osvaldo Barrera
acd938c6b2
Remove super() syntax from Python 2.0 (MR 2327) 2024-06-23 19:13:57 +02:00
Hugo Osvaldo Barrera
f3f392ef66
Use simplified Python 3.8 syntax (MR 2327)
This commit was generated with:

    ruff check --fix --extend-select=UP .
2024-06-23 19:13:52 +02:00
Hugo Osvaldo Barrera
fa2a7c502d
Remove exception for lint (MR 2328)
There are no violations of this lint any more. This lint only checks
that an import is the beginning of a block; it will not be a problem if
a test needs to include an import.
2024-06-23 17:44:24 +02:00
Hugo Osvaldo Barrera
8398bc1218
Do not use bare except (MR 2325)
A bare except catches things like ctrl+c (KeyboardInterrupt). If don't
want to catch this exception. Remove the bare except and restore the
default lint.
2024-06-23 15:40:13 +02:00
Hugo Osvaldo Barrera
cb4aa809e1
Check python formatting in CI (MR 2325)
Fixes: https://gitlab.com/postmarketOS/pmbootstrap/-/issues/2324
2024-06-23 15:40:13 +02:00
Hugo Osvaldo Barrera
e421bb2d41
Auto-format codebase with ruff (MR 2325)
See: https://gitlab.com/postmarketOS/pmbootstrap/-/issues/2324
Closes: https://gitlab.com/postmarketOS/pmbootstrap/-/merge_requests/2278
2024-06-23 15:40:13 +02:00
Hugo Osvaldo Barrera
5a8e2c6cad
Converge supported Python onto 3.9 (MR 2326)
Python 3.9 was required in pmb/__init__.py already, but some references
still said 3.8 and 3.7.

Co-Developed-By: Oliver Smith <ollieparanoid@postmarketos.org>
2024-06-23 15:37:19 +02:00
Clayton Craft
a7f288634f
pmb.qemu.run: only set show-cursor when display!=none (MR 2309) 2024-06-23 13:30:29 +02:00
Andrew Robbins
1c3572dee2
Correct btrfs subvolume creation in install step (MR 2319)
btrfs can only create a single subvolume at a time.
2024-06-23 13:10:47 +02:00
Oliver Smith
6ebd4cccb9
README: mention 3.0.0_alpha 2024-06-23 12:49:25 +02:00
Caleb Connolly
0fe6244f3c
sideload: fix double semicolon (MR 2252)
flat_cmd and everything really needs cleaned up.

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
2024-06-23 12:38:42 +02:00
Caleb Connolly
b89e300c26
tests: fix tests (MR 2252)
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
2024-06-23 12:38:42 +02:00
Caleb Connolly
e6c737f342
ruff: run check --fix (MR 2252)
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
2024-06-23 12:38:42 +02:00
Caleb Connolly
cb6cd3bc4c
chroot: apk: safety net when chroot unitialized (MR 2252)
We recently changed how we manage chroots, requiring the user (of the
chroot) to initialize it before doing stuff like installing packages.

There are however still certain edgecases in pmbootstrap where this
doesn't get done (for example qemu/run.py would attempt to install the
kernel package for the device, but we don't initialize the rootfs chroot
in QEMU since that doesn't make sense to do). Check for and catch this
situation explicitly so we don't ruin someones day, but still be loud
about it so we can hopefully catch the remaining instances of this.

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
2024-06-23 12:38:42 +02:00
Oliver Smith
794048e2d5
pull: fix aports branches not being recognized (MR 2252)
Fix for:
  $ pmbootstrap pull
  [21:09:43] aports_upstream (branch: 3.20-stable): not on one of the official branches (master), skipping pull!

Replace the get_branches_official() function that according to git log
was never able to tell if an aports branch was official. The new
function branch_looks_official() can do that by just checking if the
branch follows the typical naming pattern.

The comment I had put into get_branches_official earlier was not true
anymore, by now this did not only get used by "pmbootstrap status", but
also by "pmbootstrap pull".
2024-06-23 12:38:42 +02:00
Oliver Smith
ef594ddf24
pmb/commands/pull: fix path error with f-string (MR 2252)
Fix for:
  TypeError: can only concatenate str (not "PosixPath") to str
2024-06-23 12:38:42 +02:00
Oliver Smith
9e2bbf80e0
pull: move to pmb/commands/pull.py (MR 2252)
Fixes:
  TypeError: pull() takes 0 positional arguments but 1 was given
2024-06-23 12:38:42 +02:00
Oliver Smith
e2461f00a2
Set version to 3.0.0_alpha (MR 2252)
Let pmbootstrap display 3.0.0_alpha on crash, so it's clear when people
are using the new codebase.

  Before you report this error, ensure that pmbootstrap is up to date.
  Find the latest version here: https://gitlab.com/postmarketOS/pmbootstrap/-/tags
  Your version: 3.0.0_alpha
2024-06-23 12:38:42 +02:00
Caleb Connolly
9fdf49ef0e
flasher: f-string fixes (MR 2252)
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
2024-06-23 12:38:42 +02:00
Caleb Connolly
8ecbf1a7de
chroot: apk: don't filter out local packages (MR 2252)
This turns out to have been wrong, since we need to give apk the package
name AND the apk file, it installs the apk and then uninstalls it but
leaves the package installed by name.
2024-06-23 12:38:42 +02:00
Caleb Connolly
fe079c8676
qemu: don't try and install stuff in rootfs (MR 2252)
Don't try and install random packages in the rootfs chroot when starting
QEMU. The chroot is not initialised and this just adds latency.

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
2024-06-23 12:38:42 +02:00
Caleb Connolly
2472e4c612
Revert "build: init: install pigz" (MR 2252)
Nope, abuild doesn't get along with it at all.

This reverts commit 91a4cfdc9a.
2024-06-23 12:38:42 +02:00
Caleb Connolly
d4d6382897
helpers: pkgrel_bump: fix formatting (MR 2252)
f-strings

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
2024-06-23 12:38:42 +02:00
Caleb Connolly
099bd2f4fa
treewide: remove rogue leading slashes (MR 2252)
One flaw of pathlib is that Path("/tmp/") / "/some/relative/path"
results in Path("/some/relative/path")....

Fix the places in the codebase where we get this wrong.

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
2024-06-23 12:38:42 +02:00
Caleb Connolly
9fff9033f2
build: init: install pigz (MR 2252)
faster, better..

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
2024-06-23 12:38:42 +02:00
Caleb Connolly
ac148da791
chroot: apk: recurse depends for locally built packages (MR 2252)
Turns out this is necessary, *sigh*. Since we could have one locally
built package depend on another locally built package.

So yeah, re-implement this, but in a slightly lazier / hopefully faster
way.

Bah

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
2024-06-23 12:38:42 +02:00
Caleb Connolly
6f12c0c902
chroot: apk: check all channels for local package (MR 2252)
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
2024-06-23 12:38:42 +02:00
Caleb Connolly
139fd2b3e0
install: losetup: fix mount retry (MR 2252)
The retry mechanism here go lost along the way. Bring it back.

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
2024-06-23 12:38:42 +02:00
Caleb Connolly
ceaad5c291
build: move run_abuild and friends to a new file (MR 2252)
_package.py was getting pretty big. split the actual build steps out.

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
2024-06-23 12:38:42 +02:00
Caleb Connolly
700fe32cf5
build: init: de-dup apk add steps (MR 2252)
We install abuild and then immediately install more packages, make this
one step.

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
2024-06-23 12:38:42 +02:00