mirror of
https://github.com/keylase/nvidia-patch.git
synced 2024-08-30 18:32:50 +00:00
ndl: allow sequence output for each channel
This commit is contained in:
parent
f6e3c20cb9
commit
a351f3fde5
@ -150,7 +150,7 @@ class CommandNotifier(BaseNotifier):
|
|||||||
|
|
||||||
class BaseChannel(ABC):
|
class BaseChannel(ABC):
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def get_latest_driver(self):
|
def get_latest_drivers(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@ -175,10 +175,10 @@ class GFEClientChannel(BaseChannel):
|
|||||||
self._crd = crd
|
self._crd = crd
|
||||||
self._timeout = timeout
|
self._timeout = timeout
|
||||||
gfe_get_driver = importlib.import_module('gfe_get_driver')
|
gfe_get_driver = importlib.import_module('gfe_get_driver')
|
||||||
self._get_latest_driver = gfe_get_driver.get_latest_geforce_driver
|
self._get_latest_drivers = gfe_get_driver.get_latest_geforce_driver
|
||||||
|
|
||||||
def get_latest_driver(self):
|
def get_latest_drivers(self):
|
||||||
res = self._get_latest_driver(notebook=self._notebook,
|
res = self._get_latest_drivers(notebook=self._notebook,
|
||||||
x86_64=self._x86_64,
|
x86_64=self._x86_64,
|
||||||
os_version=self._os_version,
|
os_version=self._os_version,
|
||||||
os_build=self._os_build,
|
os_build=self._os_build,
|
||||||
@ -187,6 +187,8 @@ class GFEClientChannel(BaseChannel):
|
|||||||
dch=self._dch,
|
dch=self._dch,
|
||||||
crd=self._crd,
|
crd=self._crd,
|
||||||
timeout=self._timeout)
|
timeout=self._timeout)
|
||||||
|
if res is None:
|
||||||
|
return
|
||||||
res.update({
|
res.update({
|
||||||
'ChannelAttributes': {
|
'ChannelAttributes': {
|
||||||
'Name': self.name,
|
'Name': self.name,
|
||||||
@ -201,7 +203,7 @@ class GFEClientChannel(BaseChannel):
|
|||||||
'Mobile': self._notebook,
|
'Mobile': self._notebook,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return res
|
yield res
|
||||||
|
|
||||||
|
|
||||||
class NvidiaDownloadsChannel(BaseChannel):
|
class NvidiaDownloadsChannel(BaseChannel):
|
||||||
@ -224,7 +226,7 @@ class NvidiaDownloadsChannel(BaseChannel):
|
|||||||
self._cuda_ver = gnd.CUDAToolkitVersion[cuda_ver]
|
self._cuda_ver = gnd.CUDAToolkitVersion[cuda_ver]
|
||||||
self._timeout = timeout
|
self._timeout = timeout
|
||||||
|
|
||||||
def get_latest_driver(self):
|
def get_latest_drivers(self):
|
||||||
latest = self._gnd.get_drivers(os=self._os,
|
latest = self._gnd.get_drivers(os=self._os,
|
||||||
product=self._product,
|
product=self._product,
|
||||||
certlevel=self._certlevel,
|
certlevel=self._certlevel,
|
||||||
@ -233,7 +235,7 @@ class NvidiaDownloadsChannel(BaseChannel):
|
|||||||
cuda_ver=self._cuda_ver,
|
cuda_ver=self._cuda_ver,
|
||||||
timeout=self._timeout)
|
timeout=self._timeout)
|
||||||
if not latest:
|
if not latest:
|
||||||
return None
|
return
|
||||||
res = {
|
res = {
|
||||||
'DriverAttributes': {
|
'DriverAttributes': {
|
||||||
'Version': latest['version'],
|
'Version': latest['version'],
|
||||||
@ -253,7 +255,7 @@ class NvidiaDownloadsChannel(BaseChannel):
|
|||||||
}
|
}
|
||||||
if 'download_url' in latest:
|
if 'download_url' in latest:
|
||||||
res['DriverAttributes']['DownloadURL'] = latest['download_url']
|
res['DriverAttributes']['DownloadURL'] = latest['download_url']
|
||||||
return res
|
yield res
|
||||||
|
|
||||||
|
|
||||||
class CudaToolkitDownloadsChannel(BaseChannel):
|
class CudaToolkitDownloadsChannel(BaseChannel):
|
||||||
@ -264,11 +266,11 @@ class CudaToolkitDownloadsChannel(BaseChannel):
|
|||||||
self._gcd = gcd
|
self._gcd = gcd
|
||||||
self._timeout = timeout
|
self._timeout = timeout
|
||||||
|
|
||||||
def get_latest_driver(self):
|
def get_latest_drivers(self):
|
||||||
latest = self._gcd.get_latest_cuda_tk(timeout=self._timeout)
|
latest = self._gcd.get_latest_cuda_tk(timeout=self._timeout)
|
||||||
if not latest:
|
if not latest:
|
||||||
return None
|
return
|
||||||
return {
|
yield {
|
||||||
'DriverAttributes': {
|
'DriverAttributes': {
|
||||||
'Version': '???',
|
'Version': '???',
|
||||||
'Name': latest,
|
'Name': latest,
|
||||||
@ -289,11 +291,11 @@ class VulkanBetaDownloadsChannel(BaseChannel):
|
|||||||
self._os = os
|
self._os = os
|
||||||
self._timeout = timeout
|
self._timeout = timeout
|
||||||
|
|
||||||
def get_latest_driver(self):
|
def get_latest_drivers(self):
|
||||||
drivers = vulkan_downloads(timeout=self._timeout)
|
drivers = vulkan_downloads(timeout=self._timeout)
|
||||||
for drv in drivers:
|
for drv in drivers:
|
||||||
if drv["os"] == self._os:
|
if drv["os"] == self._os:
|
||||||
return {
|
yield {
|
||||||
'DriverAttributes': {
|
'DriverAttributes': {
|
||||||
'Version': drv['version'],
|
'Version': drv['version'],
|
||||||
'Name': drv['name'],
|
'Name': drv['name'],
|
||||||
@ -301,7 +303,7 @@ class VulkanBetaDownloadsChannel(BaseChannel):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
return None
|
return
|
||||||
|
|
||||||
|
|
||||||
def parse_args():
|
def parse_args():
|
||||||
@ -389,26 +391,39 @@ class DriverLocator:
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
for ch in self._channels:
|
for ch in self._channels:
|
||||||
|
counter = 0
|
||||||
try:
|
try:
|
||||||
drv = ch.get_latest_driver()
|
drivers = ch.get_latest_drivers()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self._perror("get_latest_driver() invocation failed for "
|
self._perror("get_latest_drivers() invocation failed for "
|
||||||
"channel %s. Exception: %s. Continuing..." %
|
"channel %s. Exception: %s. Continuing..." %
|
||||||
(repr(ch.name), str(e)))
|
(repr(ch.name), str(e)))
|
||||||
continue
|
continue
|
||||||
if drv is None:
|
|
||||||
self._perror("Driver not found for channel %s" %
|
|
||||||
(repr(ch.name),))
|
|
||||||
continue
|
|
||||||
try:
|
try:
|
||||||
key = self._hasher.hash_object(drv)
|
# Fetch
|
||||||
|
for drv in drivers:
|
||||||
|
counter += 1
|
||||||
|
# Hash
|
||||||
|
try:
|
||||||
|
key = self._hasher.hash_object(drv)
|
||||||
|
except Exception as e:
|
||||||
|
self._perror("Key evaluation failed for channel %s. "
|
||||||
|
"Exception: %s" % (repr(name), str(e)))
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Notify
|
||||||
|
if not self._db.check_key(key):
|
||||||
|
if self._notify_all(drv):
|
||||||
|
self._db.set_key(key, drv)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self._perror("Key evaluation failed for channel %s. "
|
self._perror("channel %s enumeration terminated with exception: %s" %
|
||||||
"Exception: %s" % (repr(name), str(e)))
|
(repr(name), str(e)))
|
||||||
continue
|
continue
|
||||||
if not self._db.check_key(key):
|
|
||||||
if self._notify_all(drv):
|
if not counter:
|
||||||
self._db.set_key(key, drv)
|
self._perror("Drivers not found for channel %s" %
|
||||||
|
(repr(ch.name),))
|
||||||
return self._ret_code
|
return self._ret_code
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user