472 |
def get_downstream_names(): |
def get_downstream_names(): |
473 |
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]*)$') |
474 |
|
|
475 |
contents = subprocess.check_output(['urpmf', '--files', '.', "--media", MEDIA], close_fds=True).strip("\n").splitlines() |
contents = subprocess.check_output(['urpmf', '--qf', '%name|%version|%files', '.', "--media", MEDIA], close_fds=True).strip("\n").splitlines() |
476 |
|
|
477 |
FILES = {} |
FILES = {} |
478 |
TARBALLS = {} |
TARBALLS = {} |
479 |
|
|
480 |
for line in contents: |
for line in contents: |
481 |
try: |
try: |
482 |
srpm, filename = line.split(":") |
srpm, version, filename = line.split("|") |
483 |
except ValueError: |
except ValueError: |
484 |
print >>sys.stderr, line |
print >>sys.stderr, line |
485 |
continue |
continue |
491 |
module = fileinfo['module'] |
module = fileinfo['module'] |
492 |
|
|
493 |
if module not in TARBALLS: |
if module not in TARBALLS: |
494 |
TARBALLS[module] = set() |
TARBALLS[module] = {} |
495 |
TARBALLS[module].add(srpm) |
TARBALLS[module][srpm] = version |
496 |
|
|
497 |
if srpm not in FILES: |
if srpm not in FILES: |
498 |
FILES[srpm] = set() |
FILES[srpm] = set() |
509 |
|
|
510 |
if len(downstream[upstream]) != 1: |
if len(downstream[upstream]) != 1: |
511 |
# XXX - Make it more intelligent |
# XXX - Make it more intelligent |
512 |
raise ValueError("Multiple packages found for %s: %s" % (upstream, ", ".join(downstream[upstream]))) |
raise ValueError("Multiple packages found for %s: %s" % (upstream, ", ".join(downstream[upstream].keys()))) |
513 |
|
|
514 |
return list(downstream[upstream]) |
return downstream[upstream].keys() |
515 |
|
|
516 |
def write_file(path, data): |
def write_file(path, data): |
517 |
with tempfile.NamedTemporaryFile(dir=os.path.dirname(path), delete=False) as fdst: |
with tempfile.NamedTemporaryFile(dir=os.path.dirname(path), delete=False) as fdst: |
527 |
|
|
528 |
matches = upstream & set(downstream.keys()) |
matches = upstream & set(downstream.keys()) |
529 |
for module in matches: |
for module in matches: |
530 |
print module, "\t".join(downstream[module]) |
print module, "\t".join(downstream[module].keys()) |
531 |
for package in downstream[module]: |
for package in downstream[module].keys(): |
532 |
subprocess.call(['mgarepo', 'co', package], cwd=cwd) |
subprocess.call(['mgarepo', 'co', package], cwd=cwd) |
533 |
|
|
534 |
def join_streams(): |
def join_streams(): |
537 |
|
|
538 |
matches = upstream & set(downstream.keys()) |
matches = upstream & set(downstream.keys()) |
539 |
for module in matches: |
for module in matches: |
540 |
for package in downstream[module]: |
for package in downstream[module].keys(): |
541 |
yield (package, module) |
yield (package, module) |
542 |
|
|
543 |
def cmd_ls(options, parser): |
def cmd_ls(options, parser): |
554 |
|
|
555 |
matches = upstream & set(downstream.keys()) |
matches = upstream & set(downstream.keys()) |
556 |
for module in sorted(matches): |
for module in sorted(matches): |
557 |
for srpm in downstream[module]: |
for srpm in downstream[module].keys(): |
558 |
for filename in downstream_files[srpm]: |
for filename in downstream_files[srpm]: |
559 |
if '.patch' in filename or '.diff' in filename: |
if '.patch' in filename or '.diff' in filename: |
560 |
|
|