447 |
p.add_dep3() |
p.add_dep3() |
448 |
|
|
449 |
def cmd_package_new_version(options, parser): |
def cmd_package_new_version(options, parser): |
450 |
|
# Determine the package name |
451 |
if options.upstream: |
if options.upstream: |
452 |
downstream, downstream_files = get_downstream_names() |
downstream, downstream_files = get_downstream_names() |
453 |
|
|
457 |
|
|
458 |
if len(downstream[options.package]) != 1: |
if len(downstream[options.package]) != 1: |
459 |
# XXX - Make it more intelligent |
# XXX - Make it more intelligent |
460 |
print >>sys.stderr, "ERROR: Multiple packages for upstream name: %s" % options.package |
print >>sys.stderr, "ERROR: Multiple packages found for %s: %s" % (options.package, ", ".join(downstream[options.package])) |
461 |
sys.exit(1) |
sys.exit(1) |
462 |
|
|
463 |
package = list(downstream[options.package])[0] |
package = list(downstream[options.package])[0] |
464 |
else: |
else: |
465 |
package = options.package |
package = options.package |
466 |
|
|
467 |
|
# Directories packages are located in |
|
|
|
468 |
root = os.path.expanduser(PKGROOT) |
root = os.path.expanduser(PKGROOT) |
469 |
cwd = os.path.join(root, package) |
cwd = os.path.join(root, package) |
470 |
|
|
471 |
|
# Checkout package to ensure the checkout reflects the latest changes |
472 |
try: |
try: |
473 |
subprocess.check_call(['mgarepo', 'co', package], cwd=root) |
subprocess.check_call(['mgarepo', 'co', package], cwd=root) |
474 |
except subprocess.CalledProcessError: |
except subprocess.CalledProcessError: |
475 |
sys.exit(1) |
sys.exit(1) |
476 |
|
|
477 |
|
# SpecFile class handles the actual version+release change |
478 |
s = SpecFile(os.path.join(cwd, "SPECS", "%s.spec" % package)) |
s = SpecFile(os.path.join(cwd, "SPECS", "%s.spec" % package)) |
479 |
print "%s => %s" % (s.version, options.version) |
print "%s => %s" % (s.version, options.version) |
480 |
if not s.update(options.version): |
if not s.update(options.version): |
481 |
sys.exit(1) |
sys.exit(1) |
482 |
|
|
483 |
|
# We can even checkin and submit :-) |
484 |
if options.submit: |
if options.submit: |
485 |
try: |
try: |
486 |
# checkin changes |
# checkin changes |
487 |
subprocess.check_call(['mgarepo', 'ci', '-m', 'new version'], cwd=cwd) |
subprocess.check_call(['mgarepo', 'ci', '-m', 'new version %s' % options.version], cwd=cwd) |
488 |
# and submit |
# and submit |
489 |
subprocess.check_call(['mgarepo', 'submit'], cwd=cwd) |
subprocess.check_call(['mgarepo', 'submit'], cwd=cwd) |
490 |
except subprocess.CalledProcessError: |
except subprocess.CalledProcessError: |