#85 Add current-state option
Merged a year ago by tdawson. Opened a year ago by tdawson.
centos/ tdawson/centpkg current-state  into  develop

file modified
+56
@@ -50,6 +50,7 @@ 

      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 @@ 

              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

Currently the only way to check the state of your package is to do a build or something like that.
This adds the check-state that will tell you the phase the RHEL is in, and if you have the appropriate branches.
This is for Red Hat internal only.
Signed-off-by: Troy Dawson tdawson@redhat.com

rebased onto 091b5de

a year ago

rebased onto aededb4

a year ago

Pull-Request has been merged by tdawson

a year ago
Metadata