Update buildroot 2020.02.01 (#622)

* Update buildroot 2020.02.01

Signed-off-by: Pascal Vizeli <pvizeli@syshack.ch>

* Fix LN

* Fix wpa

Signed-off-by: Pascal Vizeli <pvizeli@syshack.ch>

* Fix lint

Signed-off-by: Pascal Vizeli <pvizeli@syshack.ch>

* fix-network

Signed-off-by: Pascal Vizeli <pvizeli@syshack.ch>

* Fix script

Signed-off-by: Pascal Vizeli <pvizeli@syshack.ch>
This commit is contained in:
Pascal Vizeli
2020-04-16 20:03:01 +02:00
committed by GitHub
parent 0c2b5aff65
commit 5a6678147e
6201 changed files with 73436 additions and 70757 deletions

View File

@@ -73,6 +73,10 @@ def get_lib_from_filename(fname):
return None
if DO_NOT_CHECK_INTREE.match(fname):
return None
else:
if os.path.basename(fname) == "external.mk" and \
os.path.exists(fname[:-2] + "desc"):
return None
if CONFIG_IN_FILENAME.search(fname):
return checkpackagelib.lib_config
if fname.endswith(".hash"):

View File

@@ -52,3 +52,17 @@ class TrailingSpace(_CheckFunction):
return ["{}:{}: line contains trailing whitespace"
.format(self.filename, lineno),
text]
class Utf8Characters(_CheckFunction):
def is_ascii(self, s):
try:
return all(ord(c) < 128 for c in s)
except TypeError:
return False
def check_line(self, lineno, text):
if not self.is_ascii(text):
return ["{}:{}: line contains UTF-8 characters"
.format(self.filename, lineno),
text]

View File

@@ -60,6 +60,97 @@ class AttributesOrder(_CheckFunction):
text]
class CommentsMenusPackagesOrder(_CheckFunction):
def before(self):
self.level = 0
self.menu_of_packages = ["The top level menu"]
self.new_package = ""
self.package = [""]
self.print_package_warning = [True]
self.state = ""
def get_level(self):
return len(self.state.split('-')) - 1
def initialize_package_level_elements(self, text):
try:
self.menu_of_packages[self.level] = text[:-1]
self.package[self.level] = ""
self.print_package_warning[self.level] = True
except IndexError:
self.menu_of_packages.append(text[:-1])
self.package.append("")
self.print_package_warning.append(True)
def initialize_level_elements(self, text):
self.level = self.get_level()
self.initialize_package_level_elements(text)
def check_line(self, lineno, text):
# We only want to force sorting for the top-level menus
if self.filename not in ["fs/Config.in",
"package/Config.in",
"package/Config.in.host",
"package/kodi/Config.in"]:
return
source_line = re.match(r'^\s*source ".*/([^/]*)/Config.in(.host)?"', text)
if text.startswith("comment "):
if not self.state.endswith("-comment"):
self.state += "-comment"
self.initialize_level_elements(text)
elif text.startswith("if "):
self.state += "-if"
self.initialize_level_elements(text)
elif text.startswith("menu "):
if self.state.endswith("-comment"):
self.state = self.state[:-8]
self.state += "-menu"
self.initialize_level_elements(text)
elif text.startswith("endif") or text.startswith("endmenu"):
if self.state.endswith("-comment"):
self.state = self.state[:-8]
if text.startswith("endif"):
self.state = self.state[:-3]
elif text.startswith("endmenu"):
self.state = self.state[:-5]
self.level = self.get_level()
elif source_line:
self.new_package = source_line.group(1)
# We order _ before A, so replace it with .
new_package_ord = self.new_package.replace('_', '.')
if self.package[self.level] != "" and \
self.print_package_warning[self.level] and \
new_package_ord < self.package[self.level]:
self.print_package_warning[self.level] = False
prefix = "{}:{}: ".format(self.filename, lineno)
spaces = " " * len(prefix)
return ["{prefix}Packages in: {menu},\n"
"{spaces}are not alphabetically ordered;\n"
"{spaces}correct order: '-', '_', digits, capitals, lowercase;\n"
"{spaces}first incorrect package: {package}"
.format(prefix=prefix, spaces=spaces,
menu=self.menu_of_packages[self.level],
package=self.new_package),
text]
self.package[self.level] = new_package_ord
class HelpText(_CheckFunction):
HELP_TEXT_FORMAT = re.compile("^\t .{,62}$")
URL_ONLY = re.compile("^(http|https|git)://\S*$")

