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 |
# Get the files |
limit = None |
|
usock = urlopen.open(URL) |
|
|
parser = urllister() |
|
|
parser.feed(usock.read()) |
|
|
usock.close() |
|
|
parser.close() |
|
|
files = parser.urls |
|
491 |
|
|
492 |
tarballs = set([filename.replace('/', '') for filename in files if good_dir.search(filename)]) |
def __init__(self): |
493 |
|
urlopen = urllib2.build_opener() |
494 |
|
|
495 |
return tarballs |
good_dir = re.compile('^[-A-Za-z0-9_+.]+/$') |
496 |
|
|
497 |
|
# 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 |
|
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 |
def get_downstream_names(): |
def get_downstream_names(): |
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]*)$') |
598 |
def join_streams(show_version=False, only_diff_version=False): |
def join_streams(show_version=False, only_diff_version=False): |
599 |
root = os.path.expanduser(PKGROOT) |
root = os.path.expanduser(PKGROOT) |
600 |
|
|
601 |
upstream = get_upstream_names() |
upstream = Upstream().names |
602 |
downstream, downstream_files = get_downstream_names() |
downstream, downstream_files = get_downstream_names() |
603 |
|
|
604 |
matches = upstream & set(downstream.keys()) |
matches = upstream & set(downstream.keys()) |
622 |
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)): |
623 |
sys.stdout.write(package) |
sys.stdout.write(package) |
624 |
if options.upstream: sys.stdout.write("\t%s" % module) |
if options.upstream: sys.stdout.write("\t%s" % module) |
625 |
if options.show_version: sys.stdout.write("\t%s\t%s".join((spec_version, package_version))) |
if options.show_version: sys.stdout.write("\t%s\t%s" % (spec_version, package_version)) |
626 |
print |
print |
627 |
|
|
628 |
def cmd_patches(options, parser): |
def cmd_patches(options, parser): |
790 |
description = """Mageia GNOME commands.""" |
description = """Mageia GNOME commands.""" |
791 |
epilog="""Report bugs to Olav Vitters""" |
epilog="""Report bugs to Olav Vitters""" |
792 |
parser = argparse.ArgumentParser(description=description,epilog=epilog) |
parser = argparse.ArgumentParser(description=description,epilog=epilog) |
793 |
|
parser.add_argument("-l", "--limit", type=argparse.FileType('r', 0), |
794 |
|
dest="limit_upstream", metavar="FILE", |
795 |
|
help="File containing upstream names") |
796 |
|
|
797 |
# SUBPARSERS |
# SUBPARSERS |
798 |
subparsers = parser.add_subparsers(title='subcommands') |
subparsers = parser.add_subparsers(title='subcommands') |
859 |
sys.exit(2) |
sys.exit(2) |
860 |
|
|
861 |
options = parser.parse_args() |
options = parser.parse_args() |
862 |
|
if options.limit_upstream: |
863 |
|
Upstream.limit = set(options.limit_upstream.read().strip("\n").splitlines()) |
864 |
|
|
865 |
try: |
try: |
866 |
options.func(options, parser) |
options.func(options, parser) |