Commit Graph

987 Commits

Author SHA1 Message Date
Daniele Debernardi 147082ec58 pmbootstrap init: Ask for hostname, default: device name (#1327)
* Save "" (empty string) in the user's config as hostname if the user
  let it default to the name of the device. That way, when the device
  gets changed, the user won't get the old device's name as hostname
  by accident.
* Add a test case
2018-03-17 18:41:41 +00:00
Attila Szöllősi 16af241e5e Fix regex in recovery installer (#1339)
Fixes #1322.
2018-03-17 18:25:39 +00:00
NotKit 960ae07618 Motorola Droid 4 (maserati) (#1039)
Note about PMOS_NO_SAFESTRAP kernel cmdline:
This can be used to forcefully skip SafeStrap partition mount in device
initramfs hook, for example when booting with droid4-kexecboot on device with
SafeStrap configured as well.
2018-03-16 20:26:20 +00:00
Bhushan Shah ab47a29b7d Export some environment variables when starting plasma (#1341)
This environnment variables provides better integration and themeing to
various components and is inline with what reference Plasma Mobile
images is doing

Signed-off-by: Bhushan Shah <bhush94@gmail.com>
2018-03-16 19:42:48 +00:00
alive4ever c05ddc6824 recovery-installer: include tar inside recovery.zip (#1337)
busybox tar applet is messing with symbolic link extraction. Include GNU
tar binary to handle tarball extraction correctly.
2018-03-15 22:16:50 +00:00
Oliver Smith 5ea00e0862
pmbootstrap newapkbuild: Properly parse arguments (#1320)
* pmbootstrap newapkbuild: Properly parse arguments

The `pmbootstrap newapkbuild` action wraps Alpine's `newapkbuild`. We
used to directly pass all arguments to `newapkbuild` without verifying
in Python whether they make sense or not. However, as `newpakbuild`
doesn't do strict sanity checks on the arguments, it is easy to end up
with unexpected behavior when using the command for the first time.

For example, `newapkbuild` allows either specifying a PKGNAME or SRCURL
as last parameter, and also allows setting a PKGNAME with the `-n`
parameter. It only makes sense to use that option when passing a
SRCURL.

With this commit, we duplicate the optins that should be passed through
to `newapkbuild` and use argparse to fully sanitize the options and
display a help page (`pmbootstrap newapkbuild -h`) that is consistent
with the other help pages.

Details:
* The `-f` (force) flag does not get passed through anymore. Instead we
  use it in Python to skip asking if an existing aport should be
  overwritten (the aports are outside of the chroot, so `newapkbuild`
  can't handle it in a way that makes sense for pmbootstrap).
* Output of `newapkbuild` gets redirected to the log file now, as we
  don't need it to display a help page.
* Don't verify the pkgver while creating the new APKBUILD. When passing
  a SRCURL, the pkgver gets extracted from the end of the URL and may
  not have a valid format yet (but we want the APKBUILD anyway).
* Stored options passed through in `pmb/config/__init__.py` and use it
  in both `pmb/parse/arguments.py` and `pmb/helpers/frontend.py`.
* Only allow `-n` with SRCURL
* The postmarketOS aports folder gets specified with `--folder` now.
  That way the generated help page is much closer to the original one
  from `newapkbuild`. The default is `main`.
* Made the package type flags (CMake, autotools, ...) exclusive so only
  one of them can be specified
2018-03-15 21:42:34 +00:00
Bhushan Shah e7c18f6c48 Add kwayland-integration to plasma-mobile dep (#1338)
* Add kwayland-integration packaging
* Make postmarketos-ui-plasma-mobile depend on kwayland-integration
2018-03-15 21:40:52 +00:00
Oliver Smith 2a096e6a56
Qemu test case: wait dynamically until booted (#1330)
We have a test case, that performs full installations with with XFCE4
and Plasma Mobile. After each installation is through, we run
"pmbootstrap qemu" and connect to the VM via SSH to check for specific
running processes.

Before this commit, we assumed that the boot takes 90 seconds at most
and then the processes should exist. But sometimes the boot is faster
(so Travis waits just doing nothing) and sometimes it is slower (which
causes the test case to fail), all depending on the current workload
of the Travis CI servers. Now we try to find the processes we're
interested in each second for 3 minutes until we either succeed or
reach the time limit.
2018-03-14 21:24:13 +00:00
alive4ever e5e5fdd512 linux-xiaomi-armani: disable kgsl 3d driver (#1334)
The kgsl 3d driver causes the device to boot loop, so disable this for
now.

The device boots ok after removing the kgsl driver, although continuing
boot from debug-shell via `pmos_continue_boot` does not work (seems to
be a bug in msm_fb driver). So, one has to reflash the boot partition
generated with no intfs debug shell to enjoy this improvement.
2018-03-14 21:15:06 +00:00
Oliver Smith f75ac13a4f
Travis CI: folded output/default tracebacks (#1331)
* Moved the `script` and `after_failure` sections of `.travis.yml`
  to extra files in a new `.travis/` folder
* Copy paste `.travis/common.sh` from Alpine's aport. They have neat
  formatting functions in there for folding
* Add a folding block around each script that gets called
* Use native tracebacks in pytest. These are the same as we see when
  pmbootstrap crashes usually, instead of printing out the entire
  function that causes an error. I think this makes the error output
  easier to read.
2018-03-14 20:32:47 +00:00
Decatf 49e15b322c samsung-p4wifi: Load wifi modules, add audio output, remove touch screen calibration (#1328)
* [samsung-p4wifi] Include modules in kernel package
* [samsung-p4wifi] Load wifi modules at boot
* [samsung-p4wifi] Use mainline wm8994 sound driver
* [samsung-p4wifi] Add ALSA UCM config
Generated from xml2ucm tool.
* [samsung-p4wifi] Add headphone jack detect udev rules
* [samsung-p4wifi] Remove touchscreen calibration
It is not a resistive touchscreen. The default calibration works.
2018-03-13 19:39:07 +00:00
Oliver Smith d3818cd2e7
device-zte-kis3: Fix sdcard installation
There was a space at the end of the line, which the deviceinfo
parser couldn't handle. Fixes #1325.
2018-03-12 21:17:32 +01:00
Daniele Debernardi 0aaa19a612 postmarketos-ui-xfce: Update to 0.2 (#1326)
* Add default icon theme
* Set pmOS wallpaper
* Add battery icon in top panel
* Use builddir (so --src works)
2018-03-12 19:17:36 +00:00
Oliver Smith 255c715624
Fix aportgen without initializing buildenv
After initializing the build environment, the cache_distfiles folder
currently is writable by everyone (which is not ideal, fix following
soon). The aportgen code for `busybox-static-*` and `musl-*` copies
the foreign arch `.apk` file to the distfiles, but it executes this
action as regular user and not as root. This only works as long as
build initialization ran before (which may not be the case on Travis
and expecting this to run before is a bug in general).

With this commit, the copy action gets executed as root, so it works
in any case. I'm commiting this directly (without a PR), because it
is a super simple fix and it unblocks our continuous integration.

Local testing:
$ pmbootstrap -y zap
$ sudo rm -r ~/.local/var/pmbootstrap/cache_distfiles
$ pmbootstrap aportgen musl-armhf
2018-03-12 17:17:32 +01:00
Joey Hewitt 263578ec43 i9195/Qualcomm modem support (#1314)
* Qualcomm MSM modem: 'rmtfs' support packages
* qcom_rmtfs: Server that talks to modem over IPC to allow it
  read/write data for its persistent storage. This is needed for it to
  boot, as well as periodically during usage. Added a patch that
  it expects the storage path symlinks in /etc instead of /boot.
* qrtr: IPC library for rmtfs
* libqipcrtr4msmipc: adapter library to make qrtr work on kernels with
  AF_MSM_IPC support. AF_QIPCRTR is the mainline equivalent since Linux
  ~4.7.
* msmipc-dev: Header files for qrtr and libqipcrtr4msmipc.
  Thanks to Bjorn Andersson <https://github.com/andersson> for rmtfs and
  qrtr.
* libsmdpkt_wrapper: adapter lib for QMI clients
  The SMD serial packet driver in Qualcomm kernels has, AFAICT, a bug
  in poll(); this works around it so that qmicli et al can work.
* i9195: firmware (modem only right now)
* add ofono (with patch for MSM devices)
  Based on Alpine's package.
* i9195: add modem support
* move all modem related packages to aports/modem
2018-03-11 15:59:09 +00:00
Oliver Smith b8f35d45b8
aportgen: Gracefully handle old aports_upstream (#1291)
In order to get cross-compilers, we generate a few aports (e.g.
binutils-armhf, gcc-armhf) automatically from Alpine's aports.
pmbootstrap was already able to perform a git checkout of Alpine's
aports repository. But it needed to be manually updated. Otherwise
the `pmbootstrap aportgen` command could actually downgrade the aport
instead of updating it to the current version.

After thinking about adding a dedicated pmbootstrap command for
updating git repositories, I thought it would be better to not open
that can of worms (pmbootstrap as general git wrapper? no thanks).

The solution implemented here compares the upstream aport version of
the git checkout of a certain package (e.g. gcc for gcc-armhf) with the
version in Alpine's binary package APKINDEX. When the aport version is
lower than the binary package version, it shows the user how to update
the git repository with just one command:

    pmbootstrap chroot --add=git --user -- \
        git -C /mnt/pmbootstrap-git/aports_upstream pull

Changes:
* `pmb.aportgen.core.get_upstream_aport()`: new function, that returns
  the absolute path to the upstream aport on disk, after checking the
  version of the aport against the binary package.
* Use that new function in pmb.aportgen.gcc and pmb.aportgen.binutils
* New function `pmb.helpers.repo.alpine_apkindex_path()`: updates the
  APKINDEX if necessary and returns the absolute path to the APKINDEX.
  This code was basically present already, but not as function, so now
  we have a bit less overhead there.
* `pmbootstrap chroot`: new `--user` argument
* `pmb.parse.apkbuild`: make pkgname check optional, as it fails with
  the official gcc APKBUILD before we modify it (the current APKBUILD
  parser is not meant to be perfect, as this would require a full shell
  parsing implementation).
* Extended `test_aportgen.py` and enabled it by default in
  `testcases_fast.sh`.  Previously it was disabled due to traffic
  concerns (cloning the aports repo, but then again we do a full KDE
  plasma mobile installation in Travis now, so that shouldn't matter
  too much).
* `testcases_fast.sh`: With "test_aport_in_sync_with_git" removed
  from the disabled-by-default list (left over from timestamp based
  rebuilds), there were no more test cases disabled by default. I've
  changed it, so now the qemu_running_processes test case is disabled,
  and added an `--all` parameter to the script to disable no test
  cases. Travis runs with the `--all` parameter while it's useful to
  do a quick local test without `--all` in roughly 2 minutes instead of
  10.
* `aports/cross/binutils-*`: Fix `_mirror` variable to point to current
  default Alpine mirror (so the aportgen testcase runs through).
2018-03-11 14:18:21 +00:00
Oliver Smith 1d1a33e38a
Update busybox-static-* to upstream (1.28.1-r0) 2018-03-11 15:06:27 +01:00
Oliver Smith 3666388619
Properly escape commands in pmb.chroot.user() (#1316)
## Introduction
In #1302 we noticed that `pmb.chroot.user()` does not escape commands
properly: When passing one string with spaces, it would pass them as
two strings to the chroot. The use case is passing a description with
a space inside to `newapkbuild` with `pmboostrap newapkbuild`.

This is not a security issue, as we don't pass strings from untrusted
input to this function.

## Functions for running commands in pmbootstrap
To put the rest of the description in context: We have four high level
functions that run commands:
* `pmb.helpers.run.user()`
* `pmb.helpers.run.root()`
* `pmb.chroot.root()`
* `pmb.chroot.user()`

In addition, one low level function that the others invoke:
* `pmb.helpers.run.core()`

## Flawed test case
The issue described above did not get detected for so long, because we
have a test case in place since day one, which verifies that all of the
functions above escape everything properly:
* `test/test_shell_escape.py`

So the test case ran a given command through all these functions, and
compared the result each time. However, `pmb.chroot.root()`
modified the command variable (passed by reference) and did the
escaping already, which means `pmb.chroot.user()` running directly
afterwards only returns the right output when *not* doing any escaping.

Without questioning the accuracy of the test case, I've escaped
commands and environment variables with `shlex.quote()` *before*
passing them to `pmb.chroot.user()`. In retrospective this does not
make sense at all and is reverted with this commit.

## Environment variables
By coincidence, we have only passed custom environment variables to
`pmb.chroot.user()`, never to the other high level functions. This only
worked, because we did not do any escaping and the passed line gets
executed as shell command:
```
$ MYENV=test echo test2
test 2
```
If it was properly escaped as one shell command:
```
$ 'MYENV=test echo test2'
sh: MYENV=test echo test2: not found
```
So doing that clearly doesn't work anymore. I have added a new `env`
parameter to `pmb.chroot.user()` (and to all other high level functions
for consistency), where environment variables can be passed as a
dictionary. Then the function knows what to do and we end up with
properly escaped commands and environment variables.

## Details
* Add new `env` parameter to all high level command execution functions
* New `pmb.helpers.run.flat_cmd()` function, that takes a command as
  list and environment variables as dict, and creates a properly escaped
  flat string from the input.
* Use that function for proper escaping in all high level exec funcs
* Don't escape commands *before* passing them to `pmb.chroot.user()`
* Describe parameters of the command execution functions
* `pmbootstrap -v` writes the exact command to the log that was
  executed (in addition to the simplified form we always write down for
  readability)
* `test_shell_escape.py`: verify that the command passed by reference
  has not been modified, add a new test for strings with spaces, add
  tests for new function `pmb.helpers.run.flat_cmd()`
* Remove obsolete commend in `pmb.chroot.distccd` about environment
  variables, because we don't use any there anymore
* Add `TERM=xterm` to default environment variables in the chroot,
  so running ncurses applications like `menuconfig` and `nano` works out of
  the box
2018-03-10 22:58:39 +00:00
pikpok 571ddf741a peregrine: framebuffer patch and xorg config (#1318) 2018-03-10 22:29:56 +00:00
Bart Ribbers 4b4f9b0e6c Update KDE Frameworks to 5.44.0 (#1315) [skip ci] 2018-03-10 15:44:09 +00:00
Luca Weiss 5f27aa73cc Kernel updates (#1312)
* linux-postmarketos-stable 4.15.8 [skip ci]
* linux-postmarketos-lts 4.14.25 [skip ci]
2018-03-10 15:43:29 +00:00
Oliver Smith dc624aecea
Mount tmpfs in chroot's /dev folders (#1317) 2018-03-10 14:24:16 +00:00
Joey Hewitt 0269073cc1 i9195: add touchscreen to deviceinfo (#1313) 2018-03-10 13:59:25 +00:00
Ethan R. Jones d9ebfda2c7 Add ZTE Kis3 / ZTE Open C (#1311) 2018-03-10 13:52:09 +00:00
Oliver Smith af4b817c21
Skip virtual packages when parsing APKINDEX (#1278)
Since PR #1247 we are using the virtual package `.pmbootstrap` to mark
packages as not explcitly installed. In case `pmbootstrap` doesn't
finish the installation because of a bug, the `.pmbootstrap` virtual
package may not get uninstalled.

As virtual packages don't have the "timestamp" attribute set in the
package database (which indicates when the package was built), the
APKINDEX parser fails to parse them.

Changes:
* pmb.parse.apkindex.parse_next_block(): don't require the "timestamp"
  attribute to be set (but the arch attribute instead, which is always
  present)
* pmb.parse.apkindex.parse(): when a block does not have a `timestamp`
  attribute, skip it, because it must be a virtual package.
* add test cases for both functions with a package database that
  contains a virtual package.
2018-03-10 13:15:30 +00:00
Daniele Debernardi 4cad170844 [nokia-n900] Add swiss german keyboard layout (#1310) 2018-03-10 13:08:33 +00:00
Oliver Smith e72afc53fd
pmbootstrap zap -m: delete outdated packages too (#1306)
`-m` is for deleting local compiled packages, for which there is no
aport with the same version. Prior to this change, this only worked
for packages where no aport exists, or for packages that are newer
than the aports.

That is, because we used the usual APKINDEX parsing logic, which
ignores old packages in the APKINDEX and only returns the one with the
highest version (that makes sense during dependency resolution).

Changes:
* New `pmb.parse.apkindex.parse_blocks()` function that returns a raw
  list of blocks, instead of the dict with removed duplicates with
  lower version you get from the usual `.parse()` function.
* Renamed each of the zap flags and their descriptions to make clear
  what they are doing now.
  ```
  short  long (old)         long (new)
  -p     --packages         --pkgs-local
  -m     --mismatch-bins    --pkgs-local-mismatch
  -o,    --old-bins         --pkgs-online-mismatch
  ```
2018-03-10 12:08:02 +00:00
Oliver Smith 3510a4868f
Fix building packages by provides name (#1303)
Use case: `mkbootimg` provides the `unpackbootimg` package. When
running `pmb.chroot.apk.install(args,"unpackbootimg")`, it was not
able to properly build the package.

Reproducing the error:
```
sudo rm ~/.local/var/pmbootstrap/packages/x86_64/mkbootimg*
pmbootstrap index
pmbootstrap --mirror-pmOS="" chroot --add=unpackbootimg
```

Or alternatively (simpler but less illustrative):
```
pmbootstrap build unpackbootimg --force
```
2018-03-08 21:30:55 +00:00
Oliver Smith 508f352457
Update musl-* to upstream (1.1.19-r1) 2018-03-07 23:33:47 +01:00
Decatf 75e973a4d0 Fix gtk+2.0-maemo alternate subpackages (#1299)
Specifying alternate subpackages in the provides variable of the main
package means that the main package itself is providing an alternate for
the subpackages (e.g. gtk+2.0-maemo provides an alternate gtk+2.0-dev).
The provides variable must be set for each subpackage. Fixes #1284.
2018-03-07 22:38:02 +00:00
Daniele Debernardi 94306b51ee deviceinfo: remove external_disk_install and external_disk, use external_storage instead (#1301)
* deviceinfo: remove external_disk_install and external_disk, use external_storage instead
* Complain when external_disk* is used
2018-03-07 22:35:02 +00:00
Bart Ribbers 915dc8a049 Update Plasma to 5.12.3 (#1297) [skip ci] 2018-03-06 22:34:59 +00:00
Bhushan Shah 4bc8b06011 Depend on libepoxy-dev from kdeclarative (#1296) [skip ci]
Fixes the https://phabricator.kde.org/T7808
2018-03-06 22:34:08 +00:00
Luca Weiss 865e4bb1da Kernel updates (#1295) [skip ci]
* linux-postmarketos-mainline 4.16_rc4
* linux-postmarketos-lts 4.14.24
2018-03-06 22:32:56 +00:00
Daniele Debernardi aa4a01f14e Implement charging mode (#1285)
* Add charging-sdl package
* Include charging-sdl into the initramfs-extra
* [initramfs] Detect charging mode and use triggerhappy to start
charging-sdl when the power key is pressed
2018-03-05 22:59:23 +00:00
Daniele Debernardi db8c2d8407 Remove /etc/network/interfaces and networking service from device packages (#1293)
This is not necessary anymore since there is now NetworkManager.
2018-03-05 21:18:13 +00:00
Oliver Smith af6913ab06
Fix build --src for foreign-arch chroots (#1282)
The `suffix` argument was not specified in chroot commands executed in
`pmb.build._package.override_source()`. Because of that, it was not
possible to use "build --src" when compiling in a non-native chroot,
for example:

```
$ pmbootstrap build hello-world --arch=armhf
...
(native) % rm /tmp/APKBUILD.append
rm: can't remove '/tmp/APKBUILD.append': No such file or directory
```
2018-03-05 21:04:28 +00:00
Decatf 0f413db387 New device: Samsung Galaxy Tab 10.1 (p4wifi) (#1279) 2018-03-05 20:55:05 +00:00
Oliver Smith ac2a0b2749 convert dict.keys() to list() (#1290) 2018-03-04 21:10:27 +01:00
Oliver Smith 99127111a1
Only download APKINDEX for relevant architectures (#1201)
### Only download APKINDEX for relevant architectures
We're downloading the APKINDEX files for all architectures supported by
postmarketOS currently (x86, x86_64, armhf, aarch64). Most of the time,
we only need it for the native and device arch, so this PR reduces the
downloaded files to what is really necessary.

### Intuitive pmbootstrap update logic
* pmb.helpers.repo.update():
  * Default is updating all arches where the APKBUILD files exist
  * Add existing_only parameter
  * Return True when files have been downloaded
  * Properly print which arches will be updated
  * Print update reason only in verbose log
  * Add and improve comments
* pmb.parse.arguments(), update action:
  * Add --non-existing parameter
  * Default for --arch is None (instead of arch.native)
* pmb.helpers.frontend.update():
  * Inform about --non-existing if no APKBUILDs have been updated
2018-03-04 13:44:27 +00:00
Oliver Smith e6bb96426b
linux-postmarketos-mainline: fix weston (x86_64) (#1283)
Since it works for linux-postmarketos-stable, I've simply copied over
the config, and ran "pmbootstrap menuconfig" on it again. Then it
worked again in Qemu.
2018-03-04 11:15:47 +00:00
Martijn Braam 6e69c8d905 postmarketos-base: Enable NetworkManager by default (#388) 2018-03-04 11:07:21 +00:00
Filip Matijević 0abf1557fe Fix Nokia N9 build and update kernel (#1281)
* Remove unneeded dtb entry from deviceinfo
* Update Nokia N9 to kernel v4.16-rc3
2018-03-03 11:01:35 +00:00
Bart Ribbers a1ae2b7084 Add NetworkManager and PulseAudio applets to Plasma (#1040)
* Add NetworkManager and PulseAudio applets to Plasma
* This crashes plasma mobile on armhf (where it is not usable due
  to performance problems anyway), except on mainlined kernels
  with hardware accelerated graphics. This is mentioned in the
  pkgdesc of postmarketos-ui-plasma-mobile now.
2018-03-02 21:07:18 +00:00
Luca Weiss 50e293f035 Kernel updates (#1280)
* linux-postmarketos-stable 4.15.7
* linux-postmarketos-lts 4.14.23
2018-03-01 23:53:19 +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 25256ae4a1
Bump pkgrel of qt5-qtbase and db8
Upstream soname bumps, these don't exist anymore:
* so:libicui18n.so.59
* so:libicuuc.so.59
2018-02-28 21:49:48 +01:00
Daniele Debernardi e694e00d85 Use default partitions in odin export if not specified in deviceinfo (#1271) 2018-02-28 01:28:36 +00:00
Oliver Smith c0eb991073
Update gcc-* to upstream: 6.4.0-r7 2018-02-27 23:24:21 +01:00
Bart Ribbers 74217d6001 Package the Plasma phone dialler (#1270)
* Package everything required for the Plasma dialler

* Improve build scripts

* Bump pkgrel of plasma-phone-components
2018-02-27 21:06:46 +01:00