7979 },
8080}
8181
82- # ------------------------------------------------------------------------------
83- # Cleanup strings per base distro family
84- cleanup_string_by_distro = {
82+
83+ def base_name (name : str ) -> str :
84+ """Normalize a distro string like 'ubuntu' or 'debian' (you said you pass plain distro)."""
85+ return name .lower ().strip ()
86+
87+ def map_family (platform : str ) -> str :
88+ p = base_name (platform )
89+ if p in ("almalinux" , "rhel" , "centos" , "rockylinux" ):
90+ return "fedora"
91+ if p == "debian" :
92+ return "ubuntu"
93+ return p
94+
95+ def unique_preserve_order (items ):
96+ seen = set ()
97+ out = []
98+ for it in items :
99+ if it not in seen :
100+ seen .add (it )
101+ out .append (it )
102+ return out
103+
104+ def debian_adjustments (pkgs : list [str ]) -> list [str ]:
105+ rep = {
106+ "libqt6opengl6t64" : "libqt6opengl6" ,
107+ "libqt6openglwidgets6t64" : "libqt6openglwidgets6" ,
108+ }
109+ return [rep .get (p , p ) for p in pkgs ]
110+
111+
112+
113+ cleanup_string_by_family = {
85114 "fedora" : (
86115 " \\ \n && dnf -y update"
87116 " \\ \n && dnf -y check-update"
@@ -116,12 +145,6 @@ def novnc_launch_commands() -> str:
116145/usr/share/novnc/utils/novnc_proxy --vnc localhost:5900 --listen 6080"]
117146"""
118147
119- def distro_name_from_image (image : str ) -> str :
120- image = image .lower ()
121- for d in ["fedora" , "almalinux" , "rhel" , "ubuntu" , "debian" , "arch" ]:
122- if d in image :
123- return d
124- return "unknown"
125148
126149def local_setup_filename ():
127150 return '/etc/profile.d/localSetup.sh'
@@ -135,26 +158,44 @@ def docker_header(image: str) -> str:
135158ENV AUTOBUILD=1
136159"""
137160
138- def _map_family (platform : str ) -> str :
139- p = platform .lower ()
140- if "almalinux" in p or "rhel" in p or "centos" in p : # treat RHEL family as fedora pkgs
141- return "fedora"
142- if "debian" in p : # treat Debian like Ubuntu pkgs
143- return "ubuntu"
144- return p
145161
146- def packages_to_be_installed (platform : str ) -> str :
147- plat = _map_family (platform )
162+ def debian_adjustments (pkgs : list [str ]) -> list [str ]:
163+ # replace Ubuntu’s t64 Qt libs with Debian names
164+ rep = {
165+ "libqt6opengl6t64" : "libqt6opengl6" ,
166+ "libqt6openglwidgets6t64" : "libqt6openglwidgets6" ,
167+ }
168+ out = []
169+ for p in pkgs :
170+ out .append (rep .get (p , p ))
171+ return out
172+
173+
174+ def packages_to_be_installed (distro : str ) -> str :
175+ base = base_name (distro ) # e.g., 'ubuntu', 'debian', 'fedora'
176+ family = map_family (base ) # e.g., 'ubuntu' (for debian), 'fedora', 'arch'
177+
148178 pkgs = []
149179 for section in pkg_sections .values ():
150- pkgs .extend (section .get (plat , []))
151- # remove duplicates, keep stable output
152- return ' ' .join (sorted (set (pkgs )))
153-
154- def install_root_from_ubuntu_tarball (local_setup_file : str ) -> str :
155- root_version = '6.32.02'
156- ubuntu_os_name = 'ubuntu24.04-x86_64-gcc13.2'
157- root_file = f'root_v{ root_version } .Linux-{ ubuntu_os_name } .tar.gz'
180+ pkgs .extend (section .get (family , []))
181+
182+ # Debian needs Qt6 name tweaks (only when the actual base is debian)
183+ if base == "debian" :
184+ pkgs = debian_adjustments (pkgs )
185+
186+ # De-dupe but KEEP section order
187+ pkgs = unique_preserve_order (pkgs )
188+ return ' ' .join (pkgs )
189+
190+
191+
192+ def install_root_tarball (base : str , local_setup_file : str ) -> str :
193+ root_version = "6.36.04"
194+ if base == "ubuntu" :
195+ os_name = "ubuntu24.04-x86_64-gcc13.3"
196+ elif base == "debian" :
197+ os_name = "debian12-x86_64-gcc12.2" # adjust to an actual ROOT build name if available
198+ root_file = f'root_v{ root_version } .Linux-{ os_name } .tar.gz'
158199 root_remote_file = f'https://root.cern/download/{ root_file } '
159200 root_install_dir = '/usr/local'
160201 commands = '\n \n '
@@ -194,10 +235,9 @@ def curl_command(url: str) -> str:
194235 return f"bash -lc 'CA=\" { ca } \" ; EXTRA=\" \" ; [ -f \" $CA\" ] && EXTRA=\" --cacert $CA\" ; curl -S --location-trusted --progress-bar --retry 4 $EXTRA -k -O { url } '"
195236
196237def packages_install_commands (image : str ) -> str :
197- distro = distro_name_from_image (image )
198- family = _map_family (distro )
238+ family = map_family (image )
199239 packages = packages_to_be_installed (image )
200- cleanup = cleanup_string_by_distro .get (family , "" )
240+ cleanup = cleanup_string_by_family .get (family , "" )
201241 local_setup_file = local_setup_filename ()
202242 commands = ""
203243 commands += docker_header (image )
@@ -225,7 +265,7 @@ def packages_install_commands(image: str) -> str:
225265 " && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends tzdata "
226266 + packages + cleanup
227267 )
228- commands += install_root_from_ubuntu_tarball ( local_setup_file )
268+ commands += install_root_tarball ( image , local_setup_file )
229269
230270 elif family == "arch" :
231271 commands += f"RUN pacman -Syu --noconfirm { packages } { cleanup } "
0 commit comments