From e18bbcfef33af6b17b4af3b8187d3014a23dedb5 Mon Sep 17 00:00:00 2001 From: skyjake Date: Wed, 3 Apr 2013 07:43:26 +0300 Subject: [PATCH] Builder|Fixed: Sign and publish the latest build, not today's These changes allow the day to change during a build; the steps following the initial tagging now operate on the latest available build rather than today's build. --- distrib/autobuild.py | 16 ++++++++++++---- distrib/builder/event.py | 9 ++++++++- distrib/builder/utils.py | 7 +++++++ distrib/pilot.py | 2 +- 4 files changed, 28 insertions(+), 6 deletions(-) diff --git a/distrib/autobuild.py b/distrib/autobuild.py index aa3d3ae45f..8e3097654c 100755 --- a/distrib/autobuild.py +++ b/distrib/autobuild.py @@ -87,15 +87,22 @@ def todays_platform_release(): def sign_packages(): - """Sign all packages in today's build.""" - ev = builder.Event() - print "Signing today's build %i." % ev.number() + """Sign all packages in the latest build.""" + ev = builder.Event(latestAvailable=True) + print "Signing build %i." % ev.number() for fn in os.listdir(ev.path()): if fn.endswith('.exe') or fn.endswith('.dmg') or fn.endswith('.deb'): # Make a signature for this. os.system("gpg --output %s -ba %s" % (ev.file_path(fn) + '.sig', ev.file_path(fn))) +def publish_packages(): + """Publish all packages to SourceForge.""" + ev = builder.Event(latestAvailable=True) + print "Publishing build %i." % ev.number() + system_command('deng_copy_build_to_sourceforge.sh "%s"' % ev.path()) + + def find_previous_tag(toTag, version): builds = builder.events_by_time() #print [(e[1].number(), e[1].timestamp()) for e in builds] @@ -348,7 +355,7 @@ def generate_wiki(): import dew dew.login() # Today's event data. - ev = builder.Event() + ev = builder.Event(latestAvailable=True) if ev.release_type() == 'stable': dew.submitPage('Latest Doomsday release', '#REDIRECT [[Doomsday version %s]]' % ev.version()) @@ -437,6 +444,7 @@ def sorted_commands(): 'create': create_build_event, 'platform_release': todays_platform_release, 'sign': sign_packages, + 'publish': publish_packages, 'changes': update_changes, 'debchanges': update_debian_changelog, 'apt': rebuild_apt_repository, diff --git a/distrib/builder/event.py b/distrib/builder/event.py index bfe4b9ee66..f9168f4fec 100644 --- a/distrib/builder/event.py +++ b/distrib/builder/event.py @@ -11,9 +11,16 @@ class Event: """Build event. Manages the contents of a single build directory under the event directory.""" - def __init__(self, build=None): + def __init__(self, build=None, latestAvailable=False): """Any .txt logs present in the build directory are compressed into a combined .txt.gz (one per package).""" + + if latestAvailable: + # Look for the latest build. + build = int(build_number.todays_build()) + while not os.path.exists(os.path.join(config.EVENT_DIR, 'build%i' % build)): + build -= 1 + if build == 0: raise Exception("No builds available") if build is None: # Use today's build number. diff --git a/distrib/builder/utils.py b/distrib/builder/utils.py index 3956173d98..7f5b483dfe 100644 --- a/distrib/builder/utils.py +++ b/distrib/builder/utils.py @@ -1,4 +1,5 @@ import os, sys, platform +import subprocess import string import glob import gzip @@ -152,3 +153,9 @@ def count_word(word, inText): count += 1 pos += len(word) return count + + +def system_command(cmd): + result = subprocess.call(cmd, shell=True) + if result != 0: + raise Exception("Error from " + cmd) diff --git a/distrib/pilot.py b/distrib/pilot.py index 7c72b2f1f2..687465a55d 100755 --- a/distrib/pilot.py +++ b/distrib/pilot.py @@ -328,7 +328,7 @@ def doTask(task): elif task == 'publish': msg("PUBLISH") - systemCommand('deng_copy_build_to_sourceforge.sh') + return autobuild("publish") elif task == 'apt_refresh': msg("APT REPOSITORY REFRESH")