Commit graph

19 commits

Author SHA1 Message Date
10a051b090 build: add ability to override pkgdesc prefix/suffix when building from custom source
Signed-off-by: Vasiliy Doylov <nekocwd@mainlining.org>
2025-07-11 00:01:04 +00:00
Oliver Smith
3ea5a3433b
Revert "pmb: Make RunOutputTypeDefault and RunOutputTypePopen enums"
Revert the patch, as it breaks "pmbootstrap chroot".

This reverts commit 7d2f055bcb.
2025-07-10 23:53:54 +02:00
Newbyte
7d2f055bcb
pmb: Make RunOutputTypeDefault and RunOutputTypePopen enums
This allows us to get rid of some of the validation in sanity_checks()
as mypy handles this validation at "build time", and any typos in the
enum instantiation would be a runtime error rather than a silent
failure.

Additionally, it allows us to encode some of the behaviour of the
different output types into the type definition itself by using methods.

Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2642
2025-07-10 20:57:51 +02:00
Caleb Connolly
dcc4137ee8
FIXUP: build: abstract CrossCompile type logic
* Make CrossCompile a proper enum type rather than a string literal,
* Introduce methods to get the correct host/build chroots depending on the
  cross compile type and target architecture.
* Remove autodetect.chroot() since it doesn't do what we expect, adjust
  all users to use cross.build_chroot() instead.
* Refactor package building to correctly use cross.host_chroot() and
  cross.build_chroot().

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2568
2025-03-16 16:30:04 +01:00
Oliver Smith
bef3b43343
pmb.types.CrossCompileType: split up None
Replace None with the three things it is actually used for to make the
code easier to follow:
* "autodetect"
* "unnecessary"
* "qemu-only"

I've used the term "unnecessary" instead of "native", because "native"
was previously used for "cross-native", then "cross-native2" and it
still sounds similar to these.

Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2568
2025-03-16 16:30:04 +01:00
Oliver Smith
0625ece550
pmb.build.backend.run_abuild: remove cross default
This function doesn't handle the case of being called without a value
set for cross (it does not autodetect it) and callers don't expect that.
So unset the default value.

Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2568
2025-03-16 16:30:04 +01:00
Oliver Smith
9e0c4a8393
pmb.build: fix internal cross compiling names
Use the same names as in the documentation for:
"cross-native" (not "kernel")
"cross-native2" (not "native")

Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2568
2025-03-16 16:30:04 +01:00
Oliver Smith
53d705194f
build: print !tracedeps warning for cross-native 1
Building without !tracedeps is a problem with cross-native version 1 but
not version 2. Fix the warning.

Fixes: 2ee916f5 ("build: add pmb:cross-native2 (MR 2474)")

Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2568
2025-03-16 16:29:59 +01:00
Oliver Smith
06bd8d98a1
cross-native2: set CGO_CFLAGS, CGO_LDFLAGS (MR 2565)
Cross compiling go programs with cross-native2 fails for armv7, riscv64
and armhf unless we use CGO_ENABLED=1 in the APKBUILD (see related
aports issue).

Add --sysroot to CGO_CFLAGS, so cgo can find the includes and doesn't
fail with:

  go build -buildmode=pie -modcacherw -trimpath -buildvcs=false -ldflags "-s -w -X main.Version=2.6.1" -o mkinitfs ./cmd/mkinitfs
  # runtime/cgo
  _cgo_export.c:3:10: fatal error: stdlib.h: No such file or directory

Add it to LDFLAGS too for linking against libraries from the sysroot.

Related: https://gitlab.alpinelinux.org/alpine/aports/-/issues/15809
Related: https://stackoverflow.com/a/38835938
2025-03-09 15:27:27 +01:00
Caleb Connolly
09053af572
build: backend: remove trailing spaces (MR 2474)
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
2025-02-27 01:29:35 +01:00
Caleb Connolly
2ee916f5d6
build: add pmb:cross-native2 (MR 2474)
Set things up so that we can run abuild on the native chroot and use
it's cross compilation features rather than running it and the build
system through QEMU. This massively speeds up building when it works.

cross-native used to be quite limited in functionality and didn't
integrate into abuild itself, this commit fixes that.

Packages can opt-in to this by adding pmb:cross-native2 to their options
and configuring makedepends_host and makedepends_build.

This also speeds up building packages like postmarketos-initramfs since
it entirely avoids running commands through QEMU (usually abuild itself
would be run through QEMU).

Lastly, we preserve the old pmb:cross-kernel options, this can be used to
enable the old cross compiler behaviour which is used for cross
compiling kernels in pmaports. This allows them to keep being supporting
while we adapt them to the new cross-native2.

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
2025-02-27 01:29:35 +01:00
Newbyte
3061e702ab
pmb: Reformat with Ruff 0.9 (MR 2525)
See https://astral.sh/blog/ruff-v0.9.0
2025-01-15 22:35:02 +01:00
Newbyte
871a3128d8
docs, pmb: Add missing copyright headers (MR 2516)
I tried my best to get the right author based on git commit history, but
in the case of code being moved from one file to make another I might
have gotten something wrong.
2025-01-02 16:45:03 +01:00
Caleb Connolly
a72a60f546
core: pkgrepo: support arbitrarily named pmaports directories (MR 2470)
There was an oversight when this API was originally created and it
implicitly assumed that the pmaports repository was always named
"pmaports". This unfortunately broke some peoples workflows.

Introduce a new "pkgrepo_name()" function and adjust the codebase to use
it, as well as adjusting pkgrepo internally to special case the
"pmaports" repo so that it's always named pmaports no matter what the
directory itself is named.

This is probably more complexity than we should be dealing with here, we
should probably create a new type to encode this behaviour.

Fixes: #2412
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
2024-11-03 12:26:32 +01:00
Newbyte
225d8b30a0
pmb: Add lots of type hints (MR 2464) 2024-10-30 12:39:45 +01:00
Caleb Connolly
c5135ac62a
build: use get_pkgver() again (MR 2353)
During rework this got lost, re-incorporate it so packages built with
--src have a relevant pkgver.

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
2024-07-09 00:07:53 +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
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
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