Commit Graph

1837 Commits

Author SHA1 Message Date
Oliver Smith ab99fbd352
pmbootstrap install: add --ondev --cp
Allow to copy one or more files to the install chroot. It will be
possible to use this to put a non-pmOS image into the generated
installer OS.
2020-11-17 15:25:56 +01:00
Oliver Smith 89323a9afe
pmbootstrap install: add --ondev --no-rootfs
Skip building the postmarketOS rootfs, and allow either installing a
pre-built pmOS rootfs, or even another operating system.
2020-11-17 15:25:56 +01:00
Oliver Smith 89d350bd4e
install: embed_firmware: use correct suffix
Embed the firmware from the right chroot suffix. Previously it would
always use the rootfs_{args.device} chroot, which does not work anymore
with upcoming 'pmbootstrap install --ondev --no-rootfs' as there will
only be the installer_{args.device} chroot.
2020-11-17 15:25:55 +01:00
Oliver Smith 9d3e75c1ff
pmbootstrap install: properly count install steps
Get rid of hardcoded step numbers, even for the currently common steps.
With the upcoming --ondev --no-rootfs, we will need to skip the
hardcoded step 2 (create device rootfs).
2020-11-17 15:25:55 +01:00
Oliver Smith 6772f64198
pmbootstrap install: new func create_device_rootfs
Move related code from pmb/install/_install.py:install() to a new
create_device_rootfs() function in the same file, so it can be skipped
with the upcoming --no-rootfs parameter.
2020-11-17 15:25:55 +01:00
Oliver Smith 2a56a75c4f
pmb/parse/arguments.py: refactor 'install' args
Move the numerous "install" arguments into an own function (as it was
done with actions added later). Categorize the options and update the
help output, so the options are easier to understand.
2020-11-17 15:25:51 +01:00
Luca Weiss e6543332de
pmb/config/__init__.py: parse more APKBUILD attributes (MR 1990)
This will be required for an upcoming CI test
2020-11-16 21:46:43 +01:00
Oliver Smith fe6db08069
Prepare 1.24.0 release 2020-11-11 11:10:01 +01:00
Oliver Smith 108ed0f28b
pmbootstrap install: fix cryptsetup warning (MR 1984)
Create /run/cryptsetup before running "cryptsetup luksFormat" to fix:
	WARNING: Locking directory /run/cryptsetup is missing!
2020-11-11 10:43:26 +01:00
Oliver Smith 06d91897da
pmb/install/format.py: refactor luks related code (MR 1984)
format_and_mount_root() => format_luks_root():
* Rename to reflect what it's actually doing
* Move the FDE check from format_luks_root to the only caller
* Make arguments to "cryptsetup luksFormat" more readable

format_and_mount_pm_crypt() => format_and_mount_root():
* Rename to reflect what it's actually doing
* Don't overwrite device if doing FDE; instead provide the proper device
  in the caller

The old function names were for historic reasons, early on it was only
possible to create encrypted installations with pmbootstrap.
2020-11-11 10:43:21 +01:00
Oliver Smith 77a5dd1910
pmb.aportgen.linux: add gcc10 extern YYLOC patch (MR 1987)
Most downstream kernels need this patch to build with GCC-10, so add it
by default in the linux aport generator.
2020-11-10 12:06:36 +01: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
timbz d0b32b3b05
pmbootstrap deviceinfo_parse: new action (MR 1986)
Co-Authored-By: Oliver Smith <ollieparanoid@postmarketos.org>
2020-11-10 09:15:52 +03:00
Oliver Smith 4d3c14f6c1
flasher: heimdall-isorec: use kernel+dtb (MR 1986)
Use the dtb-appended kernel file, e.g. postmarketos-exynos4-dtb instead
of postmarketos-exynos4, if it is available. This is needed to flash a
mainline kernel with appended dtb to isorec devices.
2020-11-10 09:15:51 +03:00
Oliver Smith ac796121e2
pmb.flasher.run: proper check for None (MR 1986)
Change the 'not value' condition raising the '...value for this variable
is None!' error to 'value is None' so it doesn't raise when the value is
something else that evaluates to boolean False, like an empty string.

