mirror of
https://github.com/rpm-software-management/tito.git
synced 2025-02-23 12:12:47 +00:00
Merge pull request #74 from sosiouxme/release-test
Enable tito release --test for git releasers
This commit is contained in:
commit
e8ca22b1e8
4 changed files with 41 additions and 22 deletions
|
@ -422,6 +422,7 @@ class Builder(ConfigObject):
|
|||
self.tgz_filename,
|
||||
)
|
||||
run_command(cmd)
|
||||
self.build_version += ".git." + str(self.commit_count) + "." + str(self.git_commit_id[:7])
|
||||
self.ran_setup_test_specfile = True
|
||||
|
||||
def _get_rpmbuild_dir_options(self):
|
||||
|
|
|
@ -458,9 +458,12 @@ class ReleaseModule(BaseCliModule):
|
|||
self.parser.add_option("--all", action="store_true",
|
||||
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")
|
||||
|
||||
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",
|
||||
help="Run all release targets starting with the given string.")
|
||||
|
||||
|
@ -626,7 +629,9 @@ class ReleaseModule(BaseCliModule):
|
|||
user_config=self.user_config,
|
||||
target=target,
|
||||
releaser_config=releaser_config,
|
||||
no_cleanup=self.options.no_cleanup)
|
||||
no_cleanup=self.options.no_cleanup,
|
||||
test=self.options.test,
|
||||
auto_accept=self.options.auto_accept)
|
||||
releaser.release(dry_run=self.options.dry_run,
|
||||
no_build=self.options.no_build,
|
||||
scratch=self.options.scratch)
|
||||
|
|
|
@ -51,9 +51,11 @@ class Releaser(object):
|
|||
|
||||
def __init__(self, name=None, version=None, tag=None, build_dir=None,
|
||||
pkg_config=None, global_config=None, user_config=None,
|
||||
target=None, releaser_config=None, no_cleanup=False):
|
||||
target=None, releaser_config=None, no_cleanup=False, test=False, auto_accept=False):
|
||||
|
||||
self.builder_args = self._parse_builder_args(releaser_config, target)
|
||||
if test:
|
||||
self.builder_args['test'] = True # builder must know to build from HEAD
|
||||
|
||||
# While we create a builder here, we don't actually call run on it
|
||||
# unless the releaser needs to:
|
||||
|
@ -81,11 +83,19 @@ class Releaser(object):
|
|||
self.target = target
|
||||
|
||||
self.dry_run = False
|
||||
|
||||
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._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):
|
||||
"""
|
||||
Verify this release target has all the config options it needs.
|
||||
|
@ -262,10 +272,10 @@ class RsyncReleaser(Releaser):
|
|||
|
||||
def __init__(self, name=None, version=None, tag=None, build_dir=None,
|
||||
pkg_config=None, global_config=None, user_config=None,
|
||||
target=None, releaser_config=None, no_cleanup=False,
|
||||
target=None, releaser_config=None, no_cleanup=False, test=False, auto_accept=False,
|
||||
prefix="temp_dir="):
|
||||
Releaser.__init__(self, name, version, tag, build_dir, pkg_config,
|
||||
global_config, user_config, target, releaser_config, no_cleanup)
|
||||
global_config, user_config, target, releaser_config, no_cleanup, test, auto_accept)
|
||||
|
||||
self.build_dir = build_dir
|
||||
self.prefix = prefix
|
||||
|
@ -377,9 +387,9 @@ class YumRepoReleaser(RsyncReleaser):
|
|||
|
||||
def __init__(self, name=None, version=None, tag=None, build_dir=None,
|
||||
pkg_config=None, global_config=None, user_config=None,
|
||||
target=None, releaser_config=None, no_cleanup=False):
|
||||
target=None, releaser_config=None, no_cleanup=False, test=False, auto_accept=False):
|
||||
RsyncReleaser.__init__(self, name, version, tag, build_dir, pkg_config,
|
||||
global_config, user_config, target, releaser_config, no_cleanup,
|
||||
global_config, user_config, target, releaser_config, no_cleanup, test, auto_accept,
|
||||
prefix="yumrepo-")
|
||||
|
||||
def _read_rpm_header(self, ts, new_rpm_path):
|
||||
|
@ -445,9 +455,9 @@ class FedoraGitReleaser(Releaser):
|
|||
|
||||
def __init__(self, name=None, version=None, tag=None, build_dir=None,
|
||||
pkg_config=None, global_config=None, user_config=None,
|
||||
target=None, releaser_config=None, no_cleanup=False):
|
||||
target=None, releaser_config=None, no_cleanup=False, test=False, auto_accept=False):
|
||||
Releaser.__init__(self, name, version, tag, build_dir, pkg_config,
|
||||
global_config, user_config, target, releaser_config, no_cleanup)
|
||||
global_config, user_config, target, releaser_config, no_cleanup, test, auto_accept)
|
||||
|
||||
self.git_branches = \
|
||||
self.releaser_config.get(self.target, "branches").split(" ")
|
||||
|
@ -480,6 +490,8 @@ class FedoraGitReleaser(Releaser):
|
|||
run_command("%s switch-branch %s" % (self.cli_tool, self.git_branches[0]))
|
||||
|
||||
self.builder.tgz()
|
||||
if self.test:
|
||||
self.builder._setup_test_specfile()
|
||||
|
||||
self._git_sync_files(project_checkout)
|
||||
self._git_upload_sources(project_checkout)
|
||||
|
@ -512,8 +524,7 @@ class FedoraGitReleaser(Releaser):
|
|||
print("")
|
||||
print("###############################")
|
||||
print("")
|
||||
answer = raw_input("Would you like to edit this commit message? [y/n] ")
|
||||
if answer.lower() in ['y', 'yes', 'ok', 'sure']:
|
||||
if self._ask_yes_no("Would you like to edit this commit message? [y/n] ", False):
|
||||
debug("Opening editor for user to edit commit message in: %s" % name)
|
||||
editor = 'vi'
|
||||
if "EDITOR" in os.environ:
|
||||
|
@ -547,8 +558,7 @@ class FedoraGitReleaser(Releaser):
|
|||
print(diff_output)
|
||||
print("")
|
||||
print("##### Please review the above diff #####")
|
||||
answer = raw_input("Do you wish to proceed with commit? [y/n] ")
|
||||
if answer.lower() not in ['y', 'yes', 'ok', 'sure']:
|
||||
if not self._ask_yes_no("Do you wish to proceed with commit? [y/n] "):
|
||||
print("Fine, you're on your own!")
|
||||
self.cleanup()
|
||||
sys.exit(1)
|
||||
|
@ -711,9 +721,9 @@ class CvsReleaser(Releaser):
|
|||
|
||||
def __init__(self, name=None, version=None, tag=None, build_dir=None,
|
||||
pkg_config=None, global_config=None, user_config=None,
|
||||
target=None, releaser_config=None, no_cleanup=False):
|
||||
target=None, releaser_config=None, no_cleanup=False, test=False, auto_accept=False):
|
||||
Releaser.__init__(self, name, version, tag, build_dir, pkg_config,
|
||||
global_config, user_config, target, releaser_config, no_cleanup)
|
||||
global_config, user_config, target, releaser_config, no_cleanup, test, auto_accept)
|
||||
|
||||
self.package_workdir = os.path.join(self.working_dir,
|
||||
self.project_name)
|
||||
|
@ -861,8 +871,7 @@ class CvsReleaser(Releaser):
|
|||
|
||||
print("")
|
||||
print("##### Please review the above diff #####")
|
||||
answer = raw_input("Do you wish to proceed with commit? [y/n] ")
|
||||
if answer.lower() not in ['y', 'yes', 'ok', 'sure']:
|
||||
if not self._ask_yes_no("Do you wish to proceed with commit? [y/n] "):
|
||||
print("Fine, you're on your own!")
|
||||
self.cleanup()
|
||||
sys.exit(1)
|
||||
|
@ -892,8 +901,7 @@ class CvsReleaser(Releaser):
|
|||
print("")
|
||||
print("###############################")
|
||||
print("")
|
||||
answer = raw_input("Would you like to edit this commit message? [y/n] ")
|
||||
if answer.lower() in ['y', 'yes', 'ok', 'sure']:
|
||||
if self._ask_yes_no("Would you like to edit this commit message? [y/n] ", False):
|
||||
debug("Opening editor for user to edit commit message in: %s" % name)
|
||||
editor = 'vi'
|
||||
if "EDITOR" in os.environ:
|
||||
|
@ -957,9 +965,9 @@ class KojiReleaser(Releaser):
|
|||
|
||||
def __init__(self, name=None, version=None, tag=None, build_dir=None,
|
||||
pkg_config=None, global_config=None, user_config=None,
|
||||
target=None, releaser_config=None, no_cleanup=False):
|
||||
target=None, releaser_config=None, no_cleanup=False, test=False, auto_accept=False):
|
||||
Releaser.__init__(self, name, version, tag, build_dir, pkg_config,
|
||||
global_config, user_config, target, releaser_config, no_cleanup)
|
||||
global_config, user_config, target, releaser_config, no_cleanup, test, auto_accept)
|
||||
|
||||
self.only_tags = []
|
||||
if 'ONLY_TAGS' in os.environ:
|
||||
|
|
|
@ -17,6 +17,8 @@ tito build --test --rpm
|
|||
|
||||
tito build [OPTIONS]
|
||||
|
||||
tito release [OPTIONS] TARGET
|
||||
|
||||
tito report
|
||||
|
||||
|
||||
|
@ -213,6 +215,9 @@ if you have defined release targets yum-f15 and yum-f14 in releasers.conf,
|
|||
Perform a scratch build in Koji.
|
||||
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`
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue