diff --git a/parse-readme.py b/parse-readme.py deleted file mode 100755 index acaf0d5..0000000 --- a/parse-readme.py +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/python3 -# -*- coding: utf-8 -*- -# -# Copyright (C) 2021 Simone Caronni -# Licensed under the GNU General Public License Version or later - -import sys - -def main(): - if len(sys.argv) != 2: - print("usage: %s README.txt" % sys.argv[0]) - return 1 - - f = open(sys.argv[1]) - in_section = False - in_table = False - pids = [] - sections = ["CURRENT NVIDIA GPUS"] - for section in sections: - - for line in f.readlines(): - - # Find the right data tables - if line.find(section) != -1: - in_section = True - continue - if not in_section: - continue - - # Remove Windows and Linux line endings - line = line.replace('\r', '') - line = line.replace('\n', '') - - # End of section - if len(line) > 0 and not line.startswith(' '): - in_section = False - in_table = False - continue - - if len(line) == 0: - continue - - # Skip the header - if line.startswith(' ---'): - in_table = True - continue - if not in_table: - continue - - # PCI ID - pid = int(line[50:54], 16) - if not pid in pids: - pids.append(pid) - - for pid in pids: - vid = 0x10de - print("pci:v%08Xd%08Xsv*sd*bc*sc*i*" % (vid, pid)) - -if __name__ == "__main__": - main() - diff --git a/parse-supported-gpus.py b/parse-supported-gpus.py new file mode 100755 index 0000000..94ac6b1 --- /dev/null +++ b/parse-supported-gpus.py @@ -0,0 +1,32 @@ +#!/usr/bin/python3 +# -*- coding: utf-8 -*- +# +# Copyright (C) 2021 Simone Caronni +# Licensed under the GNU General Public License Version or later + +import json +import sys + +def main(): + if len(sys.argv) != 2: + print("usage: %s supported-gpus.json" % sys.argv[0]) + return 1 + + f = open(sys.argv[1]) + gpus_raw = json.load(f) + legacy = 'legacybranch' + devids = [] + + for product in gpus_raw["chips"]: + + if legacy not in product.keys(): + + devid = int(product["devid"], 16) + if not devid in devids: + devids.append(devid) + + for devid in devids: + print("pci:v000010DEd%08Xsv*sd*bc*sc*i*" % (devid)) + +if __name__ == "__main__": + main() diff --git a/xorg-x11-drv-nvidia.spec b/xorg-x11-drv-nvidia.spec index 1923abf..b162dfc 100644 --- a/xorg-x11-drv-nvidia.spec +++ b/xorg-x11-drv-nvidia.spec @@ -35,7 +35,7 @@ Source5: alternate-install-present Source6: nvidia.conf Source7: 60-nvidia.rules Source8: xorg-x11-drv-nvidia.metainfo.xml -Source9: parse-readme.py +Source9: parse-supported-gpus.py Source10: 60-nvidia-uvm.rules Source11: nvidia-uvm.conf Source12: 99-nvidia-dracut.conf @@ -363,9 +363,8 @@ EOF %if 0%{?fedora} || 0%{?rhel} > 7 # install AppData and add modalias provides -mkdir -p %{buildroot}%{_metainfodir}/ -install -pm 0644 %{SOURCE8} %{buildroot}%{_metainfodir}/ -%{SOURCE9} README.txt | xargs appstream-util add-provide %{buildroot}%{_metainfodir}/xorg-x11-drv-nvidia.metainfo.xml modalias +install -D -p -m 0644 %{SOURCE8} %{buildroot}%{_metainfodir}/xorg-x11-drv-nvidia.metainfo.xml +%{SOURCE9} supported-gpus/supported-gpus.json | xargs appstream-util add-provide %{buildroot}%{_metainfodir}/xorg-x11-drv-nvidia.metainfo.xml modalias mkdir -p %{buildroot}%{_datadir}/pixmaps install -pm 0644 nvidia-settings.png %{buildroot}%{_datadir}/pixmaps/%{name}.png %endif