Commit Graph

68 Commits

Author SHA1 Message Date
Caleb Connolly 8bc5366e60
parse: deviceinfo: arch is required (MR 2124)
The deviceinfo_arch property is required but not checked, this leads to
weird errors if not caught.
2021-10-17 17:44:18 +02:00
Alexey Min 5761a29f07
pmb.aportgen.binutils: fix for new binutils file conflict (MR 2116)
Newly generated binutils package has file conflicsts with
non-cross binutils.

  ERROR: binutils-2.37-r3: trying to overwrite usr/lib/bfd-plugins/libdep.so
         owned by binutils-aarch64-2.37-r3.

Fix the generator to produce package that does not include these plugins.
2021-09-29 23:41:58 +02:00
Bart Ribbers 4675def8e6
pmb/config: add required option for Waydroid support (MR 2109) 2021-09-13 21:10:05 +03:00
Oliver Smith bf02c72da7
test: add test_bootimg_mtk_mkimage_recovery (MR 2105)
Verify that using a Mediatek recovery boot.img file works with
bootimg_analyze. The mtk_mkimage-boot.img file is the twrp boot.img file
posted in pmbootstrap issue 2066.
2021-09-13 14:40:15 +03:00
Oliver Smith cd366859de
testdata: replace mtk_mtkimage-boot.img (MR 2105)
Replace the previous mtkimage-boot.img file, which were only the first 4
KiB of a mediatek boot.img file, with a full one. I made this full image
with pmbootstrap install for fairphone-fp1, it contains the kernel
packaged in pmaports.git master.

Reason for the replacement is, that the previous image did not contain
the label for the ramdisk. The current code ignored this, but upcoming
refactoring will test this more strictly and the dummy image will not
pass the test anymore.
2021-09-12 22:02:47 +02:00
afeuerstein 83c4f142e2
pmb.aportgen.gcc: sync makedepends of gcc aportgen to upstream (MR 2092)
Remove paxmark dep. Follow up to
1c6ba9f907,
which happened 5 months ago.

Fixup testdata too.
2021-08-10 01:16:54 +03:00
Newbyte 3c98cae230
kconfig check: require CONFIG_SWAP for zram (MR 2085)
While zram has uses outside of swap-on-zram, I would believe that the
main use of zram in postmarketOS is swap-on-zram. In addition to that,
I imagine many probably expect swap-on-zram to work if the zram kconfig
succeeds.
2021-07-17 18:11:50 -07:00
Anri Dellal d764b0de58
bootimg_analyze: Add support for boot header version 3 (MR 2073) 2021-07-07 04:43:24 +03:00
Clayton Craft 9d22989a88
kconfig: add missing options for nftables support to kconfig check (MR 2076)
I missed these when collecting the required kconfig options for
nftables, and it was a happy coincidence that the kernels I enabled the
nftables stuff on already had these enabled so that the initial kconfig
check passsed

test/kconfig: add missing nftables options
2021-07-07 04:24:07 +03:00
Dylan Van Assche e900ee169a
install: refactor embed_firmware and add test (MR 2069) 2021-06-26 20:11:36 +02:00
Clayton Craft 6afd35eb11
kconfig check: add support for checking zram options (MR 2075)
Device kernels that enable zram support can use `pmb:kconfigcheck-zram`
to protect against kconfig regressions that disable support for zram.
2021-06-23 21:17:41 -07:00
Clayton Craft 599d74ec25
kconfig check: add support for nftables (MR 2042) 2021-06-14 21:50:45 +02:00
Oliver Smith 1481e69981
pmb.aportgen.binutils: adjust to subpackages in if (MR 2048)
Adjust the code so subpackages="" stays empty even with the latest
version of Alpine's APKBUILD.
2021-05-19 22:15:36 +02:00
Oliver Smith 2a0128d48a
test/testdata/aportgen: update binutils APKBUILD (MR 2048)
Put Alpine's current binutils APKBUILD there, with the subpackages line
that currently breaks the generated pmaport.
2021-05-19 22:15:31 +02:00
Oliver Smith 278dfced61
Replace pmaports channels stable, stable-next (MR 2032)
Translate the pmaports channels "stable" to "v20.05" and "stable-next"
to "v21.03", so these have the same channel name as the pmaports.git
branch name.

