diff --git a/pmb/__init__.py b/pmb/__init__.py index 88feb678..ceb13a12 100644 --- a/pmb/__init__.py +++ b/pmb/__init__.py @@ -38,6 +38,8 @@ def main(): raise RuntimeError("Work path not found, please run 'pmbootstrap" " init' to create it.") + other.check_old_devices(args) + # Migrate work folder if necessary if args.action not in ["shutdown", "zap", "log"]: other.migrate_work_folder(args) diff --git a/pmb/helpers/other.py b/pmb/helpers/other.py index b2cb0038..f759701d 100644 --- a/pmb/helpers/other.py +++ b/pmb/helpers/other.py @@ -1,5 +1,6 @@ # Copyright 2020 Oliver Smith # SPDX-License-Identifier: GPL-3.0-or-later +import glob import logging import os import re @@ -173,6 +174,22 @@ def migrate_work_folder(args): " be lost.") +def check_old_devices(args): + """ + Check if there are any device ports in device/*/APKBUILD, + rather than device/*/*/APKBUILD (e.g. device/testing/...). + """ + + g = glob.glob(args.aports + "/device/*/APKBUILD") + if not g: + return + + raise RuntimeError("Found device ports outside device/testing/... " + "Please run 'pmbootstrap pull' and/or move the " + "following device ports to device/testing:\n - " + + '\n - '.join(g)) + + def validate_hostname(hostname): """ Check whether the string is a valid hostname, according to