Remove the special treatment for $KERNEL_CMDLINE here by making it
default to empty string.
2020-11-10 09:15:51 +03:00
Oliver Smith fae2379d6b
pmb.parse.deviceinfo: parse kernel suffix (MR 1986) 2020-11-10 09:15:49 +03:00
Eyal Sawady 741b0f298f
pmbootstrap log: don't depend on non-POSIX getopt (MR 1988)
Signed-off-by: Newbyte <newbie13xd@gmail.com>
2020-11-09 14:29:25 -08: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
Oliver Smith 112e72b068
menuconfig: refactor get_arch() (MR 1985)
Simplify the logic by not even calling get_arch() if args.arch is set.
2020-10-30 17:33:33 +01:00
Oliver Smith e43ef5c22e
menuconfig: don't require --arch to match APKBUILD (MR 1985)
Do not verify that the architecture passed with --arch is part of the
arch variable in APKBUILD. This prepares to set 'arch=""' to temporarily
disable building packages. Users will still be able to run "pmbootstrap
menuconfig" on them by manually specifying the architecture.
2020-10-30 17:33:33 +01:00
Oliver Smith 13b96df350
pmbootstrap install: refactor: install_pkgs block (MR 1981)
Put all install_packages related lines into one block and fix up the
comments:
* The list of packages to be installed is not listed at this point (and
  it does not make sense there, if we would want to list it, it should
  be done in the next block at 'if args.build_pkgs_on_install).
* Remove "including the ones specified by --add", as it doesn't add any
  value.
2020-10-27 17:56:46 +01:00
Oliver Smith 340329599b
pmbootstrap install: refactor: move set_user() up (MR 1981)
Don't have the set_user() call weirdly between multiple commands
building the install_packages list. Move it up, together with the log
message announcing that the device rootfs is being built.

Update the comment above set_user(): there is no 'build' user anymore,
and at this point we only call it before actually installing the
packages for legacy reasons.
2020-10-27 17:56:46 +01:00
Oliver Smith fc1ba9ba7b
pmbootstrap install: don't screw up /etc/apk/world (MR 1981)
Do not attempt to upgrade packages in the rootfs chroot when running
"pmbootstrap install".

This was responsible for placing every single package in /etc/apk/world
(which should only hold the packages explicitly installed), because the
upgrade function was literally implemented as getting a list of
installed packages and explicitly running pmb.chroot.apk.install on each
of them. The intention was to rebuild these packages if they were outdated,
I guess I didn't realize that this makes /etc/apk/world unusable when I
introduced this three years ago in 51bdc243 ("Properly rebuild/install
packages when something changed").

Remove pmb.chroot.apk.upgrade altogether, because:
1) pmb.install.install builds and upgrades outdated pmaports
2) pmb.install.install is the only user of pmb.chroot.apk.upgrade
3) 'pmbootstrap init' is warning that the chroots do not get upgraded
   automatically, so let's not go against that expectation. users who
   want an updated rootfs chroot can simply run zap and install again.

Replace it with a call to pmb.helpers.repo.update, because we still need
to update the APKINDEX files before attempting to build/install the
generated list of packages.
2020-10-27 17:56:45 +01:00
yarl 864469531c
pmbootstrap qemu: add aarch64 big/little hack (MR 1983)
Workaround for qemu failing with:
  kvm_arm_vcpu_init failed: invalid argument.

Related: https://bugs.linaro.org/show_bug.cgi?id=1443
2020-10-20 22:34:08 +02:00
Oliver Smith 3f10399db3
pmbootstrap log: use tail -F, not -f (MR 1982)
Let tail attempt to open the file again, if it becomes inaccessible.
This is useful, when writing a reproducer that deletes pmbootstrap's
log.txt while at the same time running 'pmbootstrap log'.

