Skip to content

Commit

Permalink
fix install --gpgpu handling
Browse files Browse the repository at this point in the history
(LP: #2083709)

Signed-off-by: Kuba Pawlak <[email protected]>
  • Loading branch information
ktpawlak committed Oct 4, 2024
1 parent 4a4172e commit 712396f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
13 changes: 13 additions & 0 deletions UbuntuDrivers/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,19 @@ def _process_name(self, name):
self._major_ver = int(match.group(1))
self.is_valid = True

# Recent naming such as nvidia-headless[-no-dkms]-525 for gpgpu
pattern = re.compile('nvidia-headless(.*)-([0-9]+)(.*)')
match = pattern.match(name)

if match:
self._server = match.group(0).find('-server') != -1
self._open = match.group(0).find('-open') != -1
self._flavour = '%s%s%s' % (match.group(2),
'-server' if self._server else '',
'-open' if self._open else '')
self._major_ver = match.group(2)
self.is_valid = True

def has_obsolete_name_scheme(self):
return self._obsolete_name_scheme

Expand Down
6 changes: 3 additions & 3 deletions tests/test_ubuntu_drivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1926,7 +1926,7 @@ def test_system_gpgpu_driver_packages_chroot2(self):

res = UbuntuDrivers.detect.system_gpgpu_driver_packages(cache, sys_path=self.umockdev.get_sys_dir())
linux_package = UbuntuDrivers.detect.get_linux(cache)
modules_package = UbuntuDrivers.detect.get_linux_modules_metapackage(cache, 'nvidia-driver-410')
modules_package = UbuntuDrivers.detect.get_linux_modules_metapackage(cache, 'nvidia-headless-no-dkms-410')
finally:
chroot.remove()

Expand Down Expand Up @@ -2065,7 +2065,7 @@ def test_system_gpgpu_driver_packages_chroot3(self):
sys_path=self.umockdev.get_sys_dir())
linux_package = UbuntuDrivers.detect.get_linux(cache)
modules_package = UbuntuDrivers.detect.get_linux_modules_metapackage(cache,
'nvidia-driver-410')
'nvidia-headless-no-dkms-410')
finally:
chroot.remove()

Expand Down Expand Up @@ -2252,7 +2252,7 @@ def test_system_gpgpu_driver_packages_chroot4(self):
sys_path=self.umockdev.get_sys_dir())
linux_package = UbuntuDrivers.detect.get_linux(cache)
modules_package = UbuntuDrivers.detect.get_linux_modules_metapackage(cache,
'nvidia-driver-440')
'nvidia-headless-no-dkms-440')
finally:
chroot.remove()

Expand Down
4 changes: 2 additions & 2 deletions ubuntu-drivers
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def install_gpgpu(args):
if modules_package and not cache[modules_package].current_ver:
to_install.append(modules_package)

lrm_meta = UbuntuDrivers.detect.get_userspace_lrm_meta(apt_cache, p)
lrm_meta = UbuntuDrivers.detect.get_userspace_lrm_meta(cache, p)
if lrm_meta and not apt_cache[lrm_meta].current_ver:
# Add the lrm meta and drop the non lrm one
to_install.append(lrm_meta)
Expand Down Expand Up @@ -522,4 +522,4 @@ def devices(config, **kwargs):


if __name__ == '__main__':
greet()
greet()

0 comments on commit 712396f

Please sign in to comment.