Accepting request 721810 from server:monitoring

OBS-URL: https://build.opensuse.org/request/show/721810
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/grafana?expand=0&rev=2
This commit is contained in:
Dominique Leuenberger 2019-08-09 14:54:03 +00:00 committed by Git OBS Bridge
commit b328970e04
4 changed files with 62 additions and 1 deletions

33
Makefile.phantomjs Normal file
View File

@ -0,0 +1,33 @@
NAME = grafana
SPEC = $(NAME).spec
default: verify-deps clean tar
verify-deps:
@which yarn >/dev/null 2>&1 || ( echo "yarn not found; run \`sudo npm install -g yarn\`" && false )
@which grunt >/dev/null 2>&1 || ( echo "grunt not found; run \`sudo npm install -g grunt-cli\`" && false )
clean:
rm -f $(NAME)-*.tar $(NAME)-*.tar.xz
tar:
osc service disabledrun
@version=$$( awk '/^Version:/ {print $$2}' $(SPEC) ) && \
echo "Package version is $$version" && \
basename=$(NAME)-$$version && \
tar=$$basename.tar && \
tmpdir=$$(mktemp -d -p .) && \
cd $$tmpdir && \
tar -xf ../$$tar && \
cd $$basename && \
sed -i 's/base\///' public/sass/base/_fonts.scss && \
yarn install --pure-lockfile && \
grunt release && \
cp -pr tmp/public . && \
cp -pr tmp/tools . && \
cd .. && \
echo "Updating $$basename/tools $$basename/public in tarball..." && \
tar -rf ../$$tar $$basename/tools $$basename/public && \
cd .. && \
xz $$tar && \
rm -rf $$tmpdir

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Tue Jul 30 14:14:38 CEST 2019 - ro@suse.de
- make phantomjs dependency configurable
-------------------------------------------------------------------
Thu Jul 11 08:21:07 UTC 2019 - Jan Fajerski <jan.fajerski@suse.com>

View File

@ -25,6 +25,8 @@
%define _fillupdir /var/adm/fillup-templates
%endif
%bcond_with phantomjs
Name: grafana
Version: 6.2.5
Release: 0
@ -37,13 +39,18 @@ Source1: %{name}-rpmlintrc
# Instructions on the build process
Source2: README
# Makefile to automate build process
Source3: Makefile
Source3: Makefile.no_phantomjs
Source4: Makefile.phantomjs
BuildRequires: fdupes
BuildRequires: go >= 1.11
BuildRequires: golang-packaging
BuildRequires: shadow
Requires(post): %insserv_prereq
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if %{with phantomjs}
BuildRequires: phantomjs
Requires: phantomjs
%endif
%{?systemd_requires}
%description
@ -54,6 +61,11 @@ dashboards and data with teams.
%prep
%setup -q -n grafana-%{version}
%if %{with phantomjs}
cp %{S:4} %_sourcedir/Makefile
%else
cp %{S:3} %_sourcedir/Makefile
%endif
%build
%goprep github.com/grafana/grafana
@ -98,6 +110,17 @@ cp -pr public %{buildroot}%{_datadir}/%{name}/
install -d -m755 %{buildroot}%{_datadir}/%{name}/vendor
install -d -m755 %{buildroot}%{_datadir}/%{name}/tools
%if %{with phantomjs}
# phantomjs is used for rendering PNG images of graphs. The frontend asset
# build process downloadsa prebuilt x86_64 binary, which ends up in
# vendor/phantomjs/phantomjs. This is ugly but works for x86_64. It naturally
# will not work for other architectures, so instead we remove the phantomjs
# binary and install a symlink to the systemwide /usr/bin/phantomjs.
cp -pr tools/phantomjs %{buildroot}%{_datadir}/%{name}/tools/
rm -f %{buildroot}%{_datadir}/%{name}/tools/phantomjs/phantomjs
ln -s %{_bindir}/phantomjs %{buildroot}%{_datadir}/%{name}/tools/phantomjs/phantomjs
%endif
# Do *not* use %%fudpes -s -- this will result in grafana failing to load
# all the plugins (something in the plugin scanner can't cope with files
# in there being symlinks).