(027724) [17:57:34] Done
tail: '/home/user/.local/var/pmbootstrap/log.txt' has become inaccessible: No such file or directory
tail: '/home/user/.local/var/pmbootstrap/log.txt' has appeared;  following new file
(003493) [17:57:35] % cd /home/user/.local/var/pmbootstrap/cache_git/pmaports; git remote -v
2020-10-07 20:50:14 +02:00
Oliver Smith 496be6f593
Prepare 1.23.0 release 2020-09-24 11:20:42 +02: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
Oliver Smith 5b55abd4d2
pmbootstrap aportgen: don't use CDN alpine mirror (MR 1963)
Use a deterministic mirror URL instead of CDN for aportgen. Otherwise we
may generate a pmaport that wraps an apk from Alpine (e.g. musl-armv7)
locally with one up-to-date mirror given by the CDN. But then the build
will fail if CDN picks an outdated mirror for CI or BPO.
2020-09-18 03:20:25 +03:00
Oliver Smith a870a69151
pmbootstrap kconfig edit: list all arches in error (MR 1957)
If a kernel is available for multiple architectures, let the user know
which architectures are available in the error message.
2020-09-16 21:38:16 +02:00
Luca Weiss 9815f81742
aportupgrade: use f-strings (MR 1964) 2020-09-16 20:31:31 +03:00
Luca Weiss 93f13277b9
aportupgrade: add support for specifying git ref (MR 1964)
This adds support for specifying an arbitrary git ref (e.g. commits,
tags, branches) to upgrade to. This can be useful if a specific commit
needs to be packaged instead of the latest available. Alternatively you
can also specify a branch to be used if the default branch is 'stable'
but 'develop' should be packaged.

This also removes old code to use the 'bionic' branch for UBports Lomiri
(formerly Unity 8) packages.
2020-09-16 20:31:04 +03:00
Henrik Grimler efd64f7714
Check if workpath/ is empty and in that case create workpath/version (MR 1975)
Fixes https://gitlab.com/postmarketOS/pmbootstrap/-/issues/1965
2020-09-14 19:01:19 +02:00
Antoine Fontaine 1b5120e24f
test/testcases_fast.sh: correct pmaports location (MR 1974)
This makes the script ask pmbootstrap what is the correct directory
instead of hardcoding the default value.
2020-09-12 10:35:37 +02:00
Linus Walleij be41c94c57
pmb.install.setup_keymap: Fix up keymaps for Nokia n900 (MR 1972)
The Nokia n900 XkbLayout is a bit peculiar and sometimes
join two keymaps into one, for example:

    Option "XkbLayout" "fise"

For the combined finnish/swedish layout. Add the common
joined keymaps, even if not all of these countries are
yet supported.

For details see:
https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/blob/master/symbols/nokia_vndr/rx-51

I also include this link in the code so no-one gets confused.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-08-31 16:02:04 +02:00
Martijn Braam 5d540ad4fb
pmb/install: warn if the target disk is larger than expected (MR 1956) 2020-08-31 13:05:20 +02:00
Ralf Rachinger 72e24f7f96
Use $XDG_CONFIG_HOME instead of hardcoded path (MR 1969) 2020-08-23 13:51:42 +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 9718fd294a
pmb.install.setup_keymap: fix fail on X11 setup (MR 1968)
Do not fail in "pmbootstrap setup" if a keymap was selected, but no
/etc/X11/xorg.conf.d path exists in the rootfs chroot. The grep output
is not empty in that case (it would be empty if the directory exists and
there are no matches), so we need to add this extra check:

	(rootfs_nokia-n900) % grep -rl XkbLayout /etc/X11/xorg.conf.d/
	grep: /etc/X11/xorg.conf.d/: No such file or directory
