1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-03 01:18:10 +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): 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.stdout.flush()
sys.stderr.flush() sys.stderr.flush()
def run_cmd(cmd, dir=".", show=None, output=False, checkfail=True): def run_cmd(cmd, dir=".", show=None, output=False, checkfail=True):
if show is None: if show is None:
show = options.verbose do_debug("Running: '%s' in '%s'" % (cmd, dir))
if show: elif show:
do_print("Running: '%s' in '%s'" % (cmd, dir)) do_print("Running: '%s' in '%s'" % (cmd, dir))
if output: if output:
out = check_output([cmd], shell=True, cwd=dir) out = check_output([cmd], shell=True, cwd=dir)
return out.decode(encoding='utf-8', errors='backslashreplace') return out.decode(encoding='utf-8', errors='backslashreplace')
@ -1241,9 +1247,8 @@ class builder(object):
self.next = 0 self.next = 0
self.stdout_path = "%s/%s.stdout" % (gitroot, self.tag) self.stdout_path = "%s/%s.stdout" % (gitroot, self.tag)
self.stderr_path = "%s/%s.stderr" % (gitroot, self.tag) self.stderr_path = "%s/%s.stderr" % (gitroot, self.tag)
if options.verbose: do_debug("stdout for %s in %s" % (self.name, self.stdout_path))
do_print("stdout for %s in %s" % (self.name, self.stdout_path)) do_debug("stderr for %s in %s" % (self.name, self.stderr_path))
do_print("stderr for %s in %s" % (self.name, self.stderr_path))
run_cmd("rm -f %s %s" % (self.stdout_path, self.stderr_path)) run_cmd("rm -f %s %s" % (self.stdout_path, self.stderr_path))
self.stdout = open(self.stdout_path, 'w') self.stdout = open(self.stdout_path, 'w')
self.stderr = open(self.stderr_path, 'w') self.stderr = open(self.stderr_path, 'w')
@ -1260,12 +1265,12 @@ class builder(object):
assert "dependency" not in definition assert "dependency" not in definition
def mark_existing(self): 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.next = len(self.sequence)
self.done = True self.done = True
def add_consumer(self, consumer): 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.producer = self
consumer.test_source_dir = self.test_source_dir consumer.test_source_dir = self.test_source_dir
self.consumers.append(consumer) self.consumers.append(consumer)
@ -1273,7 +1278,7 @@ class builder(object):
def start_next(self): def start_next(self):
if self.producer is not None: if self.producer is not None:
if not self.producer.done: 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 return
if self.next == 0: if self.next == 0:
@ -1363,9 +1368,9 @@ class buildlist(object):
tasknames = implicit_tasknames.copy() tasknames = implicit_tasknames.copy()
tasknames.extend(given_tasknames) tasknames.extend(given_tasknames)
do_print("given_tasknames: %s" % given_tasknames) do_debug("given_tasknames: %s" % given_tasknames)
do_print("implicit_tasknames: %s" % implicit_tasknames) do_debug("implicit_tasknames: %s" % implicit_tasknames)
do_print("tasknames: %s" % tasknames) do_debug("tasknames: %s" % tasknames)
self.tlist = [builder(n, tasks[n]) for n in tasknames] self.tlist = [builder(n, tasks[n]) for n in tasknames]
if options.retry: if options.retry:
@ -1401,11 +1406,11 @@ class buildlist(object):
b.mark_existing() b.mark_existing()
for b in self.tlist: 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: if "dependency" not in b.definition:
continue continue
depname = b.definition["dependency"] 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: for p in self.tlist:
if p.name == depname: if p.name == depname:
p.add_consumer(b) p.add_consumer(b)