- Use #!/usr/bin/bash shebang for package dependency generator to
work correctly. * Add 0002-Use-bash-instead-of-env.patch OBS-URL: https://build.opensuse.org/package/show/server:monitoring/grafana?expand=0&rev=136
This commit is contained in:
commit
d20971cc2a
23
.gitattributes
vendored
Normal file
23
.gitattributes
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
## Default LFS
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.bsp filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.gem filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.jar filter=lfs diff=lfs merge=lfs -text
|
||||
*.lz filter=lfs diff=lfs merge=lfs -text
|
||||
*.lzma filter=lfs diff=lfs merge=lfs -text
|
||||
*.obscpio filter=lfs diff=lfs merge=lfs -text
|
||||
*.oxt filter=lfs diff=lfs merge=lfs -text
|
||||
*.pdf filter=lfs diff=lfs merge=lfs -text
|
||||
*.png filter=lfs diff=lfs merge=lfs -text
|
||||
*.rpm filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.ttf filter=lfs diff=lfs merge=lfs -text
|
||||
*.txz filter=lfs diff=lfs merge=lfs -text
|
||||
*.whl filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.zst filter=lfs diff=lfs merge=lfs -text
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
.osc
|
39
0001-Add-source-code-reference.patch
Normal file
39
0001-Add-source-code-reference.patch
Normal file
@ -0,0 +1,39 @@
|
||||
From 3dd318d8ddc8db3f84020c448e283620cc5d09ac Mon Sep 17 00:00:00 2001
|
||||
From: Marius Kittler <mkittler@suse.de>
|
||||
Date: Mon, 6 Feb 2023 13:51:31 +0100
|
||||
Subject: [PATCH] Add source code reference
|
||||
|
||||
---
|
||||
public/app/core/components/Footer/Footer.tsx | 16 +++++++---------
|
||||
1 file changed, 7 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/public/app/core/components/Footer/Footer.tsx b/public/app/core/components/Footer/Footer.tsx
|
||||
index c73c2ea53..829700096 100644
|
||||
--- a/public/app/core/components/Footer/Footer.tsx
|
||||
+++ b/public/app/core/components/Footer/Footer.tsx
|
||||
@@ -73,15 +73,13 @@ export let getVersionLinks = (): FooterLink[] => {
|
||||
url: hasReleaseNotes ? `https://github.com/grafana/grafana/blob/main/CHANGELOG.md` : undefined,
|
||||
});
|
||||
|
||||
- if (buildInfo.hasUpdate) {
|
||||
- links.push({
|
||||
- target: '_blank',
|
||||
- id: 'updateVersion',
|
||||
- text: `New version available!`,
|
||||
- icon: 'download-alt',
|
||||
- url: 'https://grafana.com/grafana/download?utm_source=grafana_footer',
|
||||
- });
|
||||
- }
|
||||
+ links.push({
|
||||
+ target: '_blank',
|
||||
+ id: 'updateVersion',
|
||||
+ text: `Source code`,
|
||||
+ icon: 'download-alt',
|
||||
+ url: 'https://build.opensuse.org/package/show/openSUSE:Factory/grafana',
|
||||
+ });
|
||||
|
||||
return links;
|
||||
};
|
||||
--
|
||||
2.39.1
|
||||
|
30
0002-Use-bash-instead-of-env.patch
Normal file
30
0002-Use-bash-instead-of-env.patch
Normal file
@ -0,0 +1,30 @@
|
||||
Index: grafana-11.3.0/packaging/wrappers/grafana
|
||||
===================================================================
|
||||
--- grafana-11.3.0.orig/packaging/wrappers/grafana
|
||||
+++ grafana-11.3.0/packaging/wrappers/grafana
|
||||
@@ -1,4 +1,4 @@
|
||||
-#! /usr/bin/env bash
|
||||
+#!/usr/bin/bash
|
||||
|
||||
# Wrapper for the grafana binary
|
||||
# This file serves as a wrapper for the grafana binary. It ensures we set
|
||||
Index: grafana-11.3.0/packaging/wrappers/grafana-cli
|
||||
===================================================================
|
||||
--- grafana-11.3.0.orig/packaging/wrappers/grafana-cli
|
||||
+++ grafana-11.3.0/packaging/wrappers/grafana-cli
|
||||
@@ -1,4 +1,4 @@
|
||||
-#! /usr/bin/env bash
|
||||
+#!/usr/bin/bash
|
||||
|
||||
# Wrapper for the grafana binary
|
||||
# This file serves as a wrapper for the grafana binary. It ensures we set
|
||||
Index: grafana-11.3.0/packaging/wrappers/grafana-server
|
||||
===================================================================
|
||||
--- grafana-11.3.0.orig/packaging/wrappers/grafana-server
|
||||
+++ grafana-11.3.0/packaging/wrappers/grafana-server
|
||||
@@ -1,4 +1,4 @@
|
||||
-#! /usr/bin/env bash
|
||||
+#!/usr/bin/bash
|
||||
|
||||
# Wrapper for the grafana binary
|
||||
# This file serves as a wrapper for the grafana binary. It ensures we set
|
44
Makefile
Normal file
44
Makefile
Normal file
@ -0,0 +1,44 @@
|
||||
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 )
|
||||
|
||||
clean:
|
||||
rm -f $(NAME)-*.tar $(NAME)-*.tar.gz
|
||||
|
||||
tar:
|
||||
osc service manualrun
|
||||
@version=$$( awk '/^Version:/ {print $$2}' $(SPEC) ) && \
|
||||
echo "Package version is $$version" && \
|
||||
basename=$(NAME)-$$version && \
|
||||
tar=$$basename.tar && \
|
||||
tmpdir=$$(mktemp -d -p .) && \
|
||||
cd $$tmpdir && \
|
||||
gunzip ../$$tar.gz && \
|
||||
tar -xf ../$$tar && \
|
||||
# recreate tarball explicitly in a format that handles long filenames \
|
||||
tar --format=posix -cf ../$$tar $$basename && \
|
||||
cd $$basename && \
|
||||
# Patches for the JS frontend go after here \
|
||||
patch --no-backup-if-mismatch -p1 -i ../../0001-Add-source-code-reference.patch && \
|
||||
# End patches section \
|
||||
go mod download && \
|
||||
go mod verify && \
|
||||
go work vendor && \
|
||||
tar --format=posix -cf ../../vendor.tar vendor && \
|
||||
# avoid ".git can't be found" \
|
||||
git init && \
|
||||
# avoid "FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory" \
|
||||
export NODE_OPTIONS=--max_old_space_size=8192 && \
|
||||
yarn install --immutable && \
|
||||
yarn run build && \
|
||||
cd .. && \
|
||||
echo "Updating $$basename/public in tarball..." && \
|
||||
tar -rf ../$$tar $$basename/public && \
|
||||
cd .. && \
|
||||
gzip $$tar && \
|
||||
gzip -f vendor.tar && \
|
||||
rm -rf $$tmpdir
|
38
README
Normal file
38
README
Normal file
@ -0,0 +1,38 @@
|
||||
|
||||
The tarball is generated via the OBS source service, but Grafana
|
||||
needs to ship the compiled frontend assets as well, which have to
|
||||
be built by running yarn inside the source tree (see
|
||||
https://github.com/grafana/grafana/blob/master/contribute/developer-guide.md#frontend).
|
||||
This can't be done at build time on OBS, because it involves
|
||||
downloading and installing packages from the internet, so instead
|
||||
we have a Makefile which does the following:
|
||||
|
||||
- Runs `osc service disabledrun` to get the latest source tarball
|
||||
- Unpacks the tarball to a temporary directory
|
||||
- Runs `yarn install --pure-lockfile && yarn build`
|
||||
- Adds the generated "vendor" and "public" content to the tarball,
|
||||
then compresses it with xz.
|
||||
- The tarball can then be used by OBS to build an RPM.
|
||||
|
||||
In order for this to work you need to have npm >= 14 and yarn installed.
|
||||
|
||||
# zypper in npm14
|
||||
# zypper in obs-service-download_files obs-service-go_modules \
|
||||
obs-service-obs_scm
|
||||
# npm install -g yarn
|
||||
|
||||
Then, to package a new release of Grafana, run `make` then `osc ci`
|
||||
and you should be good.
|
||||
|
||||
If you have a patch for the Javascript frontend to apply you need
|
||||
to do the following:
|
||||
|
||||
- Create the patch and add it with `osc add <PATCH>` to the repo
|
||||
- Open the Makefile
|
||||
- Add after the `cd $$basename && \` the patch with:
|
||||
`patch -p1 < ../../000x-<NAME>.patch && \`
|
||||
- Do NOT add the patch to the Specfile.
|
||||
- Then use the process of building Grafana as described above.
|
||||
|
||||
Please direct any questions to Tim Serong <tserong@suse.com>
|
||||
If Tim is not available you may also contact Enno Gotthold <egotthold@suse.de>
|
9
_constraints
Normal file
9
_constraints
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0"?>
|
||||
<constraints>
|
||||
<hardware>
|
||||
<disk>
|
||||
<size unit="G">5</size>
|
||||
</disk>
|
||||
</hardware>
|
||||
</constraints>
|
||||
|
18
_service
Normal file
18
_service
Normal file
@ -0,0 +1,18 @@
|
||||
<services>
|
||||
<service name="tar_scm" mode="manual">
|
||||
<param name="url">https://github.com/grafana/grafana</param>
|
||||
<param name="scm">git</param>
|
||||
<param name="exclude">.git</param>
|
||||
<param name="versionformat">@PARENT_TAG@</param>
|
||||
<param name="versionrewrite-pattern">v(.*)</param>
|
||||
<param name="revision">v11.3.0</param>
|
||||
<param name="changesgenerate">enable</param>
|
||||
</service>
|
||||
<service name="recompress" mode="manual">
|
||||
<param name="compression">gz</param>
|
||||
<param name="file">grafana*.tar</param>
|
||||
</service>
|
||||
<service name="set_version" mode="manual">
|
||||
<param name="basename">grafana</param>
|
||||
</service>
|
||||
</services>
|
6
_servicedata
Normal file
6
_servicedata
Normal file
@ -0,0 +1,6 @@
|
||||
<servicedata>
|
||||
<service name="tar_scm">
|
||||
<param name="url">https://github.com/grafana/grafana</param>
|
||||
<param name="changesrevision">d9455ff7db73b694db7d412e49a68bec767f2b5a</param>
|
||||
</service>
|
||||
</servicedata>
|
3
grafana-10.3.5.tar.gz
Normal file
3
grafana-10.3.5.tar.gz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:948098bb573e9bf1b788aaec813d71f6654a8d4fd8ef61e736fddfb9204fc6fa
|
||||
size 77195322
|
3
grafana-11.3.0.tar.gz
Normal file
3
grafana-11.3.0.tar.gz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f060e87aacf8ee1044a26946dafaeddb004b3fe597de43e818e57a4fcc025a1f
|
||||
size 91550581
|
2
grafana-rpmlintrc
Normal file
2
grafana-rpmlintrc
Normal file
@ -0,0 +1,2 @@
|
||||
addFilter("binaryinfo-readelf-failed") # go binaries are suposedly ELF-compliant
|
||||
addFilter("no-manual-page-for-binary")
|
9412
grafana.changes
Normal file
9412
grafana.changes
Normal file
File diff suppressed because it is too large
Load Diff
155
grafana.spec
Normal file
155
grafana.spec
Normal file
@ -0,0 +1,155 @@
|
||||
#
|
||||
# spec file for package grafana
|
||||
#
|
||||
# Copyright (c) 2024 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/
|
||||
#
|
||||
|
||||
|
||||
#Compat macro for new _fillupdir macro introduced in Nov 2017
|
||||
%if ! %{defined _fillupdir}
|
||||
%define _fillupdir /var/adm/fillup-templates
|
||||
%endif
|
||||
|
||||
Name: grafana
|
||||
Version: 11.3.0
|
||||
Release: 0
|
||||
Summary: The open-source platform for monitoring and observability
|
||||
License: AGPL-3.0-only
|
||||
Group: System/Monitoring
|
||||
URL: http://grafana.org/
|
||||
Source: %{name}-%{version}.tar.gz
|
||||
Source1: vendor.tar.gz
|
||||
Source2: %{name}-rpmlintrc
|
||||
# Instructions on the build process
|
||||
Source3: README
|
||||
# Makefile to automate build process
|
||||
Source4: Makefile
|
||||
Source5: 0001-Add-source-code-reference.patch
|
||||
Patch2: 0002-Use-bash-instead-of-env.patch
|
||||
BuildRequires: fdupes
|
||||
BuildRequires: git-core
|
||||
BuildRequires: wire
|
||||
BuildRequires: golang(API) >= 1.21
|
||||
Requires(post): %fillup_prereq
|
||||
Requires: group(grafana)
|
||||
Requires: user(grafana)
|
||||
%systemd_ordering
|
||||
|
||||
# Exclude s390 on SLE12, since golang 1.14 itself is not built for this arch on SLE12
|
||||
# See https://build.suse.de/package/view_file/SUSE:SLE-12:Update/go1.14/go1.14.spec?expand=1
|
||||
%if 0%{?suse_version} == 1315
|
||||
ExcludeArch: s390
|
||||
%endif
|
||||
|
||||
%description
|
||||
A graph and dashboard builder for visualizing time series metrics.
|
||||
|
||||
Grafana provides ways to create, explore, and share
|
||||
dashboards and data with teams.
|
||||
|
||||
%prep
|
||||
%setup -q -n grafana-%{version}
|
||||
%autosetup -T -D -a 1 -p1 -n grafana-%{version}
|
||||
|
||||
%build
|
||||
%ifnarch ppc64
|
||||
export GOFLAGS="-buildmode=pie"
|
||||
%endif
|
||||
wire gen -tags 'oss' ./pkg/server
|
||||
go build -o . -ldflags '-X main.version=%{version}' ./pkg/cmd/...
|
||||
|
||||
%install
|
||||
|
||||
# install binaries and service
|
||||
install -Dm755 %{name} %{buildroot}%{_libexecdir}/%{name}/%{name}
|
||||
install -Dm755 %{name}-server %{buildroot}%{_libexecdir}/%{name}/%{name}-server
|
||||
install -Dm755 %{name}-cli %{buildroot}%{_libexecdir}/%{name}/%{name}-cli
|
||||
install -Dm644 {packaging/rpm/systemd/,%{buildroot}%{_unitdir}/}%{name}-server.service
|
||||
install -dm755 %{buildroot}%{_sbindir}
|
||||
install -m755 --target-directory=%{buildroot}%{_sbindir} packaging/wrappers/%{name}*
|
||||
|
||||
# create "rc symlink" (https://en.opensuse.org/openSUSE:Systemd_packaging_guidelines#rc_symlink)
|
||||
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-server
|
||||
|
||||
# add symlink to binary where systemd unit file expects it to be
|
||||
install -dm755 %{buildroot}%{_datadir}/%{name}/bin
|
||||
ln -s %{_libexecdir}/%{name}/%{name} %{buildroot}%{_datadir}/%{name}/bin/%{name}
|
||||
|
||||
install -Dm644 packaging/rpm/sysconfig/%{name}-server \
|
||||
%{buildroot}%{_fillupdir}/sysconfig.%{name}-server
|
||||
|
||||
install -d -m0750 %{buildroot}%{_localstatedir}/lib/%{name}
|
||||
install -d -m0750 %{buildroot}%{_localstatedir}/log/%{name}
|
||||
install -d -m0755 %{buildroot}/%{_localstatedir}/lib/%{name}/plugins
|
||||
install -d -m0755 %{buildroot}/%{_localstatedir}/lib/%{name}/dashboards
|
||||
install -d -m0755 %{buildroot}%{_sysconfdir}/%{name}/provisioning/dashboards
|
||||
|
||||
install -Dm640 conf/sample.ini %{buildroot}%{_sysconfdir}/%{name}/%{name}.ini
|
||||
install -Dm640 {conf/,%{buildroot}%{_sysconfdir}/%{name}/}ldap.toml
|
||||
install -Dm644 {conf/,%{buildroot}%{_datadir}/%{name}/conf/}defaults.ini
|
||||
install -m644 {conf/,%{buildroot}%{_datadir}/%{name}/conf/}sample.ini
|
||||
install -Dm644 {conf/provisioning/dashboards/,%{buildroot}%{_datadir}/%{name}/conf/provisioning/dashboards/}sample.yaml
|
||||
install -Dm644 {conf/provisioning/datasources/,%{buildroot}%{_datadir}/%{name}/conf/provisioning/datasources/}sample.yaml
|
||||
cp -pr public %{buildroot}%{_datadir}/%{name}/
|
||||
install -d -m755 %{buildroot}%{_datadir}/%{name}/vendor
|
||||
install -d -m755 %{buildroot}%{_datadir}/%{name}/tools
|
||||
|
||||
# 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).
|
||||
%fdupes %{buildroot}/%{_datadir}
|
||||
|
||||
%check
|
||||
#gotest github.com/grafana/grafana/pkg...
|
||||
|
||||
%pre
|
||||
%service_add_pre %{name}-server.service
|
||||
|
||||
%post
|
||||
%{fillup_only -n %{name}-server}
|
||||
%service_add_post %{name}-server.service
|
||||
|
||||
%preun
|
||||
%service_del_preun %{name}-server.service
|
||||
|
||||
%postun
|
||||
%service_del_postun %{name}-server.service
|
||||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
%license LICENSE*
|
||||
%doc CHANGELOG*
|
||||
%{_sbindir}/%{name}*
|
||||
%{_sbindir}/rc%{name}-server
|
||||
%dir %{_libexecdir}/%{name}
|
||||
%{_libexecdir}/%{name}/%{name}*
|
||||
%{_unitdir}/%{name}-server.service
|
||||
%{_fillupdir}/sysconfig.%{name}-server
|
||||
%attr(0755,root,root) %dir %{_sysconfdir}/%{name}
|
||||
%attr(0755,root,root) %dir %{_sysconfdir}/%{name}/provisioning
|
||||
%attr(0755,root,root) %dir %{_sysconfdir}/%{name}/provisioning/dashboards
|
||||
%attr(0755,root,grafana) %dir %{_datadir}/%{name}/conf
|
||||
%attr(0640,root,grafana) %config(noreplace) %{_sysconfdir}/%{name}/%{name}.ini
|
||||
%attr(0640,root,grafana) %config(noreplace) %{_sysconfdir}/%{name}/ldap.toml
|
||||
%attr(0755,grafana,grafana) %dir %{_localstatedir}/lib/%{name}
|
||||
%attr(0755,grafana,grafana) %dir %{_localstatedir}/lib/%{name}/plugins
|
||||
%attr(0755,grafana,grafana) %dir %{_localstatedir}/lib/%{name}/dashboards
|
||||
%attr(0750,grafana,grafana) %dir %{_localstatedir}/log/%{name}
|
||||
%doc %{_datadir}/%{name}/conf/sample.ini
|
||||
%doc %{_datadir}/%{name}/conf/provisioning/dashboards/sample.yaml
|
||||
%doc %{_datadir}/%{name}/conf/provisioning/datasources/sample.yaml
|
||||
%config %{_datadir}/%{name}/conf/defaults.ini
|
||||
%{_datadir}/%{name}
|
||||
|
||||
%changelog
|
3
vendor.tar.gz
Normal file
3
vendor.tar.gz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:87fc88c1af7a2fc578f51527f1224541ff057bff99a517f0929f12baa52cba4e
|
||||
size 69952854
|
Loading…
Reference in New Issue
Block a user