2020-08-12 01:16:09 +02:00
Oliver Smith e233b73949
pmb.config.mirrors_postmarketos: update URL (MR 1967)
Official pmOS binary package mirror is now mirror.postmarketos.org. The
old URL will stay functional as redirect.
2020-08-08 21:16:39 +02:00
Oliver Smith a498c3afab
Prepare 1.22.2 release 2020-08-05 11:02:08 +02:00
Oliver Smith 7c26c1e9e5
test_crossdirect_rust: run on stable channel (MR 1966)
This test is failing with Alpine edge, because x86_64 has a different
rustc version than armv7:
	found crate `std` compiled by an incompatible version of rustc

Run the test with the latest Alpine stable version instead, where it is
more likely that rustc has the same version across all arches.
2020-08-05 10:38:23 +02:00
Oliver Smith 554dbd73ba
pmb.chroot.apk_static.download: fix mirrordir (MR 1966)
When selecting the stable channel in "pmbootstrap init", do not attempt
to download apk-tools-static from the "edge" mirrordir. This stopped
working, because the version in the APKINDEX of v3.12 is different than
the one in edge now.

Fixes:
	Download http://dl-2.alpinelinux.org/alpine/edge/main/x86_64/apk-tools-static-2.10.5-r1.apk
	ERROR: HTTP Error 404: Not Found

Related: https://builds.sr.ht/~postmarketos/job/272760#task-pmbootstrap_build-123
2020-08-05 10:04:48 +02:00
Oliver Smith 505425491f
Prepare 1.22.1 release 2020-08-03 11:37:08 +02:00
Oliver Smith 78f43d254e
pmb.config.mirror_alpine: don't use CDN
Replace dl-cdn mirror with dl-2 temporarily to avoid "BAD signature"
errors.

This is related to the rebuild of Alpine edge x86, armhf, armv7 packages
against musl-1.2, that is currently going on. The packages are rebuilt
without a version change and therefore have the same resulting file
name, but a different checksum. Due to caching of the CDN and due to the
same file name, users may get an old package from before the rebuild.
The APKINDEX has a checksum of the new package, and so the download will
fail with a "BAD signature" error.

Alpine developers clear the cache every now and then, but this issue
will happen over and over again, until all packages are rebuilt (some
packages are still not rebuilt and have been disabled).

Let's switch back in two months or so.
2020-08-03 11:23:04 +02:00
Alexey Min aa88721b75
pmb.helpers.cli: fix TAB-completion of items with '-' (MR 1960)
Before this fix tab completion of names with hyphens were not done:
try for example to complete UI package name in 'pmbootstrap init' with
hyphen, like "plasma-mobile" / "plasma-desktop". Now this is handled
correctly (hyphen is not considered as delimeter).
2020-07-20 16:47:33 +02:00
Oliver Smith 44e099acc7
Prepare 1.22.0 release 2020-07-20 14:44:00 +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
Oliver Smith c8d581e749
pmbootstrap install --no-local-pkgs: new option (MR 1951)
Don't install locally compiled packages and package signing keys. This
will be used for the official images generated with pmbootstrap.
2020-07-15 16:47:51 +03:00
Oliver Smith 05849a9f80
pmbootstrap install: make building pkgs optional (MR 1951)
Add a question at the end of "pmbootstrap init", to ask if the user
wants to build outdated packages during "pmbootstrap install". Store the
result in the new pmbootstrap.cfg key "build_pkgs_on_install". I've put it at
the end, because it is a rather complicated question compared to the rest.

This is useful to speed up the installation for casual users who can now
avoid compiling packages. But also for the official images where we only
want to ship the official binary packages and not build anything
on-the-fly.
2020-07-15 16:47:43 +03:00
Mark Hargreaves 0aed64d661
pmb/helpers/frontend.py: fix pmbootstrap kconfig check --file (MR 1961) 2020-07-15 16:30:57 +03:00