pmb: Look for device/* files in device/*/... instead (!1879)

In the future, device ports will be located in a subdirectory
below device/... (e.g. device/testing/device-...).
Replace all occurrences of device/* with a glob that checks the
subdirectories instead.

Note: To ensure that this always works properly we should also add some
checks that all devices are indeed located under one of the supported
subdirectories (i.e. testing/community/main).

Change the glob for pmaports to <aports>/**/APKBUILD.
This allows using subdirectories for organization outside of device/
as well.
This commit is contained in:
Minecrell 2020-02-26 12:13:26 +01:00 committed by Oliver Smith
parent c399ff81a1
commit fb8de5a553
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
20 changed files with 62 additions and 40 deletions

View file

@ -3,6 +3,7 @@
import logging
import os
import pmb.config
import pmb.helpers.devices
def sanity_check(info, path):
@ -62,15 +63,14 @@ def deviceinfo(args, device=None):
logging.fatal("Please provide a path to the aports directory using the -p flag")
raise RuntimeError("Aports directory missing")
aport = args.aports + "/device/device-" + device
if not os.path.exists(aport) or not os.path.exists(aport + "/deviceinfo"):
path = pmb.helpers.devices.find_path(args, device, 'deviceinfo')
if not path:
raise RuntimeError(
"Device '" + device + "' not found. Run 'pmbootstrap init' to"
" start a new device port or to choose another device. It may have"
" been renamed, see <https://postmarketos.org/renamed>")
ret = {}
path = aport + "/deviceinfo"
with open(path) as handle:
for line in handle:
if not line.startswith("deviceinfo_"):