mirror of
https://github.com/motioneye-project/motioneyeos.git
synced 2025-07-26 04:36:33 +00:00
genrandconfig: calculate outputdir in __main__
This prepares for passing outputdir as an argument. Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
This commit is contained in:
parent
d7b05d5b7d
commit
2dc209be36
@ -329,12 +329,6 @@ def gen_config(args):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
idir = "instance-%d" % args.instance
|
idir = "instance-%d" % args.instance
|
||||||
|
|
||||||
# We need the absolute path to use with O=, because the relative
|
|
||||||
# path to the output directory here is not relative to the
|
|
||||||
# Buildroot sources, but to the location of the autobuilder
|
|
||||||
# script.
|
|
||||||
outputdir = os.path.abspath(os.path.join(idir, "output"))
|
|
||||||
srcdir = os.path.join(idir, "buildroot")
|
srcdir = os.path.join(idir, "buildroot")
|
||||||
|
|
||||||
# Select a random toolchain configuration
|
# Select a random toolchain configuration
|
||||||
@ -361,13 +355,13 @@ def gen_config(args):
|
|||||||
configlines.append("BR2_PACKAGE_PYTHON_PY_ONLY=y\n")
|
configlines.append("BR2_PACKAGE_PYTHON_PY_ONLY=y\n")
|
||||||
|
|
||||||
# Write out the configuration file
|
# Write out the configuration file
|
||||||
with open(os.path.join(outputdir, ".config"), "w+") as configf:
|
with open(os.path.join(args.outputdir, ".config"), "w+") as configf:
|
||||||
configf.writelines(configlines)
|
configf.writelines(configlines)
|
||||||
|
|
||||||
subprocess.check_call(["make", "O=%s" % outputdir, "-C", srcdir,
|
subprocess.check_call(["make", "O=%s" % args.outputdir, "-C", srcdir,
|
||||||
"olddefconfig"])
|
"olddefconfig"])
|
||||||
|
|
||||||
if not is_toolchain_usable(outputdir, config):
|
if not is_toolchain_usable(args.outputdir, config):
|
||||||
return 2
|
return 2
|
||||||
|
|
||||||
# Now, generate the random selection of packages, and fixup
|
# Now, generate the random selection of packages, and fixup
|
||||||
@ -381,17 +375,17 @@ def gen_config(args):
|
|||||||
file=sys.stderr)
|
file=sys.stderr)
|
||||||
return 1
|
return 1
|
||||||
bounded_loop -= 1
|
bounded_loop -= 1
|
||||||
subprocess.check_call(["make", "O=%s" % outputdir, "-C", srcdir,
|
subprocess.check_call(["make", "O=%s" % args.outputdir, "-C", srcdir,
|
||||||
"KCONFIG_PROBABILITY=%d" % randint(1, 30),
|
"KCONFIG_PROBABILITY=%d" % randint(1, 30),
|
||||||
"randpackageconfig"])
|
"randpackageconfig"])
|
||||||
|
|
||||||
if fixup_config(outputdir):
|
if fixup_config(args.outputdir):
|
||||||
break
|
break
|
||||||
|
|
||||||
subprocess.check_call(["make", "O=%s" % outputdir, "-C", srcdir,
|
subprocess.check_call(["make", "O=%s" % args.outputdir, "-C", srcdir,
|
||||||
"olddefconfig"])
|
"olddefconfig"])
|
||||||
|
|
||||||
subprocess.check_call(["make", "O=%s" % outputdir, "-C", srcdir,
|
subprocess.check_call(["make", "O=%s" % args.outputdir, "-C", srcdir,
|
||||||
"savedefconfig"])
|
"savedefconfig"])
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
@ -411,9 +405,15 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
# Output directory is already created by autobuild-run so emulate it here
|
# Output directory is already created by autobuild-run so emulate it here
|
||||||
idir = "instance-%d" % args.instance
|
idir = "instance-%d" % args.instance
|
||||||
|
# We need the absolute path to use with O=, because the relative
|
||||||
|
# path to the output directory here is not relative to the
|
||||||
|
# Buildroot sources, but to the location of the autobuilder
|
||||||
|
# script.
|
||||||
|
args.outputdir = os.path.abspath(os.path.join(idir, "output"))
|
||||||
|
|
||||||
if not os.path.exists(idir):
|
if not os.path.exists(idir):
|
||||||
os.mkdir(idir)
|
os.mkdir(idir)
|
||||||
os.mkdir(os.path.join(idir, "output"))
|
os.mkdir(args.outputdir)
|
||||||
# gen_config expects "buildroot" directory under idir
|
# gen_config expects "buildroot" directory under idir
|
||||||
os.symlink("..", os.path.join(idir, "buildroot"))
|
os.symlink("..", os.path.join(idir, "buildroot"))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user