mirror of
https://github.com/rpm-software-management/tito.git
synced 2025-02-23 12:12:47 +00:00
add --yes on tito release to keep from requiring input
This commit is contained in:
parent
df27d8bb11
commit
c8e9b941ab
3 changed files with 34 additions and 21 deletions
|
@ -454,9 +454,12 @@ class ReleaseModule(BaseCliModule):
|
||||||
self.parser.add_option("--all", action="store_true",
|
self.parser.add_option("--all", action="store_true",
|
||||||
help="Run all release targets configured.")
|
help="Run all release targets configured.")
|
||||||
|
|
||||||
self.parser.add_option("--test", dest="test", action="store_true",
|
self.parser.add_option("--test", action="store_true",
|
||||||
help="use current branch HEAD instead of latest package tag")
|
help="use current branch HEAD instead of latest package tag")
|
||||||
|
|
||||||
|
self.parser.add_option("-y", "--yes", dest="auto_accept", action="store_true",
|
||||||
|
help="Do not require input, just accept commits and builds")
|
||||||
|
|
||||||
self.parser.add_option("--all-starting-with", dest="all_starting_with",
|
self.parser.add_option("--all-starting-with", dest="all_starting_with",
|
||||||
help="Run all release targets starting with the given string.")
|
help="Run all release targets starting with the given string.")
|
||||||
|
|
||||||
|
@ -623,7 +626,8 @@ class ReleaseModule(BaseCliModule):
|
||||||
target=target,
|
target=target,
|
||||||
releaser_config=releaser_config,
|
releaser_config=releaser_config,
|
||||||
no_cleanup=self.options.no_cleanup,
|
no_cleanup=self.options.no_cleanup,
|
||||||
test=self.options.test)
|
test=self.options.test,
|
||||||
|
auto_accept=self.options.auto_accept)
|
||||||
releaser.release(dry_run=self.options.dry_run,
|
releaser.release(dry_run=self.options.dry_run,
|
||||||
no_build=self.options.no_build,
|
no_build=self.options.no_build,
|
||||||
scratch=self.options.scratch)
|
scratch=self.options.scratch)
|
||||||
|
|
|
@ -50,7 +50,7 @@ class Releaser(object):
|
||||||
|
|
||||||
def __init__(self, name=None, version=None, tag=None, build_dir=None,
|
def __init__(self, name=None, version=None, tag=None, build_dir=None,
|
||||||
pkg_config=None, global_config=None, user_config=None,
|
pkg_config=None, global_config=None, user_config=None,
|
||||||
target=None, releaser_config=None, no_cleanup=False, test=False):
|
target=None, releaser_config=None, no_cleanup=False, test=False, auto_accept=False):
|
||||||
|
|
||||||
self.builder_args = self._parse_builder_args(releaser_config, target)
|
self.builder_args = self._parse_builder_args(releaser_config, target)
|
||||||
if test:
|
if test:
|
||||||
|
@ -83,10 +83,18 @@ class Releaser(object):
|
||||||
|
|
||||||
self.dry_run = False
|
self.dry_run = False
|
||||||
self.test = test # releaser must know to use builder designation rather than tag
|
self.test = test # releaser must know to use builder designation rather than tag
|
||||||
|
self.auto_accept = auto_accept # don't ask for input, just go ahead
|
||||||
self.no_cleanup = no_cleanup
|
self.no_cleanup = no_cleanup
|
||||||
|
|
||||||
self._check_releaser_config()
|
self._check_releaser_config()
|
||||||
|
|
||||||
|
def _ask_yes_no(self, prompt="Y/N? ", default_auto_answer=True):
|
||||||
|
if self.auto_accept:
|
||||||
|
return default_auto_answer
|
||||||
|
else:
|
||||||
|
answer = raw_input(prompt)
|
||||||
|
return answer.lower() in ['y', 'yes', 'ok', 'sure']
|
||||||
|
|
||||||
def _check_releaser_config(self):
|
def _check_releaser_config(self):
|
||||||
"""
|
"""
|
||||||
Verify this release target has all the config options it needs.
|
Verify this release target has all the config options it needs.
|
||||||
|
@ -263,10 +271,10 @@ class RsyncReleaser(Releaser):
|
||||||
|
|
||||||
def __init__(self, name=None, version=None, tag=None, build_dir=None,
|
def __init__(self, name=None, version=None, tag=None, build_dir=None,
|
||||||
pkg_config=None, global_config=None, user_config=None,
|
pkg_config=None, global_config=None, user_config=None,
|
||||||
target=None, releaser_config=None, no_cleanup=False, test=False,
|
target=None, releaser_config=None, no_cleanup=False, test=False, auto_accept=False,
|
||||||
prefix="temp_dir="):
|
prefix="temp_dir="):
|
||||||
Releaser.__init__(self, name, version, tag, build_dir, pkg_config,
|
Releaser.__init__(self, name, version, tag, build_dir, pkg_config,
|
||||||
global_config, user_config, target, releaser_config, no_cleanup, test)
|
global_config, user_config, target, releaser_config, no_cleanup, test, auto_accept)
|
||||||
|
|
||||||
self.build_dir = build_dir
|
self.build_dir = build_dir
|
||||||
self.prefix = prefix
|
self.prefix = prefix
|
||||||
|
@ -376,9 +384,9 @@ class YumRepoReleaser(RsyncReleaser):
|
||||||
|
|
||||||
def __init__(self, name=None, version=None, tag=None, build_dir=None,
|
def __init__(self, name=None, version=None, tag=None, build_dir=None,
|
||||||
pkg_config=None, global_config=None, user_config=None,
|
pkg_config=None, global_config=None, user_config=None,
|
||||||
target=None, releaser_config=None, no_cleanup=False, test=False):
|
target=None, releaser_config=None, no_cleanup=False, test=False, auto_accept=False):
|
||||||
RsyncReleaser.__init__(self, name, version, tag, build_dir, pkg_config,
|
RsyncReleaser.__init__(self, name, version, tag, build_dir, pkg_config,
|
||||||
global_config, user_config, target, releaser_config, no_cleanup, test,
|
global_config, user_config, target, releaser_config, no_cleanup, test, auto_accept,
|
||||||
prefix="yumrepo-")
|
prefix="yumrepo-")
|
||||||
|
|
||||||
def _read_rpm_header(self, ts, new_rpm_path):
|
def _read_rpm_header(self, ts, new_rpm_path):
|
||||||
|
@ -444,9 +452,9 @@ class FedoraGitReleaser(Releaser):
|
||||||
|
|
||||||
def __init__(self, name=None, version=None, tag=None, build_dir=None,
|
def __init__(self, name=None, version=None, tag=None, build_dir=None,
|
||||||
pkg_config=None, global_config=None, user_config=None,
|
pkg_config=None, global_config=None, user_config=None,
|
||||||
target=None, releaser_config=None, no_cleanup=False, test=False):
|
target=None, releaser_config=None, no_cleanup=False, test=False, auto_accept=False):
|
||||||
Releaser.__init__(self, name, version, tag, build_dir, pkg_config,
|
Releaser.__init__(self, name, version, tag, build_dir, pkg_config,
|
||||||
global_config, user_config, target, releaser_config, no_cleanup, test)
|
global_config, user_config, target, releaser_config, no_cleanup, test, auto_accept)
|
||||||
|
|
||||||
self.git_branches = \
|
self.git_branches = \
|
||||||
self.releaser_config.get(self.target, "branches").split(" ")
|
self.releaser_config.get(self.target, "branches").split(" ")
|
||||||
|
@ -513,8 +521,7 @@ class FedoraGitReleaser(Releaser):
|
||||||
print("")
|
print("")
|
||||||
print("###############################")
|
print("###############################")
|
||||||
print("")
|
print("")
|
||||||
answer = raw_input("Would you like to edit this commit message? [y/n] ")
|
if self._ask_yes_no("Would you like to edit this commit message? [y/n] ", False):
|
||||||
if answer.lower() in ['y', 'yes', 'ok', 'sure']:
|
|
||||||
debug("Opening editor for user to edit commit message in: %s" % name)
|
debug("Opening editor for user to edit commit message in: %s" % name)
|
||||||
editor = 'vi'
|
editor = 'vi'
|
||||||
if "EDITOR" in os.environ:
|
if "EDITOR" in os.environ:
|
||||||
|
@ -548,8 +555,7 @@ class FedoraGitReleaser(Releaser):
|
||||||
print(diff_output)
|
print(diff_output)
|
||||||
print("")
|
print("")
|
||||||
print("##### Please review the above diff #####")
|
print("##### Please review the above diff #####")
|
||||||
answer = raw_input("Do you wish to proceed with commit? [y/n] ")
|
if not self._ask_yes_no("Do you wish to proceed with commit? [y/n] "):
|
||||||
if answer.lower() not in ['y', 'yes', 'ok', 'sure']:
|
|
||||||
print("Fine, you're on your own!")
|
print("Fine, you're on your own!")
|
||||||
self.cleanup()
|
self.cleanup()
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
@ -712,9 +718,9 @@ class CvsReleaser(Releaser):
|
||||||
|
|
||||||
def __init__(self, name=None, version=None, tag=None, build_dir=None,
|
def __init__(self, name=None, version=None, tag=None, build_dir=None,
|
||||||
pkg_config=None, global_config=None, user_config=None,
|
pkg_config=None, global_config=None, user_config=None,
|
||||||
target=None, releaser_config=None, no_cleanup=False, test=False):
|
target=None, releaser_config=None, no_cleanup=False, test=False, auto_accept=False):
|
||||||
Releaser.__init__(self, name, version, tag, build_dir, pkg_config,
|
Releaser.__init__(self, name, version, tag, build_dir, pkg_config,
|
||||||
global_config, user_config, target, releaser_config, no_cleanup, test)
|
global_config, user_config, target, releaser_config, no_cleanup, test, auto_accept)
|
||||||
|
|
||||||
self.package_workdir = os.path.join(self.working_dir,
|
self.package_workdir = os.path.join(self.working_dir,
|
||||||
self.project_name)
|
self.project_name)
|
||||||
|
@ -862,8 +868,7 @@ class CvsReleaser(Releaser):
|
||||||
|
|
||||||
print("")
|
print("")
|
||||||
print("##### Please review the above diff #####")
|
print("##### Please review the above diff #####")
|
||||||
answer = raw_input("Do you wish to proceed with commit? [y/n] ")
|
if not self._ask_yes_no("Do you wish to proceed with commit? [y/n] "):
|
||||||
if answer.lower() not in ['y', 'yes', 'ok', 'sure']:
|
|
||||||
print("Fine, you're on your own!")
|
print("Fine, you're on your own!")
|
||||||
self.cleanup()
|
self.cleanup()
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
@ -893,8 +898,7 @@ class CvsReleaser(Releaser):
|
||||||
print("")
|
print("")
|
||||||
print("###############################")
|
print("###############################")
|
||||||
print("")
|
print("")
|
||||||
answer = raw_input("Would you like to edit this commit message? [y/n] ")
|
if self._ask_yes_no("Would you like to edit this commit message? [y/n] ", False):
|
||||||
if answer.lower() in ['y', 'yes', 'ok', 'sure']:
|
|
||||||
debug("Opening editor for user to edit commit message in: %s" % name)
|
debug("Opening editor for user to edit commit message in: %s" % name)
|
||||||
editor = 'vi'
|
editor = 'vi'
|
||||||
if "EDITOR" in os.environ:
|
if "EDITOR" in os.environ:
|
||||||
|
@ -958,9 +962,9 @@ class KojiReleaser(Releaser):
|
||||||
|
|
||||||
def __init__(self, name=None, version=None, tag=None, build_dir=None,
|
def __init__(self, name=None, version=None, tag=None, build_dir=None,
|
||||||
pkg_config=None, global_config=None, user_config=None,
|
pkg_config=None, global_config=None, user_config=None,
|
||||||
target=None, releaser_config=None, no_cleanup=False, test=False):
|
target=None, releaser_config=None, no_cleanup=False, test=False, auto_accept=False):
|
||||||
Releaser.__init__(self, name, version, tag, build_dir, pkg_config,
|
Releaser.__init__(self, name, version, tag, build_dir, pkg_config,
|
||||||
global_config, user_config, target, releaser_config, no_cleanup, test)
|
global_config, user_config, target, releaser_config, no_cleanup, test, auto_accept)
|
||||||
|
|
||||||
self.only_tags = []
|
self.only_tags = []
|
||||||
if 'ONLY_TAGS' in os.environ:
|
if 'ONLY_TAGS' in os.environ:
|
||||||
|
|
|
@ -17,6 +17,8 @@ tito build --test --rpm
|
||||||
|
|
||||||
tito build [OPTIONS]
|
tito build [OPTIONS]
|
||||||
|
|
||||||
|
tito release [OPTIONS] TARGET
|
||||||
|
|
||||||
tito report
|
tito report
|
||||||
|
|
||||||
|
|
||||||
|
@ -211,6 +213,9 @@ if you have defined release targets yum-f15 and yum-f14 in releasers.conf,
|
||||||
Perform a scratch build in Koji.
|
Perform a scratch build in Koji.
|
||||||
Can be specified using environment variable SCRATCH set to 1 as well.
|
Can be specified using environment variable SCRATCH set to 1 as well.
|
||||||
|
|
||||||
|
--yes::
|
||||||
|
Do not ask to confirm release commits or edit their messages.
|
||||||
|
|
||||||
`tito report`
|
`tito report`
|
||||||
~~~~~~~~~~~~~
|
~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue