338 |
subprocess.check_call(['bm', '-p', '--nodeps'], cwd=self.cwd) |
subprocess.check_call(['bm', '-p', '--nodeps'], cwd=self.cwd) |
339 |
except subprocess.CalledProcessError: |
except subprocess.CalledProcessError: |
340 |
logfile = os.path.join(os.path.dirname(self.path), 'log.%s' % os.path.splitext(os.path.basename(self.path))[0]) |
logfile = os.path.join(os.path.dirname(self.path), 'log.%s' % os.path.splitext(os.path.basename(self.path))[0]) |
341 |
if os.path.exists(logfile) |
if os.path.exists(logfile): |
342 |
subprocess.call(['tail', '-n', '15', logfile]) |
subprocess.call(['tail', '-n', '15', logfile]) |
343 |
return False |
return False |
344 |
|
|
673 |
sys.stderr(1) |
sys.stderr(1) |
674 |
|
|
675 |
for filename in sources: |
for filename in sources: |
676 |
if not is_valid_hash(os.path.join(cwd, "SOURCES", filename), options.algo, options.hexdigest): |
path = os.path.join(cwd, "SOURCES", filename) |
677 |
|
if not is_valid_hash(path, options.algo, options.hexdigest): |
678 |
print >>sys.stderr, "ERROR: Hash file failed check for %s!" % path |
print >>sys.stderr, "ERROR: Hash file failed check for %s!" % path |
679 |
print >>sys.stderr, "ERROR: Reverting changes!" |
print >>sys.stderr, "ERROR: Reverting changes!" |
680 |
subprocess.call(['svn', 'revert', '-R', cwd], cwd=cwd) |
subprocess.call(['svn', 'revert', '-R', cwd], cwd=cwd) |
686 |
# checkin changes |
# checkin changes |
687 |
subprocess.check_call(['mgarepo', 'ci', '-m', 'new version %s' % options.version], cwd=cwd) |
subprocess.check_call(['mgarepo', 'ci', '-m', 'new version %s' % options.version], cwd=cwd) |
688 |
# and submit |
# and submit |
689 |
subprocess.check_call(['mgarepo', 'submit'], cwd=cwd) |
# XXX HACK NOT TO AUTO SUBMIT ATM |
690 |
|
if options.hexdigest is None: |
691 |
|
subprocess.check_call(['mgarepo', 'submit'], cwd=cwd) |
692 |
except subprocess.CalledProcessError: |
except subprocess.CalledProcessError: |
693 |
sys.exit(1) |
sys.exit(1) |
694 |
|
|
695 |
def cmd_parse_ftp_release_list(options, parser): |
def cmd_parse_ftp_release_list(options, parser): |
696 |
def _send_reply_mail(contents, orig_msg, to, error=False): |
def _send_reply_mail(contents, orig_msg, to, packages=[], error=False): |
697 |
"""Send an reply email""" |
"""Send an reply email""" |
698 |
contents.seek(0) |
contents.seek(0) |
699 |
msg = MIMEText(contents.read(), _charset='utf-8') |
msg = MIMEText(contents.read(), _charset='utf-8') |
700 |
|
|
701 |
if error: |
if error: |
702 |
# XXX - ugly |
# XXX - ugly |
703 |
contents.seek(0) |
contents.seek(0) |
704 |
lastline = contents.read().rstrip().splitlines()[-1] |
lastline = contents.read().rstrip().splitlines()[-1] |
705 |
# Remove things like "ERROR: " and so on from the last line |
# Remove things like "ERROR: " and so on from the last line |
706 |
lastline = re.sub(r'^(?:[^ :]+:\s+)+', '', lastline) |
lastline = re.sub(r'^(?:[^ :]+:\s+)+', '', lastline) |
707 |
|
# Remove things like " - " (youri output from mgarepo submit) |
708 |
|
lastline = re.sub(r'^\s+-\s+', '', lastline) |
709 |
subjecterror = " (ERROR: %s)" % lastline if lastline else " (ERROR)" |
subjecterror = " (ERROR: %s)" % lastline if lastline else " (ERROR)" |
710 |
else: |
else: |
711 |
subjecterror = "" |
subjecterror = "" |
712 |
msg['Subject'] = "Re: %s%s" % (orig_msg['Subject'], subjecterror) |
|
713 |
|
if packages: |
714 |
|
subject = "%s %s%s" % (", ".join(packages), orig_msg['X-Module-Version'], subjecterror) |
715 |
|
else: |
716 |
|
subject = "Re: %s%s" % (orig_msg['Subject'], subjecterror) |
717 |
|
|
718 |
|
msg['Subject'] = subject |
719 |
msg['To'] = to |
msg['To'] = to |
720 |
msg["In-Reply-To"] = orig_msg["Message-ID"] |
msg["In-Reply-To"] = orig_msg["Message-ID"] |
721 |
msg["References"] = orig_msg["Message-ID"] |
msg["References"] = orig_msg["Message-ID"] |
777 |
if subprocess.call(cmd, stdout=stdout, stderr=stderr): |
if subprocess.call(cmd, stdout=stdout, stderr=stderr): |
778 |
error = True |
error = True |
779 |
|
|
780 |
if options.mail: _send_reply_mail(stdout, msg, options.mail, error=error) |
if options.mail: _send_reply_mail(stdout, msg, options.mail, packages=packages, error=error) |
781 |
|
|
782 |
def main(): |
def main(): |
783 |
description = """Mageia GNOME commands.""" |
description = """Mageia GNOME commands.""" |