commit 0101b1ce851e059ba9c2587611d550795920caa1
Author: Leigh Scott <leigh123linux(a)gmail.com>
Date: Wed Nov 3 20:39:53 2021 +0000
Use supported-gpus.json to generate appdata
parse-readme.py | 61 ------------------------------------------------
parse-supported-gpus.py | 32 +++++++++++++++++++++++++
xorg-x11-drv-nvidia.spec | 7 +++---
3 files changed, 35 insertions(+), 65 deletions(-)
---
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 <negativo17(a)gmail.com>
+# 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