summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlav Vitters <olav@vitters.nl>2019-10-30 20:09:11 +0100
committerOlav Vitters <olav@vitters.nl>2019-10-30 20:09:11 +0100
commitd030c0d3de9e1788c2eef1a8305bf24ef597f8c3 (patch)
tree5c7c03003352d2d8617514f378e99625f7244d14
parent6be02e25f7297d54880f55b6594dd201ebcbf95e (diff)
downloadmgagnome-d030c0d3de9e1788c2eef1a8305bf24ef597f8c3.tar
mgagnome-d030c0d3de9e1788c2eef1a8305bf24ef597f8c3.tar.gz
mgagnome-d030c0d3de9e1788c2eef1a8305bf24ef597f8c3.tar.bz2
mgagnome-d030c0d3de9e1788c2eef1a8305bf24ef597f8c3.tar.xz
mgagnome-d030c0d3de9e1788c2eef1a8305bf24ef597f8c3.zip
allow multiple arguments for rebuild subcommand
-rwxr-xr-xmgagnome105
1 files changed, 60 insertions, 45 deletions
diff --git a/mgagnome b/mgagnome
index f7ad9a6..63ea8e5 100755
--- a/mgagnome
+++ b/mgagnome
@@ -1046,6 +1046,7 @@ class Downstream(object):
MEDIA="Core Release Source"
PKGROOT='~/pkgs'
DISTRO=None
+ SECTION=None
def __init__(self):
contents = subprocess.check_output(['urpmf', '--qf', '%name|%version|%files', '.', "--media", self.MEDIA], close_fds=True).decode("utf-8").strip("\n").splitlines()
@@ -1525,58 +1526,70 @@ def cmd_clean_spec(options, parser):
# cmd_clean_spec_multi((options, package))
def cmd_new_release(options, parser):
- # Determine the package name
- if options.upstream:
- try:
- package = Downstream().get_downstream_from_upstream(options.package, options.version)[0]
- except ValueError as e:
- print("ERROR: %s" % e, file=sys.stderr)
- sys.exit(1)
- else:
- package = options.package
+ success = True
+ for pkg in options.package:
+ # Determine the package name
+ if options.upstream:
+ try:
+ package = Downstream().get_downstream_from_upstream(pkgs, options.version)[0]
+ except ValueError as e:
+ print("ERROR: %s" % e, file=sys.stderr)
+ success = False
+ continue
+ else:
+ package = pkg
- # Directories packages are located in
- root = os.path.expanduser(Downstream.PKGROOT)
- cwd = os.path.join(root, package)
+ # Directories packages are located in
+ root = os.path.expanduser(Downstream.PKGROOT)
+ cwd = os.path.join(root, package)
- # Checkout package to ensure the checkout reflects the latest changes
- try:
- Downstream.co(package, cwd=root)
- except subprocess.CalledProcessError:
- subprocess.call(['svn', 'revert', '-R', cwd], cwd=cwd)
- sys.exit(1)
+ # Checkout package to ensure the checkout reflects the latest changes
+ try:
+ Downstream.co(package, cwd=root)
+ except subprocess.CalledProcessError:
+ subprocess.call(['svn', 'revert', '-R', cwd], cwd=cwd)
+ success = False
+ continue
- # SpecFile class handles the actual version+release change
- # XXX - module should reflect upstream name, this gives it the package name
- s = SpecFile(os.path.join(cwd, "SPECS", "%s.spec" % package), module=package)
- cur_release = s.release
- new_release = int(cur_release)+1
- cur_version = s.version
- print("%s-%s => %s-%s" % (version, cur_release, version, new_release))
+ # SpecFile class handles the actual version+release change
+ # XXX - module should reflect upstream name, this gives it the package name
+ s = SpecFile(os.path.join(cwd, "SPECS", "%s.spec" % package), module=package)
+ cur_release = s.release
+ new_release = int(cur_release)+1
+ cur_version = s.version
+ print("%s-%s => %s-%s" % (cur_version, cur_release, cur_version, new_release))
- # XXX - Duplicate check as should not revert changes if specfile has already been changed
- if not s.ensure_no_local_changes(options.force):
- sys.exit(1)
+ # XXX - Duplicate check as should not revert changes if specfile has already been changed
+ if not s.ensure_no_local_changes(options.force):
+ success = False
+ continue
- if not s.update_release(new_release, options.reason, force=options.force):
- subprocess.call(['svn', 'revert', '-R', cwd], cwd=cwd, stdout=subprocess.DEVNULL)
- sys.exit(1)
+ if not s.update_release(new_release, options.reason, force=options.force):
+ subprocess.call(['svn', 'revert', '-R', cwd], cwd=cwd, stdout=subprocess.DEVNULL)
+ success = False
+ continue
- try:
- # If we made it this far, checkin the changes
- Downstream.ci(package, s.changes, cwd=cwd)
+ try:
+ # If we made it this far, checkin the changes
+ Downstream.ci(package, s.changes, cwd=cwd)
- # Submit is optional
- if options.submit:
- cmd = ['mgarepo', 'submit']
- if Downstream.DISTRO:
- cmd.extend(('--define', 'section=core/updates_testing', '-t', Downstream.DISTRO))
+ # Submit is optional
+ if options.submit:
+ cmd = ['mgarepo', 'submit']
+ if Downstream.DISTRO:
+ cmd.extend(('--define', 'section=core/updates_testing', '-t', Downstream.DISTRO))
+ elif Downstream.SECTION:
+ cmd.extend(('--define', 'section={0}'.format(Downstream.SECTION)))
+
+ # retry submission various times, could be that some dependencies are being built at the same time
+ @retry(subprocess.CalledProcessError, tries=10, delay=300, backoff=1.5)
+ def _submit(): subprocess.check_call(cmd, cwd=cwd)
+ _submit()
+ except subprocess.CalledProcessError:
+ success = False
+ continue
- # retry submission various times, could be that some dependencies are being built at the same time
- @retry(subprocess.CalledProcessError, tries=10, delay=300, backoff=1.5)
- def _submit(): subprocess.check_call(cmd, cwd=cwd)
- _submit()
- except subprocess.CalledProcessError:
+ if not success:
sys.exit(1)
def cmd_package_new_version(options, parser):
@@ -1647,6 +1660,8 @@ def cmd_package_new_version(options, parser):
cmd = ['mgarepo', 'submit']
if Downstream.DISTRO:
cmd.extend(('--define', 'section=core/updates_testing', '-t', Downstream.DISTRO))
+ elif Downstream.SECTION:
+ cmd.extend(('--define', 'section={0}'.format(Downstream.SECTION)))
# retry submission various times, could be that some dependencies are being built at the same time
@retry(subprocess.CalledProcessError, tries=10, delay=300, backoff=1.5)
@@ -1826,7 +1841,7 @@ def main():
)
subparser = subparsers.add_parser('rebuild', help='increase release')
- subparser.add_argument("package", help="Package name")
+ subparser.add_argument("package", help="Package name", nargs="*")
subparser.add_argument("-m", "--reason", dest="reason", required=True, help="Reason for the rebuild")
subparser.add_argument("-f", "--force", action="store_true", dest="force",
help="Override warnings, just do it")