pmb: Fail on device ports directly in device/* (!1879)

Device ports should be under the device/testing/* directory for now.
In the future, devices may be moved to device/{main,community} after
certain preconditions are met.
This commit is contained in:
Minecrell 2020-02-26 14:48:48 +01:00 committed by Oliver Smith
parent fb8de5a553
commit 72fdfeb107
No known key found for this signature in database
GPG Key ID: 5AE7F5513E0885CB
2 changed files with 19 additions and 0 deletions

View File

@ -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)

View File

@ -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