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' |
52 |
SLEEP_INITIAL=300 |
SLEEP_INITIAL=180 |
53 |
|
SLEEP_REPEAT=30 |
54 |
|
SLEEP_TIMES=20 |
55 |
|
|
56 |
re_majmin = re.compile(r'^([0-9]+\.[0-9]+).*') |
re_majmin = re.compile(r'^([0-9]+\.[0-9]+).*') |
57 |
re_version = re.compile(r'([-.]|\d+|[^-.\d]+)') |
re_version = re.compile(r'([-.]|\d+|[^-.\d]+)') |
259 |
else spec.sources() |
else spec.sources() |
260 |
return dict((os.path.basename(name), name) for name, no, flags in srclist) |
return dict((os.path.basename(name), name) for name, no, flags in srclist) |
261 |
|
|
262 |
def update(self, version): |
def update(self, version, force=False): |
263 |
"""Update specfile (increase version)""" |
"""Update specfile (increase version)""" |
264 |
cur_version = self.version |
cur_version = self.version |
265 |
|
|
271 |
|
|
272 |
if judgement < 5: |
if judgement < 5: |
273 |
print "WARNING: %s!" % (msg) |
print "WARNING: %s!" % (msg) |
274 |
return False |
if not force: return False |
275 |
|
|
276 |
# XXX - os.path.join is hackish |
# XXX - os.path.join is hackish |
277 |
if subprocess.check_output(["svn", "diff", os.path.join(self.path, '..')]) != '': |
svn_diff_output = subprocess.check_output(["svn", "diff", os.path.join(self.path, '..')]) |
278 |
|
if svn_diff_output != '': |
279 |
|
print svn_diff_output |
280 |
print >>sys.stderr, "ERROR: Package has uncommitted changes!" |
print >>sys.stderr, "ERROR: Package has uncommitted changes!" |
281 |
return False |
if not force: |
282 |
|
return False |
283 |
|
|
284 |
|
# Forcing package submission: revert changes |
285 |
|
try: |
286 |
|
print >>sys.stderr, "WARNING: Force used; reverting svn changes" |
287 |
|
subprocess.check_call(["svn", "revert", "-R", os.path.join(self.path, '..')]) |
288 |
|
except subprocess.CalledProcessError: |
289 |
|
return False |
290 |
|
|
291 |
with open(self.path, "rw") as f: |
with open(self.path, "rw") as f: |
292 |
data = f.read() |
data = f.read() |
314 |
print "ERROR: Increased version to %s, but RPM doesn't agree!?!" % version |
print "ERROR: Increased version to %s, but RPM doesn't agree!?!" % version |
315 |
return False |
return False |
316 |
|
|
317 |
|
|
318 |
|
# Try to download the new tarball various times and wait between attempts |
319 |
|
tries = 0 |
320 |
|
while tries < SLEEP_TIMES: |
321 |
|
tries += 1 |
322 |
|
if tries > 1: time.sleep(SLEEP_REPEAT) |
323 |
|
try: |
324 |
|
# Download new tarball |
325 |
|
subprocess.check_call(['mgarepo', 'sync', '-d'], cwd=self.cwd) |
326 |
|
# success, so exit loop |
327 |
|
break |
328 |
|
except subprocess.CalledProcessError, e: |
329 |
|
# mgarepo sync returns 1 if the tarball cannot be downloaded |
330 |
|
if e.returncode != 1: |
331 |
|
return False |
332 |
|
else: |
333 |
|
return False |
334 |
|
|
335 |
|
|
336 |
try: |
try: |
|
# Download new tarball |
|
|
subprocess.check_call(['mgarepo', 'sync', '-d'], cwd=self.cwd) |
|
337 |
# Check patches still apply |
# Check patches still apply |
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]) |
341 |
|
if os.path.exists(logfile): |
342 |
|
subprocess.call(['tail', '-n', '15', logfile]) |
343 |
return False |
return False |
344 |
|
|
345 |
return True |
return True |
484 |
|
|
485 |
return self._svn_author |
return self._svn_author |
486 |
|
|
|
def get_upstream_names(): |
|
|
urlopen = urllib2.build_opener() |
|
487 |
|
|
488 |
good_dir = re.compile('^[-A-Za-z0-9_+.]+/$') |
class Upstream(object): |
489 |
|
|
490 |
|
limit = None |
491 |
|
|
492 |
# Get the files |
def __init__(self): |
493 |
usock = urlopen.open(URL) |
urlopen = urllib2.build_opener() |
|
parser = urllister() |
|
|
parser.feed(usock.read()) |
|
|
usock.close() |
|
|
parser.close() |
|
|
files = parser.urls |
|
494 |
|
|
495 |
tarballs = set([filename.replace('/', '') for filename in files if good_dir.search(filename)]) |
good_dir = re.compile('^[-A-Za-z0-9_+.]+/$') |
496 |
|
|
497 |
return tarballs |
# Get the files |
498 |
|
usock = urlopen.open(URL) |
499 |
|
parser = urllister() |
500 |
|
parser.feed(usock.read()) |
501 |
|
usock.close() |
502 |
|
parser.close() |
503 |
|
files = parser.urls |
504 |
|
|
505 |
def get_downstream_names(): |
tarballs = set([filename.replace('/', '') for filename in files if good_dir.search(filename)]) |
506 |
|
if self.limit is not None: |
507 |
|
tarballs.intersection_update(self.limit) |
508 |
|
|
509 |
|
self.names = tarballs |
510 |
|
|
511 |
|
class Downstream(object): |
512 |
re_file = re.compile(r'^(?P<module>.*?)[_-](?:(?P<oldversion>([0-9]+[\.])*[0-9]+)-)?(?P<version>([0-9]+[\.\-])*[0-9]+)\.(?P<format>(?:tar\.|diff\.)?[a-z][a-z0-9]*)$') |
re_file = re.compile(r'^(?P<module>.*?)[_-](?:(?P<oldversion>([0-9]+[\.])*[0-9]+)-)?(?P<version>([0-9]+[\.\-])*[0-9]+)\.(?P<format>(?:tar\.|diff\.)?[a-z][a-z0-9]*)$') |
513 |
|
|
514 |
contents = subprocess.check_output(['urpmf', '--files', '.', "--media", MEDIA], close_fds=True).strip("\n").splitlines() |
def __init__(self): |
515 |
|
contents = subprocess.check_output(['urpmf', '--qf', '%name|%version|%files', '.', "--media", MEDIA], close_fds=True).strip("\n").splitlines() |
516 |
|
|
517 |
FILES = {} |
FILES = {} |
518 |
TARBALLS = {} |
TARBALLS = {} |
519 |
|
|
520 |
for line in contents: |
for line in contents: |
521 |
try: |
try: |
522 |
srpm, filename = line.split(":") |
srpm, version, filename = line.split("|") |
523 |
except ValueError: |
except ValueError: |
524 |
print >>sys.stderr, line |
print >>sys.stderr, line |
525 |
continue |
continue |
526 |
|
|
527 |
if '.tar' in filename: |
if '.tar' in filename: |
528 |
r = re_file.match(filename) |
r = self.re_file.match(filename) |
529 |
if r: |
if r: |
530 |
fileinfo = r.groupdict() |
fileinfo = r.groupdict() |
531 |
module = fileinfo['module'] |
module = fileinfo['module'] |
532 |
|
|
533 |
if module not in TARBALLS: |
if module not in TARBALLS: |
534 |
TARBALLS[module] = set() |
TARBALLS[module] = {} |
535 |
TARBALLS[module].add(srpm) |
TARBALLS[module][srpm] = version |
536 |
|
|
537 |
if srpm not in FILES: |
if srpm not in FILES: |
538 |
FILES[srpm] = set() |
FILES[srpm] = set() |
539 |
FILES[srpm].add(filename) |
FILES[srpm].add(filename) |
540 |
|
|
541 |
return TARBALLS, FILES |
self.tarballs = TARBALLS |
542 |
|
self.files = FILES |
543 |
|
|
544 |
def get_downstream_from_upstream(upstream, version): |
def get_downstream_from_upstream(upstream, version): |
545 |
# Determine the package name |
# Determine the package name |
546 |
downstream, downstream_files = get_downstream_names() |
downstream = Downstream() |
547 |
|
# downstream, downstream_files = get_downstream_names() |
548 |
|
|
549 |
if upstream not in downstream: |
if upstream not in downstream: |
550 |
raise ValueError("No packages for upstream name: %s" % upstream) |
raise ValueError("No packages for upstream name: %s" % upstream) |
551 |
|
|
552 |
if len(downstream[upstream]) != 1: |
if len(downstream.tarballs[upstream]) == 1: |
553 |
# XXX - Make it more intelligent |
return downstream.tarballs[upstream].keys() |
554 |
raise ValueError("Multiple packages found for %s: %s" % (upstream, ", ".join(downstream[upstream]))) |
|
555 |
|
# Directories packages are located in |
556 |
|
root = os.path.expanduser(PKGROOT) |
557 |
|
|
558 |
|
packages = {} |
559 |
|
for package in downstream.tarballs[upstream].keys(): |
560 |
|
cwd = os.path.join(root, package) |
561 |
|
|
562 |
|
# Checkout package to ensure the checkout reflects the latest changes |
563 |
|
try: |
564 |
|
subprocess.check_call(['mgarepo', 'co', package], cwd=root) |
565 |
|
except subprocess.CalledProcessError: |
566 |
|
raise ValueError("Multiple packages found and cannot checkout %s" % package) |
567 |
|
|
568 |
|
# Determine version from spec file |
569 |
|
try: |
570 |
|
packages[package] = SpecFile(os.path.join(cwd, "SPECS", "%s.spec" % package)).version |
571 |
|
except subprocess.CalledProcessError: |
572 |
|
raise ValueError("Multiple packages found and cannot determine version of %s" % package) |
573 |
|
|
574 |
|
# Return all packages reflecting the current version |
575 |
|
matches = [package for package in packages if packages[package] == version] |
576 |
|
if len(matches): |
577 |
|
return matches |
578 |
|
|
579 |
|
# Return all packages reflecting the version before the current version |
580 |
|
latest_version = get_latest_version(packages.values(), max_version=version) |
581 |
|
matches = [package for package in packages if packages[package] == latest_version] |
582 |
|
if len(matches): |
583 |
|
return matches |
584 |
|
|
585 |
return list(downstream[upstream]) |
# Give up |
586 |
|
raise ValueError("Multiple packages found and cannot determine package for version %s" % version) |
587 |
|
|
588 |
def write_file(path, data): |
def write_file(path, data): |
589 |
with tempfile.NamedTemporaryFile(dir=os.path.dirname(path), delete=False) as fdst: |
with tempfile.NamedTemporaryFile(dir=os.path.dirname(path), delete=False) as fdst: |
592 |
os.rename(fdst.name, path) |
os.rename(fdst.name, path) |
593 |
|
|
594 |
def cmd_co(options, parser): |
def cmd_co(options, parser): |
595 |
upstream = get_upstream_names() |
root = os.path.expanduser(PKGROOT) |
|
downstream, downstream_files = get_downstream_names() |
|
596 |
|
|
597 |
cwd = os.path.expanduser(PKGROOT) |
for package, module, package_version, spec_version, downstream_files in sorted(join_streams()): |
598 |
|
print "%s => %s" % (module, package) |
599 |
|
subprocess.call(['mgarepo', 'co', package], cwd=root) |
600 |
|
|
601 |
matches = upstream & set(downstream.keys()) |
def join_streams(show_version=False, only_diff_version=False): |
602 |
for module in matches: |
root = os.path.expanduser(PKGROOT) |
603 |
print module, "\t".join(downstream[module]) |
|
604 |
for package in downstream[module]: |
upstream = Upstream().names |
605 |
subprocess.call(['mgarepo', 'co', package], cwd=cwd) |
downstream = Downstream() |
|
|
|
|
def join_streams(): |
|
|
upstream = get_upstream_names() |
|
|
downstream, downstream_files = get_downstream_names() |
|
606 |
|
|
607 |
matches = upstream & set(downstream.keys()) |
matches = upstream & set(downstream.tarballs.keys()) |
608 |
for module in matches: |
for module in matches: |
609 |
for package in downstream[module]: |
for package in downstream.tarballs[module].keys(): |
610 |
yield (package, module) |
package_version = downstream.tarballs[module][package] |
611 |
|
spec_version = None |
612 |
|
if show_version or only_diff_version: |
613 |
|
cwd = os.path.join(root, package) |
614 |
|
try: |
615 |
|
spec_version = SpecFile(os.path.join(cwd, "SPECS", "%s.spec" % package)).version |
616 |
|
except subprocess.CalledProcessError: |
617 |
|
spec_version = 'N/A' |
618 |
|
|
619 |
def cmd_ls(options, parser): |
if only_diff_version and package_version == spec_version: |
620 |
for package, module in sorted(join_streams()): |
continue |
|
print "\t".join((package, module)) if options.upstream else package |
|
621 |
|
|
622 |
def cmd_patches(options, parser): |
yield (package, module, package_version, spec_version, downstream.files[package]) |
|
upstream = get_upstream_names() |
|
|
downstream, downstream_files = get_downstream_names() |
|
623 |
|
|
624 |
path = os.path.expanduser(PKGROOT) |
def cmd_ls(options, parser): |
625 |
|
for package, module, package_version, spec_version, downstream_files in sorted(join_streams(show_version=options.show_version, only_diff_version=options.diff)): |
626 |
|
sys.stdout.write(package) |
627 |
|
if options.upstream: sys.stdout.write("\t%s" % module) |
628 |
|
if options.show_version: sys.stdout.write("\t%s\t%s" % (spec_version, package_version)) |
629 |
|
print |
630 |
|
|
631 |
import pprint |
def cmd_patches(options, parser): |
632 |
|
root = os.path.expanduser(PKGROOT) |
633 |
|
|
634 |
matches = upstream & set(downstream.keys()) |
for package, module, package_version, spec_version, downstream_files in sorted(join_streams()): |
635 |
for module in sorted(matches): |
for filename in downstream_files: |
636 |
for srpm in downstream[module]: |
if '.patch' in filename or '.diff' in filename: |
637 |
for filename in downstream_files[srpm]: |
|
638 |
if '.patch' in filename or '.diff' in filename: |
p = Patch(os.path.join(root, package, "SOURCES", filename), show_path=options.path) |
639 |
|
valid = "" |
640 |
p = Patch(os.path.join(path, srpm, "SOURCES", filename), show_path=options.path) |
forwarded = "" |
641 |
valid = "" |
if p.dep3['headers']: |
642 |
forwarded = "" |
forwarded = p.dep3['headers'].get('Forwarded', "no") |
643 |
if p.dep3['headers']: |
if p.dep3['valid']: |
644 |
forwarded = p.dep3['headers'].get('Forwarded', "no") |
valid="VALID" |
645 |
if p.dep3['valid']: |
print "\t".join((module, package, str(p), forwarded, valid)) |
|
valid="VALID" |
|
|
print "\t".join((module, srpm, str(p), forwarded, valid)) |
|
646 |
|
|
647 |
def cmd_dep3(options, parser): |
def cmd_dep3(options, parser): |
648 |
p = Patch(options.patch) |
p = Patch(options.patch) |
672 |
# SpecFile class handles the actual version+release change |
# SpecFile class handles the actual version+release change |
673 |
s = SpecFile(os.path.join(cwd, "SPECS", "%s.spec" % package)) |
s = SpecFile(os.path.join(cwd, "SPECS", "%s.spec" % package)) |
674 |
print "%s => %s" % (s.version, options.version) |
print "%s => %s" % (s.version, options.version) |
675 |
if not s.update(options.version): |
if not s.update(options.version, force=options.force): |
676 |
sys.exit(1) |
sys.exit(1) |
677 |
|
|
678 |
# Check hash, if given |
# Check hash, if given |
683 |
sys.stderr(1) |
sys.stderr(1) |
684 |
|
|
685 |
for filename in sources: |
for filename in sources: |
686 |
if not is_valid_hash(os.path.join(cwd, "SOURCES", filename), options.algo, options.hexdigest): |
path = os.path.join(cwd, "SOURCES", filename) |
687 |
|
if not is_valid_hash(path, options.algo, options.hexdigest): |
688 |
print >>sys.stderr, "ERROR: Hash file failed check for %s!" % path |
print >>sys.stderr, "ERROR: Hash file failed check for %s!" % path |
689 |
print >>sys.stderr, "ERROR: Reverting changes!" |
print >>sys.stderr, "ERROR: Reverting changes!" |
690 |
subprocess.call(['svn', 'revert', '-R', cwd], cwd=cwd) |
subprocess.call(['svn', 'revert', '-R', cwd], cwd=cwd) |
696 |
# checkin changes |
# checkin changes |
697 |
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) |
698 |
# and submit |
# and submit |
699 |
subprocess.check_call(['mgarepo', 'submit'], cwd=cwd) |
# XXX HACK NOT TO AUTO SUBMIT ATM |
700 |
|
if options.hexdigest is None: |
701 |
|
subprocess.check_call(['mgarepo', 'submit'], cwd=cwd) |
702 |
except subprocess.CalledProcessError: |
except subprocess.CalledProcessError: |
703 |
sys.exit(1) |
sys.exit(1) |
704 |
|
|
705 |
def cmd_parse_ftp_release_list(options, parser): |
def cmd_parse_ftp_release_list(options, parser): |
706 |
# XXX - not working yet |
def _send_reply_mail(contents, orig_msg, to, packages=[], error=False): |
|
def _send_reply_mail(contents, orig_msg, to): |
|
707 |
"""Send an reply email""" |
"""Send an reply email""" |
708 |
contents.seek(0) |
contents.seek(0) |
709 |
msg = MIMEText(contents.read(), _charset='utf-8') |
msg = MIMEText(contents.read(), _charset='utf-8') |
710 |
msg['Subject'] = "Re: %s" % orig_msg['Subject'] |
|
711 |
|
if error: |
712 |
|
# XXX - ugly |
713 |
|
contents.seek(0) |
714 |
|
lastline = contents.read().rstrip().splitlines()[-1] |
715 |
|
# Remove things like "ERROR: " and so on from the last line |
716 |
|
lastline = re.sub(r'^(?:[^ :]+:\s+)+', '', lastline) |
717 |
|
# Remove things like " - " (youri output from mgarepo submit) |
718 |
|
lastline = re.sub(r'^\s+-\s+', '', lastline) |
719 |
|
subjecterror = " (ERROR: %s)" % lastline if lastline else " (ERROR)" |
720 |
|
else: |
721 |
|
subjecterror = "" |
722 |
|
|
723 |
|
if packages: |
724 |
|
subject = "%s %s%s" % (", ".join(packages), orig_msg['X-Module-Version'], subjecterror) |
725 |
|
else: |
726 |
|
subject = "Re: %s%s" % (orig_msg['Subject'], subjecterror) |
727 |
|
|
728 |
|
msg['Subject'] = subject |
729 |
msg['To'] = to |
msg['To'] = to |
730 |
msg["In-Reply-To"] = orig_msg["Message-ID"] |
msg["In-Reply-To"] = orig_msg["Message-ID"] |
731 |
msg["References"] = orig_msg["Message-ID"] |
msg["References"] = orig_msg["Message-ID"] |
743 |
msg = email.email.message_from_file(sys.stdin) |
msg = email.email.message_from_file(sys.stdin) |
744 |
|
|
745 |
if options.mail: |
if options.mail: |
746 |
stdout = tempfile.NamedTemporaryFile() |
stdout = tempfile.TemporaryFile() |
747 |
stderr = stdout |
stderr = stdout |
748 |
else: |
else: |
749 |
stdout = sys.stdout |
stdout = sys.stdout |
755 |
hexdigest = msg['X-Module-SHA256-tar.xz'] |
hexdigest = msg['X-Module-SHA256-tar.xz'] |
756 |
except KeyError, e: |
except KeyError, e: |
757 |
print >>stderr, "ERROR: %s" % e |
print >>stderr, "ERROR: %s" % e |
758 |
if options.mail: _send_reply_mail(stdout, msg, options.mail) |
if options.mail: _send_reply_mail(stdout, msg, options.mail, error=True) |
759 |
sys.exit(1) |
sys.exit(1) |
760 |
|
|
761 |
try: |
try: |
762 |
packages = get_downstream_from_upstream(module, version) |
packages = get_downstream_from_upstream(module, version) |
763 |
except ValueError, e: |
except ValueError, e: |
764 |
print >>stderr, "ERROR: %s" % e |
print >>stderr, "ERROR: %s" % e |
765 |
if options.mail: _send_reply_mail(stdout, msg, options.mail) |
if options.mail: _send_reply_mail(stdout, msg, options.mail, error=True) |
766 |
sys.exit(1) |
sys.exit(1) |
767 |
|
|
768 |
if options.wait: |
if options.wait: |
769 |
# maildrop aborts and will try to deliver after 5min |
# maildrop aborts and will try to deliver after 5min |
770 |
# fork to avoid this |
# fork to avoid this |
771 |
if os.fork() != 0: sys.exit(0) |
if os.fork() != 0: sys.exit(0) |
772 |
time.sleep(SLEEP_INITIAL) |
# wait SLEEP_INITIAL after the message was sent |
773 |
|
secs = SLEEP_INITIAL |
774 |
|
t = email.utils.parsedate_tz(msg['Date']) |
775 |
|
if t is not None: |
776 |
|
msg_time = email.utils.mktime_tz(t) |
777 |
|
secs = SLEEP_INITIAL - (time.time() - msg_time) |
778 |
|
|
779 |
|
if secs > 0: time.sleep(secs) |
780 |
|
|
781 |
|
error = False |
782 |
for package in packages: |
for package in packages: |
783 |
subprocess.call(['mga-gnome', 'increase', '--submit', '--hash', hexdigest, package, version], stdout=stdout, stderr=stderr) |
cmd = ['mga-gnome', 'increase', '--submit', '--hash', hexdigest] |
784 |
|
if options.force: |
785 |
|
cmd.append('--force') |
786 |
|
cmd.extend((package, version)) |
787 |
|
if subprocess.call(cmd, stdout=stdout, stderr=stderr): |
788 |
|
error = True |
789 |
|
|
790 |
if options.mail: _send_reply_mail(stdout, msg, options.mail) |
if options.mail: _send_reply_mail(stdout, msg, options.mail, packages=packages, error=error) |
791 |
|
|
792 |
def main(): |
def main(): |
793 |
description = """Mageia GNOME commands.""" |
description = """Mageia GNOME commands.""" |
794 |
epilog="""Report bugs to Olav Vitters""" |
epilog="""Report bugs to Olav Vitters""" |
795 |
parser = argparse.ArgumentParser(description=description,epilog=epilog) |
parser = argparse.ArgumentParser(description=description,epilog=epilog) |
796 |
|
parser.add_argument("-l", "--limit", type=argparse.FileType('r', 0), |
797 |
|
dest="limit_upstream", metavar="FILE", |
798 |
|
help="File containing upstream names") |
799 |
|
|
800 |
# SUBPARSERS |
# SUBPARSERS |
801 |
subparsers = parser.add_subparsers(title='subcommands') |
subparsers = parser.add_subparsers(title='subcommands') |
808 |
subparser = subparsers.add_parser('packages', help='list all GNOME packages') |
subparser = subparsers.add_parser('packages', help='list all GNOME packages') |
809 |
subparser.add_argument("-m", "--m", action="store_true", dest="upstream", |
subparser.add_argument("-m", "--m", action="store_true", dest="upstream", |
810 |
help="Show upstream module") |
help="Show upstream module") |
811 |
|
subparser.add_argument( "--version", action="store_true", dest="show_version", |
812 |
|
help="Show version numbers") |
813 |
|
subparser.add_argument( "--diff", action="store_true", dest="diff", |
814 |
|
help="Only show packages with different version") |
815 |
subparser.set_defaults( |
subparser.set_defaults( |
816 |
func=cmd_ls, upstream=False |
func=cmd_ls, upstream=False, show_version=False, diff=False |
817 |
) |
) |
818 |
|
|
819 |
subparser = subparsers.add_parser('patches', help='list all GNOME patches') |
subparser = subparsers.add_parser('patches', help='list all GNOME patches') |
832 |
subparser = subparsers.add_parser('increase', help='Increase version number') |
subparser = subparsers.add_parser('increase', help='Increase version number') |
833 |
subparser.add_argument("package", help="Package name") |
subparser.add_argument("package", help="Package name") |
834 |
subparser.add_argument("version", help="Version number") |
subparser.add_argument("version", help="Version number") |
835 |
|
subparser.add_argument("-f", "--force", action="store_true", dest="force", |
836 |
|
help="Override warnings, just do it") |
837 |
subparser.add_argument("-u", "--upstream", action="store_true", dest="upstream", |
subparser.add_argument("-u", "--upstream", action="store_true", dest="upstream", |
838 |
help="Package name reflects the upstream name") |
help="Package name reflects the upstream name") |
839 |
subparser.add_argument("-s", "--submit", action="store_true", dest="submit", |
subparser.add_argument("-s", "--submit", action="store_true", dest="submit", |
843 |
subparser.add_argument("--hash", dest="hexdigest", |
subparser.add_argument("--hash", dest="hexdigest", |
844 |
help="Hexdigest of the hash") |
help="Hexdigest of the hash") |
845 |
subparser.set_defaults( |
subparser.set_defaults( |
846 |
func=cmd_package_new_version, submit=False, upstream=False, hexdigest=None, algo="sha256" |
func=cmd_package_new_version, submit=False, upstream=False, hexdigest=None, algo="sha256", |
847 |
|
force=False |
848 |
) |
) |
849 |
|
|
850 |
subparser = subparsers.add_parser('gnome-release-email', help='Submit packages based on GNOME ftp-release-list email') |
subparser = subparsers.add_parser('gnome-release-email', help='Submit packages based on GNOME ftp-release-list email') |
851 |
subparser.add_argument("-m", "--mail", help="Email address to send the progress to") |
subparser.add_argument("-m", "--mail", help="Email address to send the progress to") |
852 |
subparser.add_argument("-w", "--wait", action="store_true", |
subparser.add_argument("-w", "--wait", action="store_true", |
853 |
help="Wait before trying to retrieve the new version") |
help="Wait before trying to retrieve the new version") |
854 |
|
subparser.add_argument("-f", "--force", action="store_true", |
855 |
|
help="Force submission") |
856 |
subparser.set_defaults( |
subparser.set_defaults( |
857 |
func=cmd_parse_ftp_release_list |
func=cmd_parse_ftp_release_list, force=False, wait=False |
858 |
) |
) |
859 |
|
|
860 |
if len(sys.argv) == 1: |
if len(sys.argv) == 1: |
862 |
sys.exit(2) |
sys.exit(2) |
863 |
|
|
864 |
options = parser.parse_args() |
options = parser.parse_args() |
865 |
|
if options.limit_upstream: |
866 |
|
Upstream.limit = set(options.limit_upstream.read().strip("\n").splitlines()) |
867 |
|
|
868 |
try: |
try: |
869 |
options.func(options, parser) |
options.func(options, parser) |
879 |
sys.exit(0) |
sys.exit(0) |
880 |
|
|
881 |
if __name__ == "__main__": |
if __name__ == "__main__": |
882 |
|
os.environ['PYTHONUNBUFFERED'] = '1' |
883 |
main() |
main() |