43 |
# to be able to sleep for a while |
# to be able to sleep for a while |
44 |
import time |
import time |
45 |
|
|
46 |
|
# version freeze |
47 |
|
import datetime |
48 |
|
|
49 |
MEDIA="Core Release Source" |
MEDIA="Core Release Source" |
50 |
URL="http://download.gnome.org/sources/" |
URL="http://download.gnome.org/sources/" |
51 |
PKGROOT='~/pkgs' |
PKGROOT='~/pkgs' |
624 |
|
|
625 |
def cmd_parse_ftp_release_list(options, parser): |
def cmd_parse_ftp_release_list(options, parser): |
626 |
# XXX - not working yet |
# XXX - not working yet |
627 |
def _send_reply_mail(contents, orig_msg, to): |
def _send_reply_mail(contents, orig_msg, to, error=False): |
628 |
"""Send an reply email""" |
"""Send an reply email""" |
629 |
contents.seek(0) |
contents.seek(0) |
630 |
msg = MIMEText(contents.read(), _charset='utf-8') |
msg = MIMEText(contents.read(), _charset='utf-8') |
631 |
msg['Subject'] = "Re: %s" % orig_msg['Subject'] |
msg['Subject'] = "Re: %s%s" % (orig_msg['Subject'], " (ERROR)" if error else "") |
632 |
msg['To'] = to |
msg['To'] = to |
633 |
msg["In-Reply-To"] = orig_msg["Message-ID"] |
msg["In-Reply-To"] = orig_msg["Message-ID"] |
634 |
msg["References"] = orig_msg["Message-ID"] |
msg["References"] = orig_msg["Message-ID"] |
652 |
stdout = sys.stdout |
stdout = sys.stdout |
653 |
stderr = sys.stderr |
stderr = sys.stderr |
654 |
|
|
655 |
|
version_freeze = datetime.datetime(2012,3,7,23,59,0) |
656 |
|
now = datetime.datetime.utcnow() |
657 |
|
if now > version_freeze: |
658 |
|
print >>stderr, "ERROR: Past version freeze" |
659 |
|
if options.mail: _send_reply_mail(stdout, msg, options.mail, error=True) |
660 |
|
sys.exit(1) |
661 |
|
|
662 |
try: |
try: |
663 |
module = msg['X-Module-Name'] |
module = msg['X-Module-Name'] |
664 |
version = msg['X-Module-Version'] |
version = msg['X-Module-Version'] |
665 |
hexdigest = msg['X-Module-SHA256-tar.xz'] |
hexdigest = msg['X-Module-SHA256-tar.xz'] |
666 |
except KeyError, e: |
except KeyError, e: |
667 |
print >>stderr, "ERROR: %s" % e |
print >>stderr, "ERROR: %s" % e |
668 |
if options.mail: _send_reply_mail(stdout, msg, options.mail) |
if options.mail: _send_reply_mail(stdout, msg, options.mail, error=True) |
669 |
sys.exit(1) |
sys.exit(1) |
670 |
|
|
671 |
try: |
try: |
672 |
packages = get_downstream_from_upstream(module, version) |
packages = get_downstream_from_upstream(module, version) |
673 |
except ValueError, e: |
except ValueError, e: |
674 |
print >>stderr, "ERROR: %s" % e |
print >>stderr, "ERROR: %s" % e |
675 |
if options.mail: _send_reply_mail(stdout, msg, options.mail) |
if options.mail: _send_reply_mail(stdout, msg, options.mail, error=True) |
676 |
sys.exit(1) |
sys.exit(1) |
677 |
|
|
678 |
if options.wait: |
if options.wait: |
681 |
if os.fork() != 0: sys.exit(0) |
if os.fork() != 0: sys.exit(0) |
682 |
time.sleep(SLEEP_INITIAL) |
time.sleep(SLEEP_INITIAL) |
683 |
|
|
684 |
|
error = False |
685 |
for package in packages: |
for package in packages: |
686 |
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): |
687 |
|
error = True |
688 |
|
|
689 |
if options.mail: _send_reply_mail(stdout, msg, options.mail) |
if options.mail: _send_reply_mail(stdout, msg, options.mail, error=error) |
690 |
|
|
691 |
def main(): |
def main(): |
692 |
description = """Mageia GNOME commands.""" |
description = """Mageia GNOME commands.""" |