The original plan was to switch the "stable" channel from the "v20.05"
branch to the "v21.03" branch when the release is done. However, now
that we are close to that, I'm realizing that this would not be useful.
It would lead to conflicts in the dir with locally built packages
(default: ~/.local/var/pmbootstrap/packages/$CHANNEL). And it would make
it awkward to go back to a previous branch (we may name it old-stable
for the time being, but what after that, old-old-stable?).
2021-03-18 18:58:13 +01:00
Luca Weiss df58d35e27
kconfig check: require TMPFS_POSIX_ACL (MR 2025)
See pmaports!1939 and pmaports#904.
2021-02-09 23:11:31 +01:00
Minecrell 7dc2e197d3
pmb: Introduce support for "unmaintained" devices (MR 2018)
Unmaintained devices are device packages that:
  - Are known to be broken in some way without an active maintainer
    who can investigate how to fix it, or
  - Have not received any updates for a very long time, or
  - Are discouraged from using because they are just intended for testing.
    An example for this are ports using the downstream kernel for devices
    which have a mainline port that is working quite well.

Unmaintained devices are still built by bpo (otherwise it would not make
sense to keep them), but they do not show up in "pmbootstrap init".
However, it is possible to manually select them by entering the name.
pmbootstrap will warn in that case.

Unmaintained packages should have a # Unmaintained: <reason> comment
in the APKBUILD, this comment is displayed in "pmbootstrap init"
so that the user knows why the device should not be used unless they
know what they are doing.
2021-02-05 00:39:16 +01:00
Minecrell 03b3b250a5
pmb.parse._apkbuild: Add function to parse maintainers of APKBUILD (MR 2018)
This can be used for CI checks in pmaports to ensure that:
  - Devices in main have >= 2 maintainers
  - Devices in community have at least one maintainer
2021-02-05 00:39:12 +01:00
Dylan Van Assche dd61d57b0e
pmbootstrap install: support _pmb_groups (MR 2010) 2021-01-27 08:38:53 +03:00
timbz 5e01477d64
test: add deviceinfo kernel suffix parsing (MR 1986)
Co-Authored-By: Oliver Smith <ollieparanoid@postmarketos.org>
2020-11-10 09:15:52 +03:00
Oliver Smith 0dfe489b78
pmbootstrap aportgen: replace arch=all with native (MR 1965)
Packages like binutils-*, busybox-static-*, gcc-*, grub-efi-*, musl-*
are only needed for the native architecture during cross compilation.
Don't bother with trying to build them for other arches to save time and
to avoid getting stuck frequently at "armv7/binutils-aarch64" etc.

A few people like to use pmbootstrap on aarch64 hosts (e.g. PineBook
Pro), so let's make it available for aarch64 again when we can build
aarch64 packages natively in CI and bpo. (They do get stuck there right
now, because of qemu user emulation.)

Related: https://gitlab.com/postmarketOS/build.postmarketos.org/-/issues/75
2020-09-21 17:48:34 +02:00
Luca Weiss 86d61b8012
pmb.parse.bootimg: detect mediatek header (MR 1955)
Some Mediatek devices have a special 512-byte header around the zImage
which must be generated so the device boots.

Support for that exists for a while in postmarketOS but detection was
missing. Add that.
2020-08-21 18:33:30 +02:00
Oliver Smith d8615a9cae
pmbootstrap install: support _pmb_recommends (MR 1962)
Let UI meta-packages specify apps in "pmb_recommends" to be explicitly
installed by default, and not implicitly as dependency of the UI
meta-package ("depends"). Therefore make these apps uninstallable,
without removing the meta-package.

Add pmbootstrap install --no-recommends to disable this feature.
2020-07-20 14:29:06 +02:00
Pellegrino Prevete 95762a229a
pmb/config/__init__.py: add CONFIG_USER_NS (for bubblewrap/flatpak) (MR 1943)
Also fix tests
2020-07-14 23:19:50 +03:00
Oliver Smith 05c013536d
pmb.config.cipher: set default to aes-xts-plain64 (MR 1958)
Replace aes-cbc-plain64 with the stronger cipher aes-xts-plain64.
CONFIG_CRYPTO_XTS is necessary for this, so require it in
"pmbootstrap kconfig check".

Related: https://gitlab.com/cryptsetup/cryptsetup/-/wikis/FrequentlyAskedQuestions#5-security-aspects
2020-07-11 13:24:21 +02:00
Oliver Smith ea710caafe
pmb/aportgen/binutils.py: pass apkbuild-lint (MR 1942) 2020-06-21 11:50:57 +02:00
Oliver Smith 654cc56062
pmb/aportgen/core.py: no quotes around some keys (MR 1942)
Don't print quotes for pkgname, pkgver, pkgrel. This is required to pass
apkbuild-lint.
2020-06-21 11:50:57 +02:00
Oliver Smith c0b80b26b5
pmb.aportgen.core.rewrite: no lines with empty val (MR 1942)
Avoid apkbuild-lint errors like:
	[AL5]:APKBUILD:15:variable set to empty string
