--- mga-gnome/trunk/mga-gnome 2012/03/02 13:53:22 3176 +++ mga-gnome/trunk/mga-gnome 2012/03/02 21:25:11 3180 @@ -43,6 +43,9 @@ # to be able to sleep for a while import time +# version freeze +import datetime + MEDIA="Core Release Source" URL="http://download.gnome.org/sources/" PKGROOT='~/pkgs' @@ -621,11 +624,11 @@ def cmd_parse_ftp_release_list(options, parser): # XXX - not working yet - def _send_reply_mail(contents, orig_msg, to): + def _send_reply_mail(contents, orig_msg, to, error=False): """Send an reply email""" contents.seek(0) msg = MIMEText(contents.read(), _charset='utf-8') - msg['Subject'] = "Re: %s" % orig_msg['Subject'] + msg['Subject'] = "Re: %s%s" % (orig_msg['Subject'], " (ERROR)" if error else "") msg['To'] = to msg["In-Reply-To"] = orig_msg["Message-ID"] msg["References"] = orig_msg["Message-ID"] @@ -649,20 +652,27 @@ stdout = sys.stdout stderr = sys.stderr + version_freeze = datetime.datetime(2012,3,7,23,59,0) + now = datetime.datetime.utcnow() + if now > version_freeze: + print >>stderr, "ERROR: Past version freeze" + if options.mail: _send_reply_mail(stdout, msg, options.mail, error=True) + sys.exit(1) + try: module = msg['X-Module-Name'] version = msg['X-Module-Version'] hexdigest = msg['X-Module-SHA256-tar.xz'] except KeyError, e: print >>stderr, "ERROR: %s" % e - if options.mail: _send_reply_mail(stdout, msg, options.mail) + if options.mail: _send_reply_mail(stdout, msg, options.mail, error=True) sys.exit(1) try: packages = get_downstream_from_upstream(module, version) except ValueError, e: print >>stderr, "ERROR: %s" % e - if options.mail: _send_reply_mail(stdout, msg, options.mail) + if options.mail: _send_reply_mail(stdout, msg, options.mail, error=True) sys.exit(1) if options.wait: @@ -671,10 +681,12 @@ if os.fork() != 0: sys.exit(0) time.sleep(SLEEP_INITIAL) + error = False for package in packages: - subprocess.call(['mga-gnome', 'increase', '--submit', '--hash', hexdigest, package, version], stdout=stdout, stderr=stderr) + if subprocess.call(['mga-gnome', 'increase', '--submit', '--hash', hexdigest, package, version], stdout=stdout, stderr=stderr): + error = True - if options.mail: _send_reply_mail(stdout, msg, options.mail) + if options.mail: _send_reply_mail(stdout, msg, options.mail, error=error) def main(): description = """Mageia GNOME commands."""