1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

script/autobuild: Use logger.debug() for debug messages (visible with --verbose)

Lots of the autobuild.py log outputs are really debugging, so should be
controlled as such.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
This commit is contained in:
Andrew Bartlett 2023-03-23 14:41:15 +13:00
parent 0b29e12dc7
commit c6e1e5aae6

View File

@ -1194,16 +1194,22 @@ if os.environ.get("AUTOBUILD_SKIP_SAMBA_O3", "0") == "1":
def do_print(msg):
print("%s" % msg)
logger.info(msg)
sys.stdout.flush()
sys.stderr.flush()
def do_debug(msg):
logger.debug(msg)
sys.stdout.flush()
sys.stderr.flush()
def run_cmd(cmd, dir=".", show=None, output=False, checkfail=True):
if show is None:
show = options.verbose
if show:
do_debug("Running: '%s' in '%s'" % (cmd, dir))
elif show:
do_print("Running: '%s' in '%s'" % (cmd, dir))
if output:
out = check_output([cmd], shell=True, cwd=dir)
return out.decode(encoding='utf-8', errors='backslashreplace')
@ -1241,9 +1247,8 @@ class builder(object):
self.next = 0
self.stdout_path = "%s/%s.stdout" % (gitroot, self.tag)
self.stderr_path = "%s/%s.stderr" % (gitroot, self.tag)
if options.verbose:
do_print("stdout for %s in %s" % (self.name, self.stdout_path))
do_print("stderr for %s in %s" % (self.name, self.stderr_path))
do_debug("stdout for %s in %s" % (self.name, self.stdout_path))
do_debug("stderr for %s in %s" % (self.name, self.stderr_path))
run_cmd("rm -f %s %s" % (self.stdout_path, self.stderr_path))
self.stdout = open(self.stdout_path, 'w')
self.stderr = open(self.stderr_path, 'w')
@ -1260,12 +1265,12 @@ class builder(object):
assert "dependency" not in definition
def mark_existing(self):
do_print('%s: Mark as existing dependency' % self.name)
do_debug('%s: Mark as existing dependency' % self.name)
self.next = len(self.sequence)
self.done = True
def add_consumer(self, consumer):
do_print("%s: add consumer: %s" % (self.name, consumer.name))
do_debug("%s: add consumer: %s" % (self.name, consumer.name))
consumer.producer = self
consumer.test_source_dir = self.test_source_dir
self.consumers.append(consumer)
@ -1273,7 +1278,7 @@ class builder(object):
def start_next(self):
if self.producer is not None:
if not self.producer.done:
do_print("%s: Waiting for producer: %s" % (self.name, self.producer.name))
do_debug("%s: Waiting for producer: %s" % (self.name, self.producer.name))
return
if self.next == 0:
@ -1363,9 +1368,9 @@ class buildlist(object):
tasknames = implicit_tasknames.copy()
tasknames.extend(given_tasknames)
do_print("given_tasknames: %s" % given_tasknames)
do_print("implicit_tasknames: %s" % implicit_tasknames)
do_print("tasknames: %s" % tasknames)
do_debug("given_tasknames: %s" % given_tasknames)
do_debug("implicit_tasknames: %s" % implicit_tasknames)
do_debug("tasknames: %s" % tasknames)
self.tlist = [builder(n, tasks[n]) for n in tasknames]
if options.retry:
@ -1401,11 +1406,11 @@ class buildlist(object):
b.mark_existing()
for b in self.tlist:
do_print("b.name=%s" % b.name)
do_debug("b.name=%s" % b.name)
if "dependency" not in b.definition:
continue
depname = b.definition["dependency"]
do_print("b.name=%s: dependency:%s" % (b.name, depname))
do_debug("b.name=%s: dependency:%s" % (b.name, depname))
for p in self.tlist:
if p.name == depname:
p.add_consumer(b)