Bump buildroot to 2019.02
This commit is contained in:
@@ -34,17 +34,17 @@ def download(dldir, filename):
|
||||
os.makedirs(dldir)
|
||||
|
||||
tmpfile = tempfile.mktemp(dir=dldir)
|
||||
print "Downloading to {}".format(tmpfile)
|
||||
print("Downloading to {}".format(tmpfile))
|
||||
|
||||
try:
|
||||
url_fh = urlopen(os.path.join(ARTIFACTS_URL, filename))
|
||||
with open(tmpfile, "w+") as tmpfile_fh:
|
||||
tmpfile_fh.write(url_fh.read())
|
||||
except (HTTPError, URLError), err:
|
||||
except (HTTPError, URLError) as err:
|
||||
os.unlink(tmpfile)
|
||||
raise err
|
||||
|
||||
print "Renaming from %s to %s" % (tmpfile, finalpath)
|
||||
print("Renaming from {} to {}".format(tmpfile, finalpath))
|
||||
os.rename(tmpfile, finalpath)
|
||||
return finalpath
|
||||
|
||||
|
||||
@@ -28,8 +28,9 @@ MINIMAL_CONFIG = \
|
||||
"""
|
||||
|
||||
|
||||
class BRTest(unittest.TestCase):
|
||||
class BRConfigTest(unittest.TestCase):
|
||||
config = None
|
||||
br2_external = list()
|
||||
downloaddir = None
|
||||
outputdir = None
|
||||
logtofile = True
|
||||
@@ -38,15 +39,15 @@ class BRTest(unittest.TestCase):
|
||||
timeout_multiplier = 1
|
||||
|
||||
def __init__(self, names):
|
||||
super(BRTest, self).__init__(names)
|
||||
super(BRConfigTest, self).__init__(names)
|
||||
self.testname = self.__class__.__name__
|
||||
self.builddir = self.outputdir and os.path.join(self.outputdir, self.testname)
|
||||
self.emulator = None
|
||||
self.config += '\nBR2_DL_DIR="{}"\n'.format(self.downloaddir)
|
||||
self.config += "\nBR2_JLEVEL={}\n".format(self.jlevel)
|
||||
|
||||
def show_msg(self, msg):
|
||||
print "{} {:40s} {}".format(datetime.datetime.now().strftime("%H:%M:%S"),
|
||||
self.testname, msg)
|
||||
print("{} {:40s} {}".format(datetime.datetime.now().strftime("%H:%M:%S"),
|
||||
self.testname, msg))
|
||||
|
||||
def setUp(self):
|
||||
self.show_msg("Starting")
|
||||
@@ -55,6 +56,22 @@ class BRTest(unittest.TestCase):
|
||||
if not self.keepbuilds:
|
||||
self.b.delete()
|
||||
|
||||
if not self.b.is_finished():
|
||||
self.b.configure(make_extra_opts=["BR2_EXTERNAL={}".format(":".join(self.br2_external))])
|
||||
|
||||
def tearDown(self):
|
||||
self.show_msg("Cleaning up")
|
||||
if self.b and not self.keepbuilds:
|
||||
self.b.delete()
|
||||
|
||||
|
||||
class BRTest(BRConfigTest):
|
||||
def __init__(self, names):
|
||||
super(BRTest, self).__init__(names)
|
||||
self.emulator = None
|
||||
|
||||
def setUp(self):
|
||||
super(BRTest, self).setUp()
|
||||
if not self.b.is_finished():
|
||||
self.show_msg("Building")
|
||||
self.b.build()
|
||||
@@ -64,8 +81,6 @@ class BRTest(unittest.TestCase):
|
||||
self.logtofile, self.timeout_multiplier)
|
||||
|
||||
def tearDown(self):
|
||||
self.show_msg("Cleaning up")
|
||||
if self.emulator:
|
||||
self.emulator.stop()
|
||||
if self.b and not self.keepbuilds:
|
||||
self.b.delete()
|
||||
super(BRTest, self).tearDown()
|
||||
|
||||
@@ -12,7 +12,17 @@ class Builder(object):
|
||||
self.builddir = builddir
|
||||
self.logfile = infra.open_log_file(builddir, "build", logtofile)
|
||||
|
||||
def build(self):
|
||||
def configure(self, make_extra_opts=[], make_extra_env={}):
|
||||
"""Configure the build.
|
||||
|
||||
make_extra_opts: a list of arguments to be passed to the make
|
||||
command.
|
||||
e.g. make_extra_opts=["BR2_EXTERNAL=/path"]
|
||||
|
||||
make_extra_env: a dict of variables to be appended (or replaced)
|
||||
in the environment that calls make.
|
||||
e.g. make_extra_env={"BR2_DL_DIR": "/path"}
|
||||
"""
|
||||
if not os.path.isdir(self.builddir):
|
||||
os.makedirs(self.builddir)
|
||||
|
||||
@@ -24,15 +34,43 @@ class Builder(object):
|
||||
"> end defconfig\n")
|
||||
self.logfile.flush()
|
||||
|
||||
env = {"PATH": os.environ["PATH"]}
|
||||
env.update(make_extra_env)
|
||||
|
||||
cmd = ["make",
|
||||
"O={}".format(self.builddir),
|
||||
"olddefconfig"]
|
||||
ret = subprocess.call(cmd, stdout=self.logfile, stderr=self.logfile)
|
||||
"O={}".format(self.builddir)]
|
||||
cmd += make_extra_opts
|
||||
cmd += ["olddefconfig"]
|
||||
|
||||
ret = subprocess.call(cmd, stdout=self.logfile, stderr=self.logfile,
|
||||
env=env)
|
||||
if ret != 0:
|
||||
raise SystemError("Cannot olddefconfig")
|
||||
|
||||
def build(self, make_extra_opts=[], make_extra_env={}):
|
||||
"""Perform the build.
|
||||
|
||||
make_extra_opts: a list of arguments to be passed to the make
|
||||
command. It can include a make target.
|
||||
e.g. make_extra_opts=["foo-source"]
|
||||
|
||||
make_extra_env: a dict of variables to be appended (or replaced)
|
||||
in the environment that calls make.
|
||||
e.g. make_extra_env={"BR2_DL_DIR": "/path"}
|
||||
"""
|
||||
env = {"PATH": os.environ["PATH"]}
|
||||
if "http_proxy" in os.environ:
|
||||
self.logfile.write("Using system proxy: " +
|
||||
os.environ["http_proxy"] + "\n")
|
||||
env['http_proxy'] = os.environ["http_proxy"]
|
||||
env['https_proxy'] = os.environ["http_proxy"]
|
||||
env.update(make_extra_env)
|
||||
|
||||
cmd = ["make", "-C", self.builddir]
|
||||
ret = subprocess.call(cmd, stdout=self.logfile, stderr=self.logfile)
|
||||
cmd += make_extra_opts
|
||||
|
||||
ret = subprocess.call(cmd, stdout=self.logfile, stderr=self.logfile,
|
||||
env=env)
|
||||
if ret != 0:
|
||||
raise SystemError("Build failed")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user