From 46ddc27f0bbdc0aa0c27541d63460214c4686498 Mon Sep 17 00:00:00 2001 From: Mattia Rizzolo Date: Sun, 29 Nov 2015 23:30:20 +0000 Subject: reproducible: refactor how the 'notify on build start' feature is handled, stop abusing of the builder column in the db for this --- TODO | 1 - bin/reproducible_build.sh | 3 +-- bin/reproducible_remote_scheduler.py | 22 ++++++++++------------ 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/TODO b/TODO index 918d197f..fd6b7476 100644 --- a/TODO +++ b/TODO @@ -201,7 +201,6 @@ This is about Debian, below are more todo entries for other projects… ** use reprepro and snapshot (reprepro gen-snapshot) on alioth to speed up our repo, maybe. maybe we'll just be in sid soon :-) ** database issues *** stats_build table should have package ids, not just src+suite+arch as primary key -*** builder column of schedule table should not be used for state-handling of _remote_scheduler.py (by setting it to 'TBD') ** send notifications to maintainers when a note to their packages changes? ** blacklist script should tell if a package was already blacklisted. also proper options should be used... ** _maintenance.sh: delete the history pages once a page has been removed from all suites+archs diff --git a/bin/reproducible_build.sh b/bin/reproducible_build.sh index e8256318..87dda59a 100755 --- a/bin/reproducible_build.sh +++ b/bin/reproducible_build.sh @@ -417,7 +417,6 @@ choose_package() { SAVE_ARTIFACTS=$(echo $RESULT|cut -d "|" -f5) NOTIFY=$(echo $RESULT|cut -d "|" -f6) NOTIFY_MAINTAINER=$(echo $RESULT|cut -d "|" -f7) - local DEBUG_URL=$(echo $RESULT|cut -d "|" -f8) # this is abuse (state-handling...) of the boulder column in the schedule table… # remove previous build attempts which didnt finish correctly: BUILDER_PREFIX="${JOB_NAME#reproducible_builder_}/" BAD_BUILDS=$(mktemp --tmpdir=$TMPDIR) @@ -464,7 +463,7 @@ choose_package() { ;; *) ;; esac - if [ "$DEBUG_URL" = "TBD" ] ; then + if [ "$NOTIFY" = "2" ] ; then irc_message "$SRCPACKAGE/$SUITE/$ARCH started building at ${BUILD_URL}console" fi echo "$(date -u ) - starting to build ${SRCPACKAGE}/${SUITE}/${ARCH} on $(hostname -f) on '$DATE'" | tee ${RBUILDLOG} diff --git a/bin/reproducible_remote_scheduler.py b/bin/reproducible_remote_scheduler.py index cf8a7479..39befb23 100755 --- a/bin/reproducible_remote_scheduler.py +++ b/bin/reproducible_remote_scheduler.py @@ -80,7 +80,7 @@ built_before = scheduling_args.before packages = [x for x in scheduling_args.packages if x] artifacts = scheduling_args.keep_artifacts notify = scheduling_args.notify or scheduling_args.noisy -debug_url = scheduling_args.noisy +notify_on_start = scheduling_args.noisy dry_run = scheduling_args.dry_run log.debug('Requester: ' + requester) @@ -89,7 +89,7 @@ log.debug('Local call: ' + str(local)) log.debug('Reason: ' + reason) log.debug('Artifacts: ' + str(artifacts)) log.debug('Notify: ' + str(notify)) -log.debug('Debug url: ' + str(debug_url)) +log.debug('Debug url: ' + str(notify_on_start)) log.debug('Issue: ' + issue if issue else str(None)) log.debug('Status: ' + status if status else str(None)) log.debug('Date: after ' + built_after if built_after else str(None) + @@ -151,7 +151,7 @@ if artifacts: log.info('The artifacts of the build(s) will be saved to the location ' 'mentioned at the end of the build log(s).') -if debug_url: +if notify_on_start: log.info('The channel will be notified when the build starts') ids = [] @@ -188,7 +188,7 @@ 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 debug_url else '' +trailing += ' - notify on start too' if notify_on_start else '' message = requester + ' scheduled ' + packages_txt + \ 'in ' + suite + '/' + arch @@ -232,19 +232,17 @@ if amount + len(ids) > 200 and not local: # do the actual scheduling to_schedule = [] save_schedule = [] -notify = '' if not notify else notify -debug_url = '' if not debug_url else 'TBD' +notify = 1 if notify else 0 +notify = 2 if notify_on_start else 0 +artifacts_value = 1 if artifacts else 0 for id in ids: - artifacts_value = 1 if artifacts else 0 - to_schedule.append((id, date, artifacts_value, str(notify).lower(), - requester, debug_url)) + to_schedule.append((id, date, artifacts_value, str(notify), requester)) save_schedule.append((id, requester, epoch)) log.debug('Packages about to be scheduled: ' + str(to_schedule)) query1 = '''REPLACE INTO schedule - (package_id, date_scheduled, date_build_started, save_artifacts, notify, - scheduler, builder) - VALUES (?, ?, "", ?, ?, ?, ?)''' + (package_id, date_scheduled, save_artifacts, notify, scheduler) + VALUES (?, ?, ?, ?, ?)''' query2 = '''INSERT INTO manual_scheduler (package_id, requester, date_request) VALUES (?, ?, ?)''' -- cgit v1.2.3-70-g09d2