Commit Graph

30 Commits

Author SHA1 Message Date
Oliver Smith 185973fd97
Remove distcc support
With this code path, pmbootstrap would start a distccd + sshd in the
native chroot, and configure it so it runs the cross compiler. The
foreign arch chroots would then call this cross compiler from localhost
by calling the distcc client instead of gcc.

This code has been obsoleted by the much simpler crossdirect in 2019.
Let's finally remove it.

Fixes: issue 2179
Reviewed-by: Luca Weiss <luca@z3ntu.xyz>
Reviewed-by: Clayton Craft <clayton@craftyguy.net>
Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3C20230613161437.570196-4-ollieparanoid@postmarketos.org%3E
2023-06-15 08:31:03 +02:00
Oliver Smith 25b3530c4e
Remove --no-crossdirect argument
With an upcoming patch to remove the legacy distcc code, the
--no-crossdirect argument would do the same as --no-cross: perform the
build entirely in qemu. So remove the argument. I doubt anybody was
using it anyway.

Reviewed-by: Luca Weiss <luca@z3ntu.xyz>
Reviewed-by: Clayton Craft <clayton@craftyguy.net>
Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3C20230613161437.570196-3-ollieparanoid@postmarketos.org%3E
2023-06-15 08:31:03 +02:00
Caleb Connolly 204419fe49
build: make preferred target arch configurable
When invoking pmbootstrap build most packages default to the host arch,
however depending on your workflow it might be preferrable to default to
the device arch.

Add a new config option "build_default_device_arch" which when set will
make "pmbootstrap build" prioritise the device arch over the native
arch.

Default to False to preserve the old behaviour and don't ask during
pmbootstrap init as this may not be relevant for most folks.

Reviewed-by: Oliver Smith <ollieparanoid@postmarketos.org>
Co-developed-by: Oliver Smith <ollieparanoid@postmarketos.org>
Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3C20230418-build-default-arch-v5-2-5223fab65867@postmarketos.org%3E
2023-05-01 13:19:14 +02:00
Oliver Smith 9975d373b0
Bump copyright to 2023 2023-01-22 19:18:06 +01:00
Oliver Smith 6f6a3b0408
Happy new year 2022! 2022-01-02 22:39:14 +01:00
BO41 99bed38272
pmb.parse.apkbuild: remove unused args argument (MR 2136) 2021-11-27 14:13:33 +01:00
bo41 caf7973e24
args.arch_native: remove (MR 2130)
Replace "args.arch_native" with the direct function call in order to
avoid passing "args" to all functions. This is a step to get rid of this
args-passed-to-all-functions pattern in pmbootstrap.
2021-10-24 14:34:30 +02:00
Oliver Smith 1c791da482
treewide: bump copyright to 2021 2021-01-07 23:30:47 +01:00
Oliver Smith 173f90d796
Support arch="" in APKBUILD to skip builds (MR 1985)
Alpine indicates with arch="", that a package should temporarily not be
built for any architecture. Support this in postmarketOS too by not
complaining in the APKBUILD parser if arch is empty.

Adjust pmb.build.autodetect.arch and pmb.build.menuconfig.get_arch, so
both don't fail with an IndexError when encountering a disabled package.

Co-Authored-By: Luca Weiss <luca@z3ntu.xyz>
2020-10-30 17:33:33 +01:00
Antoine Fontaine 075706b26e
pmb/build: remove implicit native cross-compilation (MR 1941)
If a package want native cross compilation, it should explicit that
with "pmb:cross-native" in `options=`.
See https://gitlab.com/postmarketOS/pmbootstrap/-/issues/1910.
2020-05-21 08:03:50 +03:00
Luca Weiss 4d2af94794
pmb.build.autodetect: support !pmb:crossdirect (MR 1922)
In case a package can't be built using crossdirect, add an APKBUILD
option to unconditionally disable crossdirect and use the slower
distcc approach instead. This is needed e.g. when using LD_PRELOAD during
the build as crossdirect cannot work with that.
2020-04-25 11:56:20 +02:00
Oliver Smith 77a6ad03cb
pmb.build.autodetect: support pmb:cross-native (MR 1920)
Have explicit selection of the "native" cross compilation method with a
new "pmb:cross-native" option. Deprecate the implicit pkgname pattern
matching.

Related: #1910
2020-04-19 13:33:14 +02:00
Oliver Smith f21c216a26
Cosmetic: use SPDX license header (!1877)
While at it, also remove unnecessary "#!/usr/bin/env python3" in files
that only get imported, and adjust other empty/comment lines in the
beginnings of the files for consistency.

This makes files easier to read, and makes the pmbootstrap codebase more
consistent with the build.postmarketos.org codebase.
2020-02-24 03:11:10 +03:00
Oliver Smith 948e3f931f
Change copyright to 2020 2020-01-06 02:43:00 +01:00
Zhuowei Zhang 1fffe83df3
Add "crossdirect": faster cross compiling (!1758)
Launch native cross compilers inside foreign chroot. Enable by default,
but allow disabling with --no-crossdirect for now. This option and the
distcc-sshd related code will be removed in the future.
2019-03-23 01:13:36 +01:00
Oliver Smith f16bdaf0ca
Update copyright to 2019
Happy new year \o/
2019-01-02 09:31:20 +01:00
Oliver Smith a44b80b31d build.find_aport() -> helpers.pmaports.find()
Move find_aport() and find_aport_guess_main() from pmb/build/other.py
to the new file pmb/helpers/pmaports.py.

Finding aports is not only needed when building packages, hence it
makes sense to move it out of pmb.build. The pmb/helpers/pmaports.py
file will have more pmaports related functions in a follow up commit.
2018-12-01 21:30:59 +00:00
Oliver Smith 0f15951023
Always prefer native/device arch when building (#1277)
In case the user does not specify for which arch packages should be
built with `pmbootstrap build`, we detect it automatically.

Previous logic was, that if the APKBUILD's arch is "all" or "noarch",
then prefer the native arch, and otherwise use the first one in the
list of available arches.

New behavior is, that we also check if the list of possible arches
contains the native arch (and if that fails, the device arch). If that
is the case, we return the native/device arch instead of the first one
in the list.

### Use case

The arch from `gcc-armhf` and similar packages (as generated by
`pmbootstrap aportgen`) used to be "all", but is nowadays a specific
list of arches. This means, that after updating the `gcc-armhf` and
`gcc-aarch64` packages, and calling `pmbootstrap build gcc-armhf`,
it will try to build `gcc-armhf` for `aarch64` instead of the native
architecture, because that is the first one listed.
And since compiling to `aarch64` requires `gcc-aarch64`, it will build
that for the native architecture first.

So you're asking for `gcc-armhf` and it compiles `gcc-aarch64`, which
is very confusing (see #1272).
2018-03-01 20:04:51 +00:00
Oliver Smith 5e85d72ca0
Testsuite: Run UIs in Qemu and check running processes and more (#982)
* Testsuite: Run UIs in Qemu and check running processes (and other changes)

* When `pmbootstrap qemu` gets killed, it now takes down the Qemu process with it
* `test/check_checksums.py` got a new optional `--build` parameter, which makes
  it build all changed packages instead of just checking the checksums
* We run this before running the testsuite now, so all changed packages get
  built before running tests (otherwise tests would hang without any output
  while a changed package is building)
* New testcase, that zaps all chroots, installs a specific UI (xfce4 and
  plasma-mobile currently, easy to extend), runs it via Qemu and checks the
  running processes via SSH.
* Version checking testcase: rewritten to include Alpine's testsuite file in
  our source tree, so we don't need to clone their git repo anymore. Now it
  is enabled for Travis.
* All this gives us a nice 10% code coverage boost
* Increased the `hello-world` pkgrel to verify that the Travis job is working.

* Various fixes
* Build device-packages for the device arch and don't raise an
  exception, but print a note if --ignore-depends is not specified
  and therefore the kernel gets installed, too.
* Don't use --force when building in Travis (because abuild doesn't
  check the checksums then. Bug report on the way.)
* Don't run the building process in the background, but wait for its
  completion
* Exit with 1 when showing usage in check_checksums.py
2018-02-02 00:16:29 +00:00
Daniele Debernardi 3a01537332 Delete remaining legacy "repack" code path (#1154) 2018-01-23 21:23:33 +00:00
Daniele Debernardi 32a2599ac3 Add qemu-user-static-repack all architectures (#1136)
Also don't build "-repack" packages in native chroot anymore.
This was a legacy hack, which has no use anymore, and it prevented
the package from being built for different architectures.
2018-01-19 21:30:16 +00:00
Oliver Smith 7750c1dd40
Happy new year! (update copyright to 2018) 2018-01-04 04:53:35 +01:00
Oliver Smith e9ca68dc05
Fix #941: Use the right arch for foreign-arch-only packages (#943)
This is a follow-up to #935.

* fix regression #941: pmbootstrap doesn't automatically pick the
  right architecture for building when none is specified
* remove obsolete --noarch-arch parameter
2017-11-28 19:12:16 +00:00
Oliver Smith d3c77c39ac
Fix #824: Refactor pmb/build/package.py (make depends work like in abuild) (#935)
* Rename pmb/build/package.py to pmb/build/_package.py, so we can
  access the functions it contains in testcases, and still use
  pmb.build.package()
* Refactor the entire file. Instead of one big function that does
  too many things, we have many small ones now, that are tested
  in the testsuite and easier to modify
* Whenever building a package, pmbootstrap does not only build and
  install the "makedepends" (like we did before), now it does the
  same for the "depends". That's required to be compatible with
  abuild. The old behavior can still be used with 'pmbootstrap
  build --ignore-depends'.
* Because of that change, noarch packages can no longer be built in
  the native chroot if we need them for a foreign chroot. A device-
  package depending on a kernel would pull in the same kernel for
  the native architecture otherwise.
* Running 'pmbootstrap build device-...' without '--ignore-depends'
  and without a matching '--arch' displays a note that explains
  this change to the user and tells how to use it instead.
* Noarch packages no longer get symlinked. That was only
  implemented for packages built in the native chroot, and now that
  is not always the case anymore. Symlinking these packages creates
  packages with broken dependencies anyway (e.g.
  device-samsung-i9100 can't be installed in x86_64, because
  linux-samsung-i9100 is armhf only).
* Rename "carch" to "arch" wherever used. Naming it "carch"
  sometimes is confusing with no benefit.
* Add a testcase for the aarch64 qemu workaround (because it failed
  first and I needed to know for sure if it is working again).
* Improved some verbose logging, which helped with development of
  this feature.
* Removed the old "build" test case (which was disabled in
  testcases_fast.sh) as the new "build_package" test case covers its
  functionallity.
* Only build indexes if the packages folder exists for that arch (Travis
  couldn't run a test case otherwise)
2017-11-26 14:32:02 +00:00
Oliver Smith bed1eacbb5 Close #256: Implement strict package building mode (#532)
Contrary to abuild, pmbootstrap only installs makedepends, and
keeps the installed packages around - both hacks save lots of time.

However, they may introduce missing makedepends in the APKBUILDs,
that the authors of the APKBUILDs do not notice because it works
for them.

This PR adss a strict mode, which will always clean the chroots
before building a package, and also remove all installed dependencies
after the package was built. You can use the following syntax to
only zap once, but build many packages at once:
`pmbootstrap build --strict hello-world 0xffff heimdall`

It also builds dependencies properly without leaving makedepends
behind.
2017-09-08 23:50:59 +00:00
Oliver Smith 314c17e03c Close #194: Aports subfolders! See migration guide in the wiki (#227)
Migration guide:
https://github.com/postmarketOS/pmbootstrap/wiki/Migration-to-aports-subfolders
2017-07-28 22:34:40 +00:00
Oliver Smith 7e4024be97 Fix #260, fix #87: Don't cross-compile when not necessary (#265) 2017-07-26 19:01:44 +00:00
Oliver Smith dede11657d
Get rid of the _pmb_build_in_native_chroot hack 2017-07-05 18:40:00 +02:00
Oliver Smith a9e28c9b8b
Fix #89: Meaningful error message for missing arch in APKBUILD
The following message will be printed out now, in case you attempt
to build a package for an architecture, that is not specified in
the "arch=..." line inside the APKBUILD:

ERROR: Architecture 'aarch64' is not supported for this package.
Please add it to the 'arch=' line inside the APKBUILD and try again:
/path/to/APKBUILD
2017-06-15 02:44:43 +02:00
Oliver Smith bf387f0ef8
Add missing "build" folder (was gitignored before) 2017-05-26 22:35:21 +02:00