aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/checkpackagelib/lib_mk.py5
-rwxr-xr-xutils/genrandconfig16
-rwxr-xr-xutils/get-developers11
-rw-r--r--utils/getdeveloperlib.py37
-rwxr-xr-xutils/scancpan13
-rwxr-xr-xutils/scanpypi2
6 files changed, 42 insertions, 42 deletions
diff --git a/utils/checkpackagelib/lib_mk.py b/utils/checkpackagelib/lib_mk.py
index 45e37e4598..0278354434 100644
--- a/utils/checkpackagelib/lib_mk.py
+++ b/utils/checkpackagelib/lib_mk.py
@@ -16,12 +16,13 @@ from checkpackagelib.lib import Utf8Characters # noqa: F401
# used in more than one check
start_conditional = ["ifdef", "ifeq", "ifndef", "ifneq"]
+continue_conditional = ["elif", "else"]
end_conditional = ["endif"]
class Indent(_CheckFunction):
COMMENT = re.compile(r"^\s*#")
- CONDITIONAL = re.compile(r"^\s*({})\s".format("|".join(start_conditional + end_conditional)))
+ CONDITIONAL = re.compile(r"^\s*({})\s".format("|".join(start_conditional + end_conditional + continue_conditional)))
ENDS_WITH_BACKSLASH = re.compile(r"^[^#].*\\$")
END_DEFINE = re.compile(r"^\s*endef\s")
MAKEFILE_TARGET = re.compile(r"^[^# \t]+:\s")
@@ -43,7 +44,7 @@ class Indent(_CheckFunction):
expect_tabs = False
if self.define or self.backslash or self.makefile_target:
expect_tabs = True
- if self.CONDITIONAL.search(text):
+ if not self.backslash and self.CONDITIONAL.search(text):
expect_tabs = False
# calculate for next line
diff --git a/utils/genrandconfig b/utils/genrandconfig
index 63ff32cbfb..93dc6d898b 100755
--- a/utils/genrandconfig
+++ b/utils/genrandconfig
@@ -301,6 +301,22 @@ def fixup_config(sysinfo, configfile):
'BR2_PACKAGE_FLANN=y\n' in configlines:
return False
+ if 'BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE=y\n' in configlines:
+ bootenv = os.path.join(args.outputdir, "boot_env.txt")
+ with open(bootenv, "w+") as bootenvf:
+ bootenvf.write("prop=value")
+ configlines.remove('BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE_SOURCE=""\n')
+ configlines.append('BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE_SOURCE="%s"\n' % bootenv)
+ configlines.remove('BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE_SIZE=""\n')
+ configlines.append('BR2_PACKAGE_HOST_UBOOT_TOOLS_ENVIMAGE_SIZE="0x1000"\n')
+
+ if 'BR2_PACKAGE_HOST_UBOOT_TOOLS_BOOT_SCRIPT=y\n' in configlines:
+ bootscr = os.path.join(args.outputdir, "boot_script.txt")
+ with open(bootscr, "w+") as bootscrf:
+ bootscrf.write("prop=value")
+ configlines.remove('BR2_PACKAGE_HOST_UBOOT_TOOLS_BOOT_SCRIPT_SOURCE=""\n')
+ configlines.append('BR2_PACKAGE_HOST_UBOOT_TOOLS_BOOT_SCRIPT_SOURCE="%s"\n' % bootscr)
+
with open(configfile, "w+") as configf:
configf.writelines(configlines)
diff --git a/utils/get-developers b/utils/get-developers
index 750fc556dc..9182b2d85f 100755
--- a/utils/get-developers
+++ b/utils/get-developers
@@ -3,7 +3,6 @@
import argparse
import getdeveloperlib
import sys
-import os
def parse_args():
@@ -45,10 +44,6 @@ def __main__():
print("No action specified")
return
- # getdeveloperlib expects to be executed from the toplevel buildroot
- # directory, which is one level up from this script
- os.chdir(os.path.join(os.path.dirname(os.path.realpath(__file__)), '..'))
-
devs = getdeveloperlib.parse_developers()
if devs is None:
sys.exit(1)
@@ -75,11 +70,9 @@ def __main__():
# Handle the files action
if args.files is not None:
- args.files = [os.path.abspath(f) for f in args.files]
for dev in devs:
- for devfile in dev.files:
- commonfiles = [f for f in args.files if f.startswith(devfile)]
- if commonfiles:
+ for f in args.files:
+ if dev.hasfile(f):
print(dev.name)
break
diff --git a/utils/getdeveloperlib.py b/utils/getdeveloperlib.py
index dc0cc07cc7..b205817033 100644
--- a/utils/getdeveloperlib.py
+++ b/utils/getdeveloperlib.py
@@ -6,6 +6,8 @@ import subprocess
import sys
import unittest
+brpath = os.path.normpath(os.path.join(os.path.dirname(__file__), ".."))
+
#
# Patch parsing functions
#
@@ -54,17 +56,6 @@ def fname_get_package_infra(fname):
return None
-def get_infras(files):
- """Search in the list of files for .mk files, and collect the package
- infrastructures used by those .mk files."""
- infras = set()
- for fname in files:
- infra = fname_get_package_infra(fname)
- if infra:
- infras.add(infra)
- return infras
-
-
def analyze_patches(patches):
"""Parse a list of patches and returns the list of files modified,
added or removed by the patches, as well as the list of package
@@ -75,7 +66,6 @@ def analyze_patches(patches):
(files, infras) = analyze_patch(patch)
allfiles = allfiles | files
allinfras = allinfras | infras
- allinfras = allinfras | get_infras(allfiles)
return (allfiles, allinfras)
@@ -94,14 +84,14 @@ def get_all_test_cases(suite):
yield (suite.__module__, suite.__class__.__name__)
-def list_unittests(path):
+def list_unittests():
"""Use the unittest module to retreive all test cases from a given
directory"""
loader = unittest.TestLoader()
- suite = loader.discover(path)
+ suite = loader.discover(os.path.join(brpath, "support", "testing"))
tests = {}
for module, test in get_all_test_cases(suite):
- module_path = os.path.join(path, *module.split('.'))
+ module_path = os.path.join("support", "testing", *module.split('.'))
tests.setdefault(module_path, []).append('%s.%s' % (module, test))
return tests
@@ -124,7 +114,6 @@ class Developer:
self.defconfigs = parse_developer_defconfigs(files)
def hasfile(self, f):
- f = os.path.abspath(f)
for fs in self.files:
if f.startswith(fs):
return True
@@ -157,7 +146,7 @@ def parse_developer_packages(fnames):
patterns, and return a list of those packages."""
packages = set()
for fname in fnames:
- for root, dirs, files in os.walk(fname):
+ for root, dirs, files in os.walk(os.path.join(brpath, fname)):
for f in files:
path = os.path.join(root, f)
if fname_get_package_infra(path):
@@ -222,7 +211,7 @@ def parse_developer_runtime_tests(fnames):
# List all files recursively
for fname in fnames:
if os.path.isdir(fname):
- for root, _dirs, files in os.walk(fname):
+ for root, _dirs, files in os.walk(os.path.join(brpath, fname)):
all_files += [os.path.join(root, f) for f in files]
else:
all_files.append(fname)
@@ -236,15 +225,13 @@ def parse_developer_runtime_tests(fnames):
return runtimes
-def parse_developers(basepath=None):
+def parse_developers():
"""Parse the DEVELOPERS file and return a list of Developer objects."""
developers = []
linen = 0
- if basepath is None:
- basepath = os.getcwd()
global unittests
- unittests = list_unittests(os.path.join(basepath, 'support/testing'))
- with open(os.path.join(basepath, "DEVELOPERS"), "r") as f:
+ unittests = list_unittests()
+ with open(os.path.join(brpath, "DEVELOPERS"), "r") as f:
files = []
name = None
for line in f:
@@ -258,11 +245,11 @@ def parse_developers(basepath=None):
name = line[2:].strip()
elif line.startswith("F:"):
fname = line[2:].strip()
- dev_files = glob.glob(os.path.join(basepath, fname))
+ dev_files = glob.glob(os.path.join(brpath, fname))
if len(dev_files) == 0:
print("WARNING: '%s' doesn't match any file" % fname,
file=sys.stderr)
- files += dev_files
+ files += [os.path.relpath(f, brpath) for f in dev_files]
elif line == "":
if not name:
continue
diff --git a/utils/scancpan b/utils/scancpan
index 327a58fc78..075f193563 100755
--- a/utils/scancpan
+++ b/utils/scancpan
@@ -488,9 +488,9 @@ use Digest::SHA qw(sha256_hex);
use Text::Wrap;
$Text::Wrap::columns = 62;
-# Below, 5.030 should be aligned with the version of perl actually
+# Below, 5.032 should be aligned with the version of perl actually
# bundled in Buildroot:
-die <<"MSG" if $] < 5.030;
+die <<"MSG" if $] < 5.032;
This script needs a host perl with the same major version as Buildroot target perl.
Your current host perl is:
@@ -498,7 +498,7 @@ Your current host perl is:
version $]
You may install a local one by running:
- perlbrew install perl-5.30.0
+ perlbrew install perl-5.32.0
MSG
my ($help, $man, $quiet, $force, $recommend, $test, $host);
@@ -567,7 +567,7 @@ sub find_license_files {
foreach (split /\n/, $manifest) {
next if m|/|;
s|\s+.*$||;
- push @license_files, $_ if m/(ARTISTIC|COPYING|COPYRIGHT|LICENSE|LICENCE)/i;
+ push @license_files, $_ if m/(ARTISTIC|COPYING|COPYRIGHT|GPL\S*|LICENSE|LICENCE)/i;
}
if (scalar @license_files == 0 && $manifest =~ m/(README)[\n\s]/i) {
@license_files = ($1);
@@ -575,6 +575,9 @@ sub find_license_files {
if (scalar @license_files == 0 && $manifest =~ m/(README\.md)[\n\s]/i) {
@license_files = ($1);
}
+ if (scalar @license_files == 0 && $manifest =~ m/(README\.pod)[\n\s]/i) {
+ @license_files = ($1);
+ }
return @license_files;
}
@@ -964,7 +967,7 @@ in order to work with the right CoreList data.
=head1 LICENSE
-Copyright (C) 2013-2019 by Francois Perrad <francois.perrad@gadz.org>
+Copyright (C) 2013-2020 by Francois Perrad <francois.perrad@gadz.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/utils/scanpypi b/utils/scanpypi
index 51bc249f9e..47c7c00c60 100755
--- a/utils/scanpypi
+++ b/utils/scanpypi
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
"""
Utility for building Buildroot packages for existing PyPI packages