@@ -767,7 +767,12 @@ def _published_build_url(
767
767
768
768
769
769
def _latest_build_url (
770
- target : str , arch : str , edition : str , component : str , branch : "str|None"
770
+ cache : Cache ,
771
+ target : str ,
772
+ arch : str ,
773
+ edition : str ,
774
+ component : str ,
775
+ branch : "str|None" ,
771
776
) -> str :
772
777
"""
773
778
Get the URL for an "unpublished" "latest" build.
@@ -796,6 +801,15 @@ def _latest_build_url(
796
801
ext = "zip" if target == "windows" else "tgz"
797
802
# Enterprise builds have an "enterprise" infix
798
803
ent_infix = "enterprise-" if edition == "enterprise" else ""
804
+ if "rhel" in target :
805
+ # Some RHEL targets include a minor version, like "rhel93". Check the URL of the latest release.
806
+ latest_release_url = _published_build_url (
807
+ cache , "latest" , target , arch , edition , component
808
+ )
809
+ got = re .search (r"rhel[0-9][0-9]" , latest_release_url )
810
+ if got is not None :
811
+ # Rewrite target like "rhel9" to "rhel93" to match published URL.
812
+ target = got .group (0 )
799
813
# Some platforms have a filename infix
800
814
tgt_infix = (target + "-" ) if target not in ("windows" , "win32" , "macos" ) else ""
801
815
# Non-master branch uses a filename infix
@@ -823,7 +837,7 @@ def _dl_component(
823
837
LOGGER .info (f"Download { component } { version } -{ edition } for { target } -{ arch } " )
824
838
if version == "latest-build" :
825
839
dl_url = _latest_build_url (
826
- target , arch , edition , component , latest_build_branch
840
+ cache , target , arch , edition , component , latest_build_branch
827
841
)
828
842
else :
829
843
try :
0 commit comments