Commit Graph

1009 Commits

Author SHA1 Message Date
Oliver Smith 4d8afc4aa5
Fix: /var/cache/distfiles writable by everyone (#1329)
As noted in commit 255c715624
`/var/cache/distfiles` is writable by everyone. It is supposed to be
writable only by `root` and by the `abuild` group (in which we put the
`pmos` user already for building packages).

Changes:
* `pmb.build.init()`: make `/var/cache/distfiles` writable only by
  members of the `abuild` group (and root)
* Increase workfolder version to 2
* Add migration code that fixes the permissions for existing work
  folders
* Refactor the migration code a bit to make this possible
2018-03-30 21:46:31 +00:00
Aerotinge 40db17d775 New device: hTC Desire 816 (htc-a5ul) (#1378)
Signed-off-by: Aerotinge <wang.wander@gmail.com>
2018-03-30 19:28:45 +00:00
Oliver Smith f08bc39e8b
Update busybox-static-* to upstream (1.28.2-r1) 2018-03-30 18:48:51 +02:00
Lionel Duboeuf 7455eb1d2e re-enable RDP for weston (#1377)
RDP is the Remote Desktop Protocol. Usage information:
https://wiki.postmarketos.org/wiki/Weston
2018-03-30 16:44:40 +00:00
Oliver Smith cab753b984
Update musl-* to upstream (1.1.19-r2) 2018-03-30 18:07:04 +02:00
Oliver Smith 6bb8444fef
"...flasher flash_rootfs" instead of "..._system" (#1373)
* Change `pmbootstrap flasher flash_system` command to
  `pmbootstrap flasher flash_rootfs`
* The old command still works, but all references have been changed to
  the new command
* Remove obsolete `pmbootstrap flasher export` (that was changed to
  `pmbootstrap export` a few months ago)
* Update `README.md` and ZSH auto completion
* Change the description of the generated rootfs image (not talking
  about a system image anymore, mention that it has subpartitions)
* Better description of `pmbootstrap flasher flash_rootfs --partition`
2018-03-30 01:11:20 +00:00
Lionel Duboeuf b0c05436a9 pmbootstrap install: print 'flash_system' before 'flash_kernel' (#1372) 2018-03-30 00:52:38 +00:00
Aerotinge ae9efa0338 New device: hTC Incredible S (htc-vivo) (#1365) 2018-03-30 00:05:41 +00:00
Oliver Smith 03f74565fb
Travis: Check for device documentation (#1369)
Add a simple script, that checks whether all device's codenames can be
found in the device overview in the wiki. This way we're always sure
that every device is documented in the wiki's device table.
2018-03-28 21:28:26 +00:00
Lionel Duboeuf b65c04b3ce New device: oneplus oneplus2 (#1366)
Based on work by @NotKit, thanks!
2018-03-28 21:10:12 +00:00
Oliver Smith 491ee6b1c1
Disable metadata_csum when generating ext4 rootfs (#1367)
Some downstream kernels don't support this, and this recently became
the default in e2fsprogs.
2018-03-28 18:00:18 +00:00
Oliver Smith 941cb4d44f
Bump pkgrels for soname bump: libboost_filesystem
This doesn't exist anymore: so:libboost_filesystem.so.1.62.0
Affected packages are all from LuneOS UI:
* activitymanager
* mojoservicelauncher
* nodejs-module-webos-dynaload
2018-03-28 19:37:29 +02:00
Oliver Smith 6c4d7cf25c
Update busybox-static-* to upstream (1.28.2-r0) 2018-03-28 19:35:33 +02:00
Daniele Debernardi a7afd519ef Add additional files into initramfs when debug-shell is installed (#1358) 2018-03-26 18:12:58 +00:00
racer123 7fec589ed4 Add support for GT-S756x (kylessopen, Galaxy Trend/S Duos/Ace II x) (#1361) 2018-03-25 19:00:40 +00:00
Oliver Smith 33a09ea1c7
Fix dependency resolver being stuck after reboot (#1359)
When the native arch (e.g. `x86_64`) `APKINDEX` files are outdated, and
`pmbootstrap` gets instructed to build a linux package for a foreign
arch, then the `APKINDEX` cache did not get used anymore for the
current session. This means that every lookup of a package in an
`APKINDEX` caused the whole `APKINDEX` file to get parsed again instead
of using the cached version. This slowed it down so much that it felt
like `pmbootstrap` was looping forever.

How this happens in detail:
* Whenever pmbootstrap parses an `APKINDEX`, it fills up the
  `args.cache["apkindex"]` dict with the parsed information and the
  last modified date of the file.
* `pmbootstrap` checks the last modified date of the `APKINDEX` files
  and updates them if they are older than 4 hours.
* When the bug appeared, then the cache was already filled up, then an
  update happened and then `pmbootstrap` tried to read from the cache.
* So when reading from the `APKINDEX`, the cache gets ignored because
  the last modified date is different.
* Up to this commit, the cache does not get deleted and filled up
  again!

How to test:
Try these commands once without this commit, and then with this commit
applied:
```
$ sudo touch -m -t 201801010000 \
    ~/.local/var/pmbootstrap/cache_apk_x86_64/APKINDEX.*
$ pmbootstrap -v build linux-postmarketos-mainline --arch=armhf
```

Without the patch, you can see in `pmbootstrap log` that it is
resolving the dependencies properly, but very slowly. With the patch
the resolving happens almost instantly.
2018-03-24 16:31:31 +00:00
Oliver Smith 1ed51f83f1
Package resolving: Don't fail on fuzzy versions (#1355)
When parsing the depends of entries in the APKINDEX file, we ignore
all operators (<, =, >). (This is enough for our use case, was we only
do the dependency resolving to check which packages need to be built
and `apk` does the dependency resolving again before installing
anything).

We did not ignore the ~ character for fuzzy version compares, this is
fixed with this commit.
2018-03-24 16:29:32 +00:00
Oliver Smith f4674abee6
Update busybox-static-* to upstream (1.28.1-r1) 2018-03-24 12:16:23 +01:00
Luca Weiss 7ef0177dbb Kernel updates (#1357)
* linux-postmarketos-mainline 4.16_rc6 [skip ci]
* linux-postmarketos-lts 4.14.29 [skip ci]
* linux-postmarketos-stable 4.15.12 [skip ci]
2018-03-21 21:59:35 +00:00
Oliver Smith 1251c3810e
README: Update with lots of usage examples [skip ci] (#1340)
Details:
* renamed "supported devices" to "devices"
* fix coverage button to URL suggested by coveralls.io
* link to postmarketOS.org
* lots of usage examples
* use `pmbootstrap` alias
* Persistent alias note, initfs extract, debugging
2018-03-20 22:00:14 +00:00
Luca Weiss 29d62deef0 Kernel updates (#1348)
* linux-postmarketos-stable 4.15.11 [skip ci]
* linux-postmarketos-lts 4.14.28 [skip ci]

NOTE: linux-postmarketos-mainline 4.16_rc6
has a regression, not updated yet (#1352)
2018-03-20 21:02:12 +00:00
cybermonkey 8570aed36e New device: Xiaomi Redmi 4X (xiaomi-santoni) (#1346) 2018-03-20 18:46:01 +00:00
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