From ca29f53204f5d9e87097d457f9313a7c0eaf44cd Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Mon, 5 Jun 2017 11:36:51 +0000 Subject: reproducible Debian: Break out a helper function. No functional change. Signed-off-by: Holger Levsen --- bin/reproducible_remote_scheduler.py | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'bin/reproducible_remote_scheduler.py') diff --git a/bin/reproducible_remote_scheduler.py b/bin/reproducible_remote_scheduler.py index eb524441..610fff0d 100755 --- a/bin/reproducible_remote_scheduler.py +++ b/bin/reproducible_remote_scheduler.py @@ -242,18 +242,22 @@ def rest(scheduling_args, requester, local, suite, arch): ids.append(result[0][0]) pkgs.append(pkg) - blablabla = '✂…' if len(' '.join(pkgs)) > 257 else '' - packages_txt = str(len(ids)) + ' packages ' if len(pkgs) > 1 else '' - trailing = ' - artifacts will be preserved' if artifacts else '' - trailing += ' - with irc notification' if notify else '' - trailing += ' - notify on start too' if notify_on_start else '' - - message = requester + ' scheduled ' + packages_txt + \ - 'in ' + suite + '/' + arch - if reason: - message += ', reason: \'' + reason + '\'' - message += ': ' + ' '.join(pkgs)[0:256] + blablabla + trailing - + def compose_irc_message(): + "One-shot closure to limit scope of the following local variables." + blablabla = '✂…' if len(' '.join(pkgs)) > 257 else '' + packages_txt = str(len(ids)) + ' packages ' if len(pkgs) > 1 else '' + trailing = ' - artifacts will be preserved' if artifacts else '' + trailing += ' - with irc notification' if notify else '' + trailing += ' - notify on start too' if notify_on_start else '' + + message = requester + ' scheduled ' + packages_txt + \ + 'in ' + suite + '/' + arch + if reason: + message += ', reason: \'' + reason + '\'' + message += ': ' + ' '.join(pkgs)[0:256] + blablabla + trailing + return message + message = compose_irc_message() + del compose_irc_message # these packages are manually scheduled, so should have high priority, # so schedule them in the past, so they are picked earlier :) -- cgit v1.2.3-54-g00ecf