View File

@@ -4,6 +4,7 @@
# menu options using "make menuconfig" and by running "make" with appropriate
# packages enabled.
import os
import re
from checkpackagelib.base import _CheckFunction
@@ -11,6 +12,7 @@ from checkpackagelib.lib import ConsecutiveEmptyLines # noqa: F401
from checkpackagelib.lib import EmptyLastLine # noqa: F401
from checkpackagelib.lib import NewlineAtEof # noqa: F401
from checkpackagelib.lib import TrailingSpace # noqa: F401
from checkpackagelib.lib import Utf8Characters # noqa: F401
# used in more than one check
start_conditional = ["ifdef", "ifeq", "ifndef", "ifneq"]
@@ -124,7 +126,9 @@ class OverriddenVariable(_CheckFunction):
self.conditionally_set.append(variable)
return
if self.CONCATENATING.search(text):
return
return ["{}:{}: immediate assignment to append to variable {}"
.format(self.filename, lineno, variable),
text]
if self.USUALLY_OVERRIDDEN.search(text):
return
if assignment in self.OVERRIDING_ASSIGNMENTS:
@@ -164,10 +168,9 @@ class PackageHeader(_CheckFunction):
class RemoveDefaultPackageSourceVariable(_CheckFunction):
packages_that_may_contain_default_source = ["binutils", "gcc", "gdb"]
PACKAGE_NAME = re.compile("/([^/]+)\.mk")
def before(self):
package = self.PACKAGE_NAME.search(self.filename).group(1)
package, _ = os.path.splitext(os.path.basename(self.filename))
package_upper = package.replace("-", "_").upper()
self.package = package
self.FIND_SOURCE = re.compile(
@@ -222,6 +225,7 @@ class TypoInPackageVariable(_CheckFunction):
ALLOWED = re.compile("|".join([
"ACLOCAL_DIR",
"ACLOCAL_HOST_DIR",
"ACLOCAL_PATH",
"BR_CCACHE_INITIAL_SETUP",
"BR_LIBC",
"BR_NO_CHECK_HASH_FOR",
@@ -237,11 +241,10 @@ class TypoInPackageVariable(_CheckFunction):
"TARGET_FINALIZE_HOOKS",
"TARGETS_ROOTFS",
"XTENSA_CORE_NAME"]))
PACKAGE_NAME = re.compile("/([^/]+)\.mk")
VARIABLE = re.compile("^([A-Z0-9_]+_[A-Z0-9_]+)\s*(\+|)=")
def before(self):
package = self.PACKAGE_NAME.search(self.filename).group(1)
package, _ = os.path.splitext(os.path.basename(self.filename))
package = package.replace("-", "_").upper()
# linux tools do not use LINUX_TOOL_ prefix for variables
package = package.replace("LINUX_TOOL_", "")

View File

@@ -3,6 +3,7 @@
# functions don't need to check for things already checked by running
# "make package-dirclean package-patch".
import os
import re
from checkpackagelib.base import _CheckFunction
@@ -10,10 +11,10 @@ from checkpackagelib.lib import NewlineAtEof # noqa: F401
class ApplyOrder(_CheckFunction):
APPLY_ORDER = re.compile("/\d{1,4}-[^/]*$")
APPLY_ORDER = re.compile("\d{1,4}-[^/]*$")
def before(self):
if not self.APPLY_ORDER.search(self.filename):
if not self.APPLY_ORDER.match(os.path.basename(self.filename)):
return ["{}:0: use name <number>-<description>.patch "
"({}#_providing_patches)"
.format(self.filename, self.url_to_manual)]

View File

@@ -41,7 +41,7 @@ def urlopen_closing(uri):
class SystemInfo:
DEFAULT_NEEDED_PROGS = ["make", "git", "gcc", "timeout"]
DEFAULT_OPTIONAL_PROGS = ["bzr", "java", "javac", "jar"]
DEFAULT_OPTIONAL_PROGS = ["bzr", "java", "javac", "jar", "diffoscope"]
def __init__(self):
self.needed_progs = list(self.__class__.DEFAULT_NEEDED_PROGS)
@@ -190,7 +190,7 @@ def is_toolchain_usable(configfile, config):
return True
def fixup_config(configfile):
def fixup_config(sysinfo, configfile):
"""Finalize the configuration and reject any problematic combinations
This function returns 'True' when the configuration has been
@@ -199,7 +199,6 @@ def fixup_config(configfile):
generated).
"""
sysinfo = SystemInfo()
with open(configfile) as configf:
configlines = configf.readlines()
@@ -207,13 +206,6 @@ def fixup_config(configfile):
if "BR2_NEEDS_HOST_JAVA=y\n" in configlines and not sysinfo.has("java"):
return False
if "BR2_NEEDS_HOST_JAVAC=y\n" in configlines and not sysinfo.has("javac"):
return False
if "BR2_NEEDS_HOST_JAR=y\n" in configlines and not sysinfo.has("jar"):
return False
# python-nfc needs bzr
if 'BR2_PACKAGE_PYTHON_NFC=y\n' in configlines and not sysinfo.has("bzr"):
return False
# The ctng toolchain is affected by PR58854
if 'BR2_PACKAGE_LTTNG_TOOLS=y\n' in configlines and \
BR2_TOOLCHAIN_EXTERNAL_URL + 'armv5-ctng-linux-gnueabi.tar.xz"\n' in configlines:
@@ -256,6 +248,9 @@ def fixup_config(configfile):
if 'BR2_ARM_CPU_ARMV7M=y\n' in configlines and \
'BR2_PACKAGE_LIBFFI=y\n' in configlines:
return False
if 'BR2_nds32=y\n' in configlines and \
'BR2_PACKAGE_LIBFFI=y\n' in configlines:
return False
if 'BR2_PACKAGE_SUNXI_BOARDS=y\n' in configlines:
configlines.remove('BR2_PACKAGE_SUNXI_BOARDS_FEX_FILE=""\n')
configlines.append('BR2_PACKAGE_SUNXI_BOARDS_FEX_FILE="a10/hackberry.fex"\n')
@@ -320,6 +315,8 @@ def gen_config(args):
packages.
"""
sysinfo = SystemInfo()
# Select a random toolchain configuration
configs = get_toolchain_configs(args.toolchains_csv, args.buildrootdir)
@@ -337,6 +334,10 @@ def gen_config(args):
# Allow hosts with old certificates to download over https
configlines.append("BR2_WGET=\"wget --passive-ftp -nd -t 3 --no-check-certificate\"\n")
# Per-package folder
if randint(0, 15) == 0:
configlines.append("BR2_PER_PACKAGE_DIRECTORIES=y\n")
# Amend the configuration with a few things.
if randint(0, 20) == 0:
configlines.append("BR2_ENABLE_DEBUG=y\n")
@@ -352,6 +353,30 @@ def gen_config(args):
configlines.append("BR2_PACKAGE_PYTHON_PY_ONLY=y\n")
if randint(0, 5) == 0:
configlines.append("BR2_OPTIMIZE_2=y\n")
if randint(0, 4) == 0:
configlines.append("BR2_SYSTEM_ENABLE_NLS=y\n")
if randint(0, 4) == 0:
configlines.append("BR2_PIC_PIE=y\n")
if randint(0, 4) == 0:
configlines.append("BR2_RELRO_FULL=y\n")
elif randint(0, 4) == 0:
configlines.append("BR2_RELRO_PARTIAL=y\n")
if randint(0, 4) == 0:
configlines.append("BR2_SSP_ALL=y\n")
elif randint(0, 4) == 0:
configlines.append("BR2_SSP_REGULAR=y\n")
elif randint(0, 4) == 0:
configlines.append("BR2_SSP_STRONG=y\n")
if randint(0, 4) == 0:
configlines.append("BR2_FORTIFY_SOURCE_2=y\n")
elif randint(0, 4) == 0:
configlines.append("BR2_FORTIFY_SOURCE_1=y\n")
# Randomly enable BR2_REPRODUCIBLE 10% of times
# also enable tar filesystem images for testing
if sysinfo.has("diffoscope") and randint(0, 10) == 0:
configlines.append("BR2_REPRODUCIBLE=y\n")
configlines.append("BR2_TARGET_ROOTFS_TAR=y\n")
# Write out the configuration file
if not os.path.exists(args.outputdir):
@@ -384,7 +409,7 @@ def gen_config(args):
"KCONFIG_PROBABILITY=%d" % randint(1, 30),
"randpackageconfig"])
if fixup_config(configfile):
if fixup_config(sysinfo, configfile):
break
subprocess.check_call(["make", "O=%s" % args.outputdir, "-C", args.buildrootdir,

View File

@@ -4,6 +4,7 @@ import re
import glob
import subprocess
import sys
import unittest
#
# Patch parsing functions
@@ -78,6 +79,36 @@ def analyze_patches(patches):
return (allfiles, allinfras)
#
# Unit-test parsing functions
#
def get_all_test_cases(suite):
"""Generate all test-cases from a given test-suite.
:return: (test.module, test.name)"""
if issubclass(type(suite), unittest.TestSuite):
for test in suite:
for res in get_all_test_cases(test):
yield res
else:
yield (suite.__module__, suite.__class__.__name__)
def list_unittests(path):
"""Use the unittest module to retreive all test cases from a given
directory"""
loader = unittest.TestLoader()
suite = loader.discover(path)
tests = {}
for module, test in get_all_test_cases(suite):
module_path = os.path.join(path, *module.split('.'))
tests.setdefault(module_path, []).append('%s.%s' % (module, test))
return tests
unittests = {}
#
# DEVELOPERS file parsing functions
#
@@ -89,6 +120,8 @@ class Developer:
self.packages = parse_developer_packages(files)
self.architectures = parse_developer_architectures(files)
self.infras = parse_developer_infras(files)
self.runtime_tests = parse_developer_runtime_tests(files)
self.defconfigs = parse_developer_defconfigs(files)
def hasfile(self, f):
f = os.path.abspath(f)
@@ -97,6 +130,26 @@ class Developer:
return True
return False
def __repr__(self):
name = '\'' + self.name.split(' <')[0][:20] + '\''
things = []
if len(self.files):
things.append('{} files'.format(len(self.files)))
if len(self.packages):
things.append('{} pkgs'.format(len(self.packages)))
if len(self.architectures):
things.append('{} archs'.format(len(self.architectures)))
if len(self.infras):
things.append('{} infras'.format(len(self.infras)))
if len(self.runtime_tests):
things.append('{} tests'.format(len(self.runtime_tests)))
if len(self.defconfigs):
things.append('{} defconfigs'.format(len(self.defconfigs)))
if things:
return 'Developer <{} ({})>'.format(name, ', '.join(things))
else:
return 'Developer <' + name + '>'
def parse_developer_packages(fnames):
"""Given a list of file patterns, travel through the Buildroot source
@@ -154,12 +207,43 @@ def parse_developer_infras(fnames):
return infras
def parse_developer_defconfigs(fnames):
"""Given a list of file names, returns the config names
corresponding to defconfigs."""
return {os.path.basename(fname[:-10])
for fname in fnames
if fname.endswith('_defconfig')}
def parse_developer_runtime_tests(fnames):
"""Given a list of file names, returns the runtime tests
corresponding to the file."""
all_files = []
# List all files recursively
for fname in fnames:
if os.path.isdir(fname):
for root, _dirs, files in os.walk(fname):
all_files += [os.path.join(root, f) for f in files]
else:
all_files.append(fname)
# Get all runtime tests
runtimes = set()
for f in all_files:
name = os.path.splitext(f)[0]
if name in unittests:
runtimes |= set(unittests[name])
return runtimes
def parse_developers(basepath=None):
"""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:
files = []
name = None

View File

@@ -479,6 +479,7 @@ use Fatal qw(open close);
use Getopt::Long;
use Pod::Usage;
use File::Basename;
use File::Path qw(make_path);
use Module::CoreList;
use HTTP::Tiny;
use Safe;
@@ -487,9 +488,9 @@ use Digest::SHA qw(sha256_hex);
use Text::Wrap;
$Text::Wrap::columns = 62;
# Below, 5.028 should be aligned with the version of perl actually
# Below, 5.030 should be aligned with the version of perl actually
# bundled in Buildroot:
die <<"MSG" if $] < 5.028;
die <<"MSG" if $] < 5.030;
This script needs a host perl with the same major version as Buildroot target perl.
Your current host perl is:
@@ -497,7 +498,7 @@ Your current host perl is:
version $]
You may install a local one by running:
perlbrew install perl-5.28.0
perlbrew install perl-5.30.0
MSG
my ($help, $man, $quiet, $force, $recommend, $test, $host);
@@ -565,7 +566,8 @@ sub find_license_files {
my @license_files;
foreach (split /\n/, $manifest) {
next if m|/|;
push @license_files, $_ if m/(ARTISTIC|COPYING|COPYRIGHT|LICENSE)/i;
s|\s+.*$||;
push @license_files, $_ if m/(ARTISTIC|COPYING|COPYRIGHT|LICENSE|LICENCE)/i;
}
if (scalar @license_files == 0 && $manifest =~ m/(README)[\n\s]/i) {
@license_files = ($1);
@@ -609,6 +611,9 @@ sub fetch {
unless ($dist{$name} && !$top) {
say qq{fetch ${name}} unless $quiet;
my $result = $mcpan->release( distribution => $name );
my $main_module = $result->{main_module};
push @info, qq{[$name] $main_module is a core module}
if $top && Module::CoreList::is_core( $main_module, undef, $] );
$dist{$name} = $result;
$license_files{$name} = {};
eval {
@@ -715,9 +720,10 @@ while (my ($distname, $dist) = each %dist) {
my $mkname = $dirname . q{/} . $fsname . q{.mk};
my $hashname = $dirname . q{/} . $fsname . q{.hash};
my $brname = brname( $fsname );
my $testname = q{support/testing/tests/package/test_} . lc $brname . q{.py};
my $testdir = q{support/testing/tests/package};
my $testname = $testdir . q{/test_} . lc $brname . q{.py};
unless (-d $dirname) {
mkdir $dirname;
make_path $dirname;
$new_pkgs = 1;
}
if ($need_target{$distname} && ($force || !-f $cfgname)) {
@@ -815,6 +821,7 @@ while (my ($distname, $dist) = each %dist) {
my $mark = $is_xs{$distname} ? q{ XS} : q{};
my @indirect = (get_indirect_dependencies( $distname ));
say qq{write ${testname}} unless $quiet;
make_path $testdir unless -d $testdir;
open my $fh, q{>}, $testname;
say {$fh} qq{from tests.package.test_perl import TestPerlBase};
say {$fh} qq{};
@@ -845,6 +852,14 @@ while (my ($distname, $dist) = each %dist) {
say {$fh} qq{};
say {$fh} qq{ def test_run(self):};
say {$fh} qq{ self.login()};
foreach my $dep (sort grep { $is_xs{$_} } @indirect) {
$dep =~ s|-|::|g;
say {$fh} qq{ self.module_test("${dep}")};
}
foreach my $dep (sort grep { $is_xs{$_} } @{$deps_runtime{$distname}}) {
$dep =~ s|-|::|g;
say {$fh} qq{ self.module_test("${dep}")};
}
say {$fh} qq{ self.module_test("${modname}")};
close $fh;
}
@@ -949,7 +964,7 @@ in order to work with the right CoreList data.
=head1 LICENSE
Copyright (C) 2013-2018 by Francois Perrad <francois.perrad@gadz.org>
Copyright (C) 2013-2019 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

View File

@@ -461,6 +461,7 @@ class BuildrootPackage():
' likely wrong, please change it if need be'.format(
license=', '.join(licenses)))
licenses = [self.metadata['info']['license']]
licenses = set(licenses)
license_line = '{name}_LICENSE = {license}\n'.format(
name=self.mk_name,
license=', '.join(licenses))
@@ -473,6 +474,7 @@ class BuildrootPackage():
license_names.append(match.license.id)
else:
license_names.append("FIXME: license id couldn't be detected")
license_names = set(license_names)
if len(license_names) > 0:
license_line = ('{name}_LICENSE ='
@@ -610,6 +612,7 @@ class BuildrootPackage():
bool_line = '\tbool "{name}"\n'.format(name=self.buildroot_name)
lines.append(bool_line)
if self.pkg_req:
self.pkg_req.sort()
for dep in self.pkg_req:
dep_line = '\tselect BR2_PACKAGE_{req} # runtime\n'.format(
req=dep.upper().replace('-', '_'))