diff --git a/src/centpkg/utils.py b/src/centpkg/utils.py index 45649d3..b65aefe 100644 --- a/src/centpkg/utils.py +++ b/src/centpkg/utils.py @@ -44,6 +44,10 @@ pp_phase_name_lookup[pp_phase_stabilization] = "Stabilization" pp_phase_maintenance = 600 pp_phase_name_lookup[pp_phase_maintenance] = "Maintenance" +# Phase 1000 is "Unsupported" (AKA, end-of-life) +pp_phase_unsupported = 1000 +pp_phase_name_lookup[pp_phase_unsupported] = "Unsupported" + # Default lookup location for unsynced packages default_distrobaker_config = "https://gitlab.cee.redhat.com/osci/distrobaker_config/-/raw/rhel9/distrobaker.yaml?ref_type=heads" @@ -525,9 +529,7 @@ def determine_rhel_state( # Query the "package pages" API for the current active Y-stream release request_params = { - "phase__in": "{},{},{}".format( - pp_phase_devtestdoc, pp_phase_stabilization, pp_phase_maintenance - ), + "phase__in": f"{pp_phase_devtestdoc},{pp_phase_stabilization},{pp_phase_maintenance},{pp_phase_unsupported}", "product__shortname": "rhel", "relgroup__shortname": rhel_version, "format": "json", @@ -616,28 +618,40 @@ def determine_rhel_state( logger.debug("Prior release branch: {}".format(prior_release_branch)) - try: - branch_exists = does_branch_exist( - rhel_dist_git, namespace, repo_name, prior_release_branch - ) - except gitpython.GitCommandError as e: - raise RHELError("Could not read from RHEL dist-git. Are you on the VPN?") + # Determine which phase the prior release is in: + prior_release_phase = phase_lookup[prior_release_branch] - if branch_exists: - # The branch is there, so work on the active Y-stream, which is always - # in either DevTestDoc Phase or Maintenance Phase (in the case of an - # end-of-life CentOS Stream) + # If the prior release is in the Unsupported Phase, it probably means + # that we're dealing with an EOL CentOS Stream (like 8.10). We need + # to use the stream rules in this case. + prior_is_eol = bool(prior_release_phase == pp_phase_unsupported) + + if not prior_is_eol: + try: + branch_exists = does_branch_exist( + rhel_dist_git, namespace, repo_name, prior_release_branch + ) + except gitpython.GitCommandError as e: + raise RHELError("Could not read from RHEL dist-git. Are you on the VPN?") + + if prior_is_eol or branch_exists: + # The branch is there or the previous branch is EOL, so work on the + # active Y-stream, which is always in either DevTestDoc Phase or + # Maintenance Phase (in the case of an end-of-life CentOS Stream) + # We'll catch the unexpected case of Unsupported Phase as well, just + # to be safe. phase = phase_lookup[current_release_branch] check_tickets_branch = cs_branch rhel_target_default = "latest" target_version = latest_version - if phase == pp_phase_maintenance: + if phase >= pp_phase_maintenance: enforcing = True else: enforcing = False else: # The branch is not present, so we'll work on the prior Y-stream check_tickets_branch = prior_release_branch + phase = prior_release_phase target_x, target_y, target_extra = parse_rhel_branchname(prior_release_branch) target_version = "{}.{}{}".format( @@ -650,9 +664,6 @@ def determine_rhel_state( # phase, so it always enforces. enforcing = True - # Determine which phase the prior release is in: - phase = phase_lookup[prior_release_branch] - if phase == pp_phase_stabilization: # We're in the Stabilization phase, so we can't automatically determine # between the "zstream" and "exception" targets.