File grafana-piechart-panel.spec of Package grafana-piechart-panel.25632

#
# spec file for package grafana-piechart-panel
#
# Copyright (c) 2021 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-piechart-panel
Version:        1.6.2
Release:        0
Summary:        Grafana Piechart panel
License:        MIT
Group:          System/Monitoring
URL:            https://github.com/grafana/piechart-panel
Source:         piechart-panel-1.6.1.tar.xz
# v1.6.2 is the same as v1.6.1, but with the contents of the 'dist'
# directory signed by the upstream Grafana folks.  For background on
# this, see https://github.com/Vonage/Grafana_Status_panel/issues/189.
# Although the linked issue is about the Grafana Status panel, it applies
# to the Pie Chart as well. It's only linked here because the explaination
# is better than in the original Pie Chart panel issue
# https://github.com/grafana/piechart-panel/issues/277.
# The difficulty packaging this is that nobody seems to have actually
# pushed that signature (the stuff in MANIFEST.txt) to a git repo
# anywhere, so we can't just use the _service file as usual to make
# a nice source tarball.  Instead, we've got the existing v1.6.1
# release, plus the following zip file, which was downloaded from
# https://grafana.com/grafana/plugins/grafana-piechart-panel/?tab=installation
# See further down in the build section for how this is used...
Source1:        grafana-piechart-panel-1.6.2.zip
Requires:       grafana
BuildRequires:  grafana
BuildRequires:  unzip
BuildRequires:  xz
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Pie chart panel for grafana

%prep
%setup -q -n piechart-panel-1.6.1 -a 1

%build
# grafana-piechart-panel-1.6.2.zip extracts to the grafana-piechart-panel
# directory, so grab everything from there and move it back to 'dist'.
pushd grafana-piechart-panel && \
find . -type f -exec mv {} ../dist/{} \;
popd

%install
%define grafana_plugin_dir %{_localstatedir}/lib/grafana/plugins
%define plugin_subdir grafana-piechart-panel
%define destination %{buildroot}%{grafana_plugin_dir}/%{plugin_subdir}/dist

install -Dd -m0755 %{destination}/img/
install -Dd -m0755 %{destination}/styles/
install -D -m0644 dist/img/*.png %{destination}/img/
install -D -m0644 dist/styles/*.css %{destination}/styles/
install -D -m0644 dist/dark.js %{destination}/
install -D -m0644 dist/light.js %{destination}/
install -D -m0644 dist/editor.html %{destination}/
install -D -m0644 dist/module.html %{destination}/
install -D -m0644 dist/module.js %{destination}/
install -D -m0644 dist/plugin.json %{destination}/
# MANIFEST.txt file (plugin signature) and files listed in MANIFEST.txt
install -D -m0644 dist/MANIFEST.txt %{destination}/
install -D -m0644 dist/LICENSE %{destination}/
install -D -m0644 dist/module.js.LICENSE.txt %{destination}/
install -D -m0644 dist/module.js.map %{destination}/
install -D -m0644 dist/light.js.map %{destination}/
install -D -m0644 dist/dark.js.map %{destination}/
install -D -m0644 dist/img/piechart_logo_large.svg %{destination}/img/
install -D -m0644 dist/img/piechart_logo_small.svg %{destination}/img/

install -D -m0644 README.md %{buildroot}%{grafana_plugin_dir}/%{plugin_subdir}/dist
install -D -m0644 LICENSE %{buildroot}%{grafana_plugin_dir}/%{plugin_subdir}/

%files
%attr(0755,grafana,grafana) %dir %{_localstatedir}/lib/grafana
%attr(0755,grafana,grafana) %dir %{_localstatedir}/lib/grafana/plugins

%doc README.md
%license LICENSE
%dir %{grafana_plugin_dir}/%{plugin_subdir}
%dir %{grafana_plugin_dir}/%{plugin_subdir}/dist
%dir %{grafana_plugin_dir}/%{plugin_subdir}/dist/img
%dir %{grafana_plugin_dir}/%{plugin_subdir}/dist/styles
%{grafana_plugin_dir}/%{plugin_subdir}/dist/editor.html
%{grafana_plugin_dir}/%{plugin_subdir}/dist/module.html
%{grafana_plugin_dir}/%{plugin_subdir}/dist/module.js
%{grafana_plugin_dir}/%{plugin_subdir}/dist/plugin.json
%{grafana_plugin_dir}/%{plugin_subdir}/dist/dark.js
%{grafana_plugin_dir}/%{plugin_subdir}/dist/light.js
%{grafana_plugin_dir}/%{plugin_subdir}/dist/img/*.png
%{grafana_plugin_dir}/%{plugin_subdir}/dist/styles/*.css
%{grafana_plugin_dir}/%{plugin_subdir}/LICENSE
%{grafana_plugin_dir}/%{plugin_subdir}/dist/README.md
# MANIFEST.txt is the plugin signature.  Also add some more files listed
# in the manifest.  Otherwise the plugin will fail signature verification
# without them.
%{grafana_plugin_dir}/%{plugin_subdir}/dist/MANIFEST.txt
%{grafana_plugin_dir}/%{plugin_subdir}/dist/LICENSE
%{grafana_plugin_dir}/%{plugin_subdir}/dist/module.js.LICENSE.txt
%{grafana_plugin_dir}/%{plugin_subdir}/dist/module.js.map
%{grafana_plugin_dir}/%{plugin_subdir}/dist/light.js.map
%{grafana_plugin_dir}/%{plugin_subdir}/dist/dark.js.map
%{grafana_plugin_dir}/%{plugin_subdir}/dist/img/piechart_logo_large.svg
%{grafana_plugin_dir}/%{plugin_subdir}/dist/img/piechart_logo_small.svg

%changelog
openSUSE Build Service is sponsored by