pmbootstrap, with Synit changes
Go to file
cclauss a502b50475 Reduce complexity in pmbootstrap.py (#160)
Thanks, @cclauss!

* Dictionary lookup of event loop actions

This was kind of an experiment that adds lots of blank lines to this script -- feel free to reject it.

The observation that triggered this was that in main() all actions can execute using just one parameter, args.  This means that it is possible to use args.action to do a dict lookup to get the corresponding function.  This approach adds tons of blank lines to the script in exchange for a rapid seek to the action implementation and a substantial reduction of the McCabe complexity of main().

$ __flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics__
```
./pmbootstrap.py:43:1: C901 'main' is too complex (23)
./pmb/aportgen/core.py:38:1: C901 'rewrite' is too complex (17)
[ ... ]
```

* Remove action_dict and use locals() instead
2017-07-17 15:38:45 +00:00
aports Fixed checksums for device-nokia-rx51 after merge 2017-07-16 17:09:12 +02:00
keys Hello, there! 2017-05-26 22:08:45 +02:00
pmb Merge pull request #144 from postmarketOS/heimdall-partitions-in-deviceinfo 2017-07-14 20:48:38 +00:00
test Properly support specifying a local folder as --mirror-pmOS 2017-07-12 21:55:47 +02:00
.gitignore gitignore: Added vim temporary files 2017-06-25 21:40:49 +02:00
.travis.yml Rename travis.yaml to travis.yml 2017-05-28 02:48:03 +02:00
CONTRIBUTING.md Add CONTRIBUTING.md 2017-05-28 03:40:30 +02:00
LICENSE Initial commit 2017-05-26 19:25:48 +00:00
README.md Close #103: Document how to use chroot commands with parameters 2017-06-23 23:46:09 +02:00
pmbootstrap.py Reduce complexity in pmbootstrap.py (#160) 2017-07-17 15:38:45 +00:00

README.md

pmbootstrap

Sophisticated chroot/build/flash tool to develop and install postmarketOS.

Static code analysis status: travis badge

Requirements

  • Linux distribution
  • Python 3
  • OpenSSL

Usage

Check out the porting guide for a practical start!

Run ./pmbootstrap.py init first, to select a target device and the work folder, which will contain all the chroots and other data. After that, you can run any command. All dependencies (e.g. chroots) will be installed automatically, if they are not available yet.

Here are some examples:

./pmbootstrap.py --help: List all available commands

./pmbootstrap.py log: Run tail -f on the logfile, which contains detailed output. Do this in a second terminal, while executing another pmbootstrap command to get all the details.

./pmbootstrap.py chroot: Open a shell inside a native Alpine Linux chroot (~6 MB install size).

./pmbootstrap.py chroot -- ls -l /home/user Execute ls -l /home/user inside the chroot. Make sure, that you use -- before the command, so all following options (e.g. -l) do not get interpreted by pmbootstrap, but passed correctly to your command.

./pmbootstrap.py chroot --suffix=buildroot_armhf: Open a shell inside an armhf Alpine Linux chroot, with qemu user mode emulation and binfmt support automatically set up.

./pmbootstrap.py build hello-world: Build the "hello-world" package (specify any package from the aports-folder here).

./pmbootstrap.py build hello-world --arch=armhf: Build the "hello-world" package for armhf inside the armhf chroot, with the cross-compiler installed in the native chroot (chroots are connected via distcc).

./pmbootstrap.py install: Generate a system image file with a full postmarketOS installation. All required packages get built first, if they do not exist yet. You will get asked for the "user" password and the root partition password.

./pmbootstrap.py install --sdcard=/dev/mmcblk0: Format and partition the SD card /dev/mmcblk0, and put a full postmarketOS installation on it

Testsuite

Simply install pytest (via your package manager or via pip) and run it inside the pmbootstrap folder.