mirror of
https://git.centos.org/centos/centpkg.git
synced 2025-02-23 16:22:55 +00:00
Add current-state option
Signed-off-by: Troy Dawson <tdawson@redhat.com>
This commit is contained in:
parent
874d108037
commit
aededb449c
1 changed files with 56 additions and 0 deletions
|
@ -50,6 +50,7 @@ class centpkgClient(cliClient):
|
|||
def setup_centos_subparsers(self):
|
||||
self.register_do_fork()
|
||||
self.register_request_gated_side_tag()
|
||||
self.register_current_state()
|
||||
|
||||
def register_do_fork(self):
|
||||
help_msg = 'Create a new fork of the current repository'
|
||||
|
@ -132,6 +133,61 @@ class centpkgClient(cliClient):
|
|||
msg = "Remote with name '{0}' already exists."
|
||||
self.log.info(msg.format(remote_name))
|
||||
|
||||
def register_current_state(self):
|
||||
"""Register command line parser for subcommand current-state"""
|
||||
parser = self.subparsers.add_parser(
|
||||
"current-state",
|
||||
help="Show the phase and state of current dist-git branch - Internal Only",
|
||||
)
|
||||
parser.set_defaults(command=self.request_current_state)
|
||||
|
||||
# FIXME: This is alot of duplication.
|
||||
# Get it working now. De-duplicate later
|
||||
def request_current_state(self):
|
||||
# Only run if we have internal configuraions, or scratch
|
||||
internal_config_file = "/etc/rpkg/centpkg_internal.conf"
|
||||
if os.path.exists(internal_config_file):
|
||||
# Get our internal only variables
|
||||
cfg = ConfigParser.SafeConfigParser()
|
||||
cfg.read(internal_config_file)
|
||||
pp_api_url = config_get_safely(cfg, "centpkg.internal", 'pp_api_url')
|
||||
gitbz_query_url = config_get_safely(cfg, "centpkg.internal", 'gitbz_query_url')
|
||||
rhel_dist_git = config_get_safely(cfg, "centpkg.internal", 'rhel_dist_git')
|
||||
|
||||
# Find out divergent branch and stabalization
|
||||
self.log.info("Checking current state:")
|
||||
stream_version = self.cmd.target.split('-')[0]
|
||||
rhel_version = centpkg.utils.stream_mapping(stream_version)
|
||||
try:
|
||||
active_y, in_stabilization = centpkg.utils.determine_active_y_version(rhel_version, pp_api_url)
|
||||
except AssertionError as e:
|
||||
self.log.error(" Error: centpkg cannot determine the development phase.")
|
||||
self.log.error(" Please file an issue at https://git.centos.org/centos/centpkg")
|
||||
self.log.error(" Workaround: Use the --rhel-target option")
|
||||
self.log.error("Exiting")
|
||||
raise SystemExit(1)
|
||||
divergent_branch = centpkg.utils.does_divergent_branch_exist(
|
||||
self.cmd.repo_name,
|
||||
rhel_version,
|
||||
active_y,
|
||||
rhel_dist_git,
|
||||
pp_api_url,
|
||||
"rpms")
|
||||
# Good to know
|
||||
if in_stabilization :
|
||||
self.log.info(" we are in stabilization mode.")
|
||||
else:
|
||||
self.log.info(" we are not in stabilization mode.")
|
||||
if divergent_branch :
|
||||
self.log.info(" a divergent branch was found.")
|
||||
else:
|
||||
self.log.info(" a divergent branch was not found.")
|
||||
else:
|
||||
self.log.error("NO INTERNAL CONFIGURATION")
|
||||
self.log.error("Hint: If you are internal, install the rhel-packager package from https://download.devel.redhat.com/rel-eng/RCMTOOLS/latest-RCMTOOLS-2-RHEL-9/compose/BaseOS/x86_64/os/Packages/")
|
||||
self.log.error("Exiting")
|
||||
raise SystemExit(1)
|
||||
|
||||
# Overloaded build
|
||||
def register_build(self):
|
||||
# Do all the work from the super class
|
||||
|
|
Loading…
Add table
Reference in a new issue