File grafana-infinity-datasource.spec of Package grafana-infinity-datasource

#
# spec file for package grafana-infinity-datasource
#
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name:           grafana-infinity-datasource
Version:        3.2.0
Release:        0
Summary:        Grafana Infinity Datasource
License:        Apache-2.0
URL:            https://github.com/grafana/%{name}
Source0:        %{name}-%{version}.tar.gz
# golang
Source1:        vendor.tar.gz
# typescript
Source10:       package-lock.json
Source11:       node_modules.spec.inc
%include        %{_sourcedir}/node_modules.spec.inc
Patch10:        package-json-ver.patch
# golang
BuildRequires:  golang(API) >= 1.23
# typescript
BuildRequires: local-npm-registry

%description
Visualize data from JSON, CSV, XML, GraphQL and HTML endpoints in Grafana.

%prep
%autosetup -p1 -a1
local-npm-registry %{_sourcedir} install --legacy-peer-deps --ignore-scripts


%build
npm run build
go build \
  -o dist/gpx_infinity_linux \
  -tags "arrow_json_stdlib" \
  -ldflags " \
  -X 'github.com/grafana/grafana-plugin-sdk-go/build.buildInfoJSON={"pluginID":"yesoreyeram-infinity-datasource","version":"%{version}"}' \
  -X 'main.pluginID=yesoreyeram-infinity-datasource' \
  -X 'main.version=%{version}'" ./pkg

%install
%define grafana_plugin_dir %{_localstatedir}/lib/grafana/plugins
%define plugin_subdir grafana-infinity-datasource
%define destination %{buildroot}%{grafana_plugin_dir}/%{plugin_subdir}

install -Dd -m0755 %{destination}/img/

install -D -m0644 dist/img/*.png %{destination}/img/
install -D -m0644 dist/img/*.jpg %{destination}/img/
install -D -m0644 dist/img/*.svg %{destination}/img/
install -D -m0755 dist/gpx_infinity_linux %{destination}
install -D -m0644 dist/plugin.json %{destination}

install -D -m0644 dist/LICENSE %{destination}
install -D -m0644 dist/README.md %{destination}
install -D -m0644 dist/CHANGELOG.md %{destination}

install -D -m0644 dist/module.js %{destination}
install -D -m0644 dist/module.js.LICENSE.txt %{destination}
install -D -m0644 dist/module.js.map %{destination}


%files
%doc README.md
%license %{grafana_plugin_dir}/%{plugin_subdir}/LICENSE

%dir %{_localstatedir}/lib/grafana
%dir %{grafana_plugin_dir}
%dir %{grafana_plugin_dir}/%{plugin_subdir}
%dir %{grafana_plugin_dir}/%{plugin_subdir}/img

%{grafana_plugin_dir}/%{plugin_subdir}/img/*.png
%{grafana_plugin_dir}/%{plugin_subdir}/img/*.jpg
%{grafana_plugin_dir}/%{plugin_subdir}/img/*.svg

%{grafana_plugin_dir}/%{plugin_subdir}/gpx_infinity_linux

%{grafana_plugin_dir}/%{plugin_subdir}/plugin.json

%{grafana_plugin_dir}/%{plugin_subdir}/README.md
%{grafana_plugin_dir}/%{plugin_subdir}/CHANGELOG.md

%{grafana_plugin_dir}/%{plugin_subdir}/module.js
%{grafana_plugin_dir}/%{plugin_subdir}/module.js.LICENSE.txt
%{grafana_plugin_dir}/%{plugin_subdir}/module.js.map

%changelog

openSUSE Build Service is sponsored by