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:
parent
fb8de5a553
commit
72fdfeb107
|
@ -38,6 +38,8 @@ def main():
|
||||||
raise RuntimeError("Work path not found, please run 'pmbootstrap"
|
raise RuntimeError("Work path not found, please run 'pmbootstrap"
|
||||||
" init' to create it.")
|
" init' to create it.")
|
||||||
|
|
||||||
|
other.check_old_devices(args)
|
||||||
|
|
||||||
# Migrate work folder if necessary
|
# Migrate work folder if necessary
|
||||||
if args.action not in ["shutdown", "zap", "log"]:
|
if args.action not in ["shutdown", "zap", "log"]:
|
||||||
other.migrate_work_folder(args)
|
other.migrate_work_folder(args)
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
# Copyright 2020 Oliver Smith
|
# Copyright 2020 Oliver Smith
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
import glob
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
@ -173,6 +174,22 @@ def migrate_work_folder(args):
|
||||||
" be lost.")
|
" 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):
|
def validate_hostname(hostname):
|
||||||
"""
|
"""
|
||||||
Check whether the string is a valid hostname, according to
|
Check whether the string is a valid hostname, according to
|
||||||
|
|
Loading…
Reference in New Issue