forked from Mirror/pmbootstrap
pmbootstrap deviceinfo_parse: new action (MR 1986)
Co-Authored-By: Oliver Smith <ollieparanoid@postmarketos.org>
This commit is contained in:
parent
4d3c14f6c1
commit
d0b32b3b05
3 changed files with 29 additions and 0 deletions
|
@ -171,6 +171,11 @@ Use `-v` on any action to get verbose logging:
|
||||||
$ pmbootstrap -v build hello-world
|
$ pmbootstrap -v build hello-world
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Parse a single deviceinfo and return it as JSON:
|
||||||
|
```
|
||||||
|
$ pmbootstrap deviceinfo_parse pine64-pinephone
|
||||||
|
```
|
||||||
|
|
||||||
Parse a single APKBUILD and return it as JSON:
|
Parse a single APKBUILD and return it as JSON:
|
||||||
```
|
```
|
||||||
$ pmbootstrap apkbuild_parse hello-world
|
$ pmbootstrap apkbuild_parse hello-world
|
||||||
|
|
|
@ -15,6 +15,7 @@ import pmb.chroot.other
|
||||||
import pmb.config
|
import pmb.config
|
||||||
import pmb.export
|
import pmb.export
|
||||||
import pmb.flasher
|
import pmb.flasher
|
||||||
|
import pmb.helpers.devices
|
||||||
import pmb.helpers.git
|
import pmb.helpers.git
|
||||||
import pmb.helpers.lint
|
import pmb.helpers.lint
|
||||||
import pmb.helpers.logging
|
import pmb.helpers.logging
|
||||||
|
@ -367,6 +368,20 @@ def kconfig(args):
|
||||||
pmb.build.menuconfig(args, args.package)
|
pmb.build.menuconfig(args, args.package)
|
||||||
|
|
||||||
|
|
||||||
|
def deviceinfo_parse(args):
|
||||||
|
# Default to all devices
|
||||||
|
devices = args.devices
|
||||||
|
if not devices:
|
||||||
|
devices = pmb.helpers.devices.list_codenames(args)
|
||||||
|
|
||||||
|
# Iterate over all devices
|
||||||
|
kernel = args.deviceinfo_parse_kernel
|
||||||
|
for device in devices:
|
||||||
|
print(f"{device}, with kernel={kernel}:")
|
||||||
|
print(json.dumps(pmb.parse.deviceinfo(args, device, kernel), indent=4,
|
||||||
|
sort_keys=True))
|
||||||
|
|
||||||
|
|
||||||
def apkbuild_parse(args):
|
def apkbuild_parse(args):
|
||||||
# Default to all packages
|
# Default to all packages
|
||||||
packages = args.packages
|
packages = args.packages
|
||||||
|
|
|
@ -623,6 +623,15 @@ def arguments():
|
||||||
" a kernel compiled with envkernel.sh.")
|
" a kernel compiled with envkernel.sh.")
|
||||||
add_packages_arg(build, nargs="+")
|
add_packages_arg(build, nargs="+")
|
||||||
|
|
||||||
|
# Action: deviceinfo_parse
|
||||||
|
deviceinfo_parse = sub.add_parser("deviceinfo_parse")
|
||||||
|
deviceinfo_parse.add_argument("devices", nargs="*")
|
||||||
|
deviceinfo_parse.add_argument("--kernel", help="the kernel to select (for"
|
||||||
|
" device packages with multiple kernels),"
|
||||||
|
" e.g. 'downstream', 'mainline'",
|
||||||
|
dest="deviceinfo_parse_kernel",
|
||||||
|
metavar="KERNEL")
|
||||||
|
|
||||||
# Action: apkbuild_parse
|
# Action: apkbuild_parse
|
||||||
apkbuild_parse = sub.add_parser("apkbuild_parse")
|
apkbuild_parse = sub.add_parser("apkbuild_parse")
|
||||||
add_packages_arg(apkbuild_parse, nargs="*")
|
add_packages_arg(apkbuild_parse, nargs="*")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue