613 |
|
|
614 |
def cmd_ls(options, parser): |
def cmd_ls(options, parser): |
615 |
for package, module, package_version, spec_version, downstream_files in sorted(join_streams(show_version=options.show_version, only_diff_version=options.diff)): |
for package, module, package_version, spec_version, downstream_files in sorted(join_streams(show_version=options.show_version, only_diff_version=options.diff)): |
616 |
print package,"\t", |
sys.stdout.write(package) |
617 |
if options.upstream: print module, "\t", |
if options.upstream: sys.stdout.write("\t%s" % module) |
618 |
if options.show_version: print spec_version, "\t", package_version, "\t", |
if options.show_version: sys.stdout.write("\t%s\t%s".join((spec_version, package_version))) |
619 |
print |
print |
620 |
|
|
621 |
def cmd_patches(options, parser): |
def cmd_patches(options, parser): |
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) |
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.""" |