2020-06-21 11:50:52 +02:00
Anjandev Momi 0ff9c5d471
pmbootstrap init: only display UIs for device arch (MR 1937)
Hide user interfaces that are not available for the selected device's
architecture.

Closes #1790
2020-06-02 09:18:39 +02:00
Oliver Smith 2d2ab1df56
testdata: update lg-mako deviceinfo (MR 1937)
Copy from current pmaports master, so pmbootstrap doesn't complain about
missing deviceinfo_codename when parsing it. Right now pmbootstrap
doesn't complain about this, but with the next patch it will attempt to
parse the file.

This replaces the year from 1337 to 2012 too, but let's rather have it
slightly more maintainable than introducing a diff for a funny reference.
2020-06-02 09:18:34 +02:00
Luca Weiss 6bb7f022b1
pmb: introduce deviceinfo_chassis (MR 1933)
"Chassis" defines the what kind of device a device is. Currently the
following standardized types exist:

  "desktop", "laptop", "convertible", "server", "tablet", "handset",
  "watch", "embedded", "vm", "container"

This property is exposed by org.freedesktop.hostname1 (e.g.
openrc-settingsd) and can be used by applications for example to display
appropriate strings instead of "About this phone" for non-phone devices.
2020-05-24 08:38:10 +02:00
Antoine Fontaine c5d0f76005
pmb.parse.kconfig: add tests (MR 1916) 2020-05-24 04:42:13 +02:00
Oliver Smith ce433ae012
pmb.helpers.repo.urls: use channels.cfg mirrordirs (MR 1912)
Use mirrordir_pmos and mirrordir_alpine from channels.cfg to generate
the mirror URLs for postmarketOS and Alpine, which get written to
/etc/apk/repositories and which postmarketOS uses to download the
APKINDEX files.

Remove hardcoded "master" at the end of the postmarketOS mirror and use
mirrordir_pmos instead (which is "master" for the edge channel). Let the
postmarketOS mirror end in a '/' for consistency with the Alpine mirror
in pmb/config/__init__.py.

Remove obsolete --alpine-version. To experiment with a different Alpine
version, one should pass a custom --config-channels from now on.
2020-05-17 08:08:45 +02:00
Oliver Smith c616874443
pmb.helpers.git: parse channels.cfg (MR 1912)
Prepare to base postmarketOS on Alpine stable by parsing the new
channels.cfg file in pmaports.git, that describes which channel
needs which branches and mirror dirs from postmarketOS and Alpine.

Use the information in pmb.helpers.git.get_branches_official() first,
more is coming in follow-up commits.

Read the file from origin/master, so we get the latest fetched version
even if the last checked out master branch is not up-to-date (think of
currently checked out release branch instead of master, master will
never be updated to point to latest origin/master). Allow to override
the file with a new --config-channels parameter.

Related: https://postmarketos.org/channels.cfg
2020-05-17 08:08:44 +02:00
Oliver Smith f3466dcd3f
pmbootstrap lint: use CUSTOM_VALID_OPTIONS (MR 1934)
Let apkbuild-lint check options again, and pass the pmbootstrap specific
options with the new CUSTOM_VALID_OPTIONS variable. Add a test case and
adjust pmb.helpers.lint.check to return the output of apkbuild-lint, so
we can properly test it.

Related: https://gitlab.alpinelinux.org/Leo/atools/-/merge_requests/28
Fixes: pmaports#553
2020-05-10 16:35:35 +02:00
Minecrell 87f81de052
test: test_questions_ui_extras: add tests for UI extras (!1911)
Ensure that it does not fail with the "none" UI (it does at the moment).
2020-04-11 20:57:01 +02:00
Minecrell 7f0898f1c5
test: test_questions_ui: use local aports (!1911)
This allows us to test the extras UI implementation without
modifying some packages in pmaports.
2020-04-11 20:57:01 +02:00
Oliver Smith 9d17ed29e3
pmb aportgen binutils: add texinfo to makedepends (!1901)
The current version of binutils does not build anymore without texinfo.

Related: #1894
Related: pmaports!1114
2020-03-31 23:33:41 +02:00
Minecrell fb8de5a553
pmb: Look for device/* files in device/*/... instead (!1879)
In the future, device ports will be located in a subdirectory
below device/... (e.g. device/testing/device-...).
Replace all occurrences of device/* with a glob that checks the
subdirectories instead.

Note: To ensure that this always works properly we should also add some
checks that all devices are indeed located under one of the supported
subdirectories (i.e. testing/community/main).

Change the glob for pmaports to <aports>/**/APKBUILD.
This allows using subdirectories for organization outside of device/
as well.
2020-03-14 08:44:16 +01:00
Minecrell 0997a46b3a
pmb: replace deviceinfo_date with deviceinfo_year, add to wizard (!1888)
See: https://gitlab.com/postmarketOS/pmaports/issues/447
2020-03-14 00:33:22 +01:00
Minecrell 7915e94275
pmb.config: remove deviceinfo_nonfree (!1888)
See: https://gitlab.com/postmarketOS/pmaports/-/issues/438
2020-03-14 00:33:22 +01:00
Minecrell 0e27713512
pmb.parse._apkbuild: Extend APKBUILD parser to work for subpackages (!1866)
At the moment we have a simple subpkgdesc() function that can only
parse "pkgdesc" from subpackages, without support for any variables.
But we have a quite nice variable parser now that can be extended
to work for subpackages.

Simply put this works by:
  - Finding the lines that belong to the subpackage function
  - Stripping indentation (tab)
  - Parsing relevant attributes similar to the apkbuild() function

The "subpackages" in the parsed APKBUILD are replaced by a dict
of subpkgname: {"pkgdesc": "...", "depends": "..."} which are
parsed from the subpackage function (if found).
This makes it possible to get the "depends" of a subpackage.
2020-02-19 14:56:57 +03:00
Minecrell 5f5050f9a3
pmb.parse._apkbuild: Replace variables immediately after parsing (!1866)
At the moment we parse all attributes, split them, and eventually
join them back together for variable replacement.

Replacing variables immediately after parsing (before splitting)
has several advantages:

  - No need to handle different value types
    (e.g. lists by joining them every time they are accessed)

  - Variables like depends="$depends ..." are handled directly
    by the variable parser

  - APKBUILDs are shell scripts, so we match abuild more closely
    if variables defined later do not affect previous attributes
2020-02-19 14:56:46 +03:00
Minecrell 7907e91879
pmb/parse/_apkbuild: Fix locating kernel subpackages with "-" in name (!1857)
When defining a new kernel subpackage with a "-" in it
(e.g. $pkgname-kernel-mainline-modem), then pmbootstrap is unable to
find the function that builds the subpackage:

ERROR: Could not find subpackage function, no line starts with 'kernel_mainline-modem() {'

This is because it assumes that a $pkgname-kernel-<name> subpackage
is built by a kernel_<name> function, but this does not have to be the case.

We should really respect the name of the subpackage function that
is specified when defining the subpackage, but unfortunately it is
stripped away in cut_off_function_names().

For now let's fix this by replacing "-" with "_", but ideally the
APKBUILD parser API should be refactored to expose the subpackage
function in the future.
2020-01-19 19:36:11 +03:00
Luca Weiss 2320e0100c
pmb/parse/_apkbuild: implement parsing for more variable styles (!1854)
Add a test for APKBUILD variable parsing as well
2020-01-19 11:30:59 +01:00
Oliver Smith 5076069209
pmb/aportgen/gcc.py: add LANG_D=false (!1849)
Alpine's APKBUILD for gcc supports a new language that we don't need, so
disable it just like the irrelevant ones.

Related: https://gitlab.com/postmarketOS/pmaports/merge_requests/839
2019-12-30 12:04:12 +01:00
lambdadroid 67b080b158
Detect if DTB is placed in second area of Android boot image (!1828)
postmarketOS/pmaports!700 adds a new "deviceinfo_bootimg_dtb_second"
option that places the DTB in the "second" area of the Android boot
image.

Attempt to detect this automatically by checking the extracted
second binary for the FDT magic (0xd00dfeed).
2019-10-25 17:36:22 +02:00
Daniele Debernardi 54e51759ad
aportgen: add feature to fork upstream packages (!1811)
This MR add the --fork-alpine argument to the pmboostrap aportgen
command, which downloads the APKBUILD and related files and copies them
into the pmaports/temp folder.
2019-09-14 01:39:11 +02:00
Daniele Debernardi ff50a5e382
aportgen: fix extra newline (!1811) 2019-09-14 01:26:49 +02:00
Oliver Smith f5db1b4306
apkbuild parser: support depends="$depends ..." (!1795)
Properly handle the following two cases in APKBUILDs:
* depends="$depends ..."
* depends="${depends} ..."

First I've attempted to refactor the parsing code to do this in a more
generic way. But I've realized that it would make more sense to retire
the python based APKBUILD parsing approach altogether and finally use a
shell script parser. Let's discuss this in #1801.
2019-07-03 23:55:21 +02:00