Blame grafana.spec

1f64cbe
%global grafana_arches %{lua: go_arches = {}
1f64cbe
  for arch in rpm.expand("%{go_arches}"):gmatch("%S+") do
1f64cbe
    go_arches[arch] = 1
1f64cbe
  end
1f64cbe
  for arch in rpm.expand("%{nodejs_arches}"):gmatch("%S+") do
1f64cbe
    if go_arches[arch] then
1f64cbe
      print(arch .. " ")
1f64cbe
  end
1f64cbe
end}
1f64cbe
25db04d
# Unbundle Grafana vendor sources and instead use BuildRequires
5c9d1ea
# only on platforms that have enough golang devel support.
5c9d1ea
%if 0%{?rhel} == 0
5c9d1ea
%global           unbundle_vendor_sources 1
5c9d1ea
%endif
5c9d1ea
47a36c9
%if 0%{?fedora} >= 30
25db04d
# Use vendor sources until both Fedora and Grafana properly support golang modules
25db04d
%global           unbundle_vendor_sources 0
25db04d
%endif
25db04d
5c9d1ea
1f64cbe
Name:             grafana
47a36c9
Version:          6.3.6
25db04d
Release:          1%{?dist}
1f64cbe
Summary:          Metrics dashboard and graph editor
1f64cbe
License:          ASL 2.0
1f64cbe
URL:              https://grafana.org
1f64cbe
1f64cbe
# Source0 contains the tagged upstream sources
1f64cbe
Source0:          https://github.com/grafana/grafana/archive/v%{version}/%{name}-%{version}.tar.gz
1f64cbe
1f64cbe
# Source1 contains the front-end javascript modules bundled into a webpack
1f64cbe
Source1:          grafana_webpack-%{version}.tar.gz
1f64cbe
1f64cbe
# Source2 is the script to create the above webpack from grafana sources
5c9d1ea
Source2:          make_grafana_webpack.sh
1f64cbe
5c9d1ea
# Patches for upstream
5c9d1ea
Patch1:           001-login-oauth-use-oauth2-exchange.patch
5c9d1ea
Patch2:           002-remove-jaeger-tracing.patch
5c9d1ea
Patch3:           003-new-files.patch
25db04d
Patch4:           004-xerrors.patch
47a36c9
Patch5:           005-mute-shellcheck-grafana-cli.patch
1f64cbe
1f64cbe
# Intersection of go_arches and nodejs_arches
1f64cbe
ExclusiveArch:    %{grafana_arches}
1f64cbe
5c9d1ea
# omit golang debugsource, see BZ995136 and related
25db04d
%global           dwz_low_mem_die_limit 0
5c9d1ea
%global           _debugsource_template %{nil}
5c9d1ea
1f64cbe
%global           GRAFANA_USER %{name}
1f64cbe
%global           GRAFANA_GROUP %{name}
1f64cbe
%global           GRAFANA_HOME %{_datadir}/%{name}
1f64cbe
1f64cbe
# grafana-server service daemon uses systemd
1f64cbe
%{?systemd_requires}
1f64cbe
Requires(pre):    shadow-utils
1f64cbe
25db04d
BuildRequires:    git, systemd, golang, go-srpm-macros
5c9d1ea
5c9d1ea
Recommends: grafana-cloudwatch = %{version}-%{release}
5c9d1ea
Recommends: grafana-elasticsearch = %{version}-%{release}
5c9d1ea
Recommends: grafana-azure-monitor = %{version}-%{release}
5c9d1ea
Recommends: grafana-graphite = %{version}-%{release}
5c9d1ea
Recommends: grafana-influxdb = %{version}-%{release}
5c9d1ea
Recommends: grafana-loki = %{version}-%{release}
5c9d1ea
Recommends: grafana-mssql = %{version}-%{release}
5c9d1ea
Recommends: grafana-mysql = %{version}-%{release}
5c9d1ea
Recommends: grafana-opentsdb = %{version}-%{release}
5c9d1ea
Recommends: grafana-postgres = %{version}-%{release}
5c9d1ea
Recommends: grafana-prometheus = %{version}-%{release}
5c9d1ea
Recommends: grafana-stackdriver = %{version}-%{release}
47a36c9
Recommends: grafana-pcp
5c9d1ea
5c9d1ea
%if 0%{?unbundle_vendor_sources}
1f64cbe
# golang build deps. These allow us to unbundle vendor golang source.
1f64cbe
BuildRequires: golang(github.com/aws/aws-sdk-go)
1f64cbe
BuildRequires: golang(github.com/benbjohnson/clock)
1f64cbe
BuildRequires: golang(github.com/beorn7/perks/quantile)
1f64cbe
BuildRequires: golang(github.com/bmizerany/assert)
1f64cbe
BuildRequires: golang(github.com/bradfitz/gomemcache/memcache)
1f64cbe
BuildRequires: golang(github.com/BurntSushi/toml)
1f64cbe
BuildRequires: golang(github.com/codahale/hdrhistogram)
1f64cbe
BuildRequires: golang(github.com/codegangsta/cli)
1f64cbe
BuildRequires: golang(github.com/davecgh/go-spew/spew)
1f64cbe
BuildRequires: golang(github.com/denisenkom/go-mssqldb)
1f64cbe
BuildRequires: golang(github.com/facebookgo/inject)
1f64cbe
BuildRequires: golang(github.com/facebookgo/structtag)
1f64cbe
BuildRequires: golang(github.com/fatih/color)
1f64cbe
BuildRequires: golang(github.com/go-ini/ini)
1f64cbe
BuildRequires: golang(google.golang.org/appengine)
1f64cbe
BuildRequires: golang(golang.org/x/sys/unix)
1f64cbe
BuildRequires: golang(github.com/go-macaron/binding)
1f64cbe
BuildRequires: golang(github.com/go-macaron/gzip)
1f64cbe
BuildRequires: golang(github.com/go-macaron/inject)
1f64cbe
BuildRequires: golang(github.com/go-macaron/session)
1f64cbe
BuildRequires: golang(google.golang.org/genproto/googleapis/rpc/status)
428ba58
BuildRequires: golang(github.com/gobwas/glob)
428ba58
BuildRequires: golang(github.com/gobwas/glob/compiler)
428ba58
BuildRequires: golang(github.com/gobwas/glob/match)
428ba58
BuildRequires: golang(github.com/gobwas/glob/syntax)
428ba58
BuildRequires: golang(github.com/gobwas/glob/syntax/ast)
428ba58
BuildRequires: golang(github.com/gobwas/glob/syntax/lexer)
428ba58
BuildRequires: golang(github.com/gobwas/glob/util/runes)
428ba58
BuildRequires: golang(github.com/gobwas/glob/util/strings)
1f64cbe
BuildRequires: golang(github.com/gopherjs/gopherjs/js)
1f64cbe
BuildRequires: golang(github.com/gorilla/websocket)
1f64cbe
BuildRequires: golang(github.com/gosimple/slug)
1f64cbe
BuildRequires: golang(github.com/go-sql-driver/mysql)
1f64cbe
BuildRequires: golang(github.com/go-stack/stack)
1f64cbe
BuildRequires: golang(github.com/go-xorm/builder)
1f64cbe
BuildRequires: golang(github.com/go-xorm/core)
1f64cbe
BuildRequires: golang(github.com/go-xorm/xorm)
1f64cbe
BuildRequires: golang(google.golang.org/grpc)
1f64cbe
BuildRequires: golang(github.com/hashicorp/go-hclog)
1f64cbe
# need grpc_broker in go-plugin >= 1.0.0-1
1f64cbe
BuildRequires: golang(github.com/hashicorp/go-plugin)
1f64cbe
BuildRequires: golang(github.com/hashicorp/go-version)
1f64cbe
BuildRequires: golang(github.com/hashicorp/yamux)
1f64cbe
BuildRequires: golang(github.com/inconshreveable/log15)
1f64cbe
BuildRequires: golang(github.com/jmespath/go-jmespath)
1f64cbe
BuildRequires: golang(github.com/jtolds/gls)
1f64cbe
BuildRequires: golang(github.com/klauspost/compress/flate)
1f64cbe
BuildRequires: golang(github.com/klauspost/compress/gzip)
1f64cbe
BuildRequires: golang(github.com/klauspost/compress/snappy)
1f64cbe
BuildRequires: golang(github.com/klauspost/cpuid)
1f64cbe
BuildRequires: golang(github.com/klauspost/crc32)
1f64cbe
BuildRequires: golang(github.com/kr/pretty)
1f64cbe
BuildRequires: golang(github.com/kr/text)
1f64cbe
BuildRequires: golang(github.com/lib/pq)
1f64cbe
BuildRequires: golang(github.com/mattn/go-colorable)
1f64cbe
BuildRequires: golang(github.com/mattn/go-isatty)
1f64cbe
BuildRequires: golang(github.com/mattn/go-sqlite3)
1f64cbe
BuildRequires: golang(github.com/matttproud/golang_protobuf_extensions/pbutil)
1f64cbe
BuildRequires: golang(github.com/mitchellh/go-testing-interface)
1f64cbe
BuildRequires: golang(github.com/oklog/run)
1f64cbe
BuildRequires: golang(github.com/opentracing/opentracing-go)
1f64cbe
BuildRequires: golang(github.com/patrickmn/go-cache)
1f64cbe
BuildRequires: golang(github.com/pkg/errors)
1f64cbe
BuildRequires: golang(github.com/prometheus/client_golang/api)
1f64cbe
BuildRequires: golang(github.com/prometheus/client_golang/api/prometheus/v1)
1f64cbe
BuildRequires: golang(github.com/prometheus/client_model/go)
1f64cbe
BuildRequires: golang-github-prometheus-common-devel
1f64cbe
BuildRequires: golang(github.com/prometheus/common/expfmt)
1f64cbe
BuildRequires: golang(github.com/prometheus/common/model)
1f64cbe
BuildRequires: golang(github.com/prometheus/common/expfmt)
1f64cbe
BuildRequires: golang(github.com/prometheus/procfs)
1f64cbe
BuildRequires: golang(github.com/prometheus/procfs/internal/util)
1f64cbe
BuildRequires: golang(github.com/prometheus/procfs)
1f64cbe
BuildRequires: golang(github.com/prometheus/procfs/internal/util)
1f64cbe
BuildRequires: golang(github.com/prometheus/procfs/nfs)
1f64cbe
BuildRequires: golang(github.com/prometheus/procfs/xfs)
1f64cbe
BuildRequires: golang(github.com/rainycape/unidecode)
1f64cbe
BuildRequires: golang(github.com/sergi/go-diff/diffmatchpatch)
1f64cbe
BuildRequires: golang(github.com/smartystreets/assertions)
1f64cbe
BuildRequires: golang(github.com/smartystreets/goconvey/convey)
1f64cbe
BuildRequires: golang(github.com/smartystreets/goconvey/convey/gotest)
1f64cbe
BuildRequires: golang(github.com/smartystreets/goconvey/convey/reporting)
1f64cbe
BuildRequires: golang(github.com/teris-io/shortid)
1f64cbe
BuildRequires: golang(github.com/Unknwon/com)
1f64cbe
BuildRequires: golang(github.com/VividCortex/mysqlerr)
1f64cbe
BuildRequires: golang(github.com/yudai/gojsondiff)
1f64cbe
BuildRequires: golang(github.com/yudai/golcs)
1f64cbe
BuildRequires: golang(golang.org/x/crypto/pbkdf2)
1f64cbe
BuildRequires: golang(golang.org/x/crypto/ed25519)
1f64cbe
BuildRequires: golang(golang.org/x/crypto/md4)
1f64cbe
BuildRequires: golang(golang.org/x/net/context)
1f64cbe
BuildRequires: golang(golang.org/x/net/context/ctxhttp)
1f64cbe
BuildRequires: golang(golang.org/x/net/http2)
1f64cbe
BuildRequires: golang(golang.org/x/net/http2/hpack)
1f64cbe
BuildRequires: golang(golang.org/x/net/http/httpguts)
1f64cbe
BuildRequires: golang(golang.org/x/net/idna)
1f64cbe
BuildRequires: golang(golang.org/x/net/internal/timeseries)
1f64cbe
BuildRequires: golang(golang.org/x/net/trace)
1f64cbe
BuildRequires: golang(golang.org/x/text/collate)
1f64cbe
BuildRequires: golang(golang.org/x/text/collate/build)
1f64cbe
BuildRequires: golang(golang.org/x/text/internal/colltab)
1f64cbe
BuildRequires: golang(golang.org/x/text/internal/gen)
1f64cbe
BuildRequires: golang(golang.org/x/text/internal/tag)
1f64cbe
BuildRequires: golang(golang.org/x/text/internal/triegen)
1f64cbe
BuildRequires: golang(golang.org/x/text/internal/ucd)
1f64cbe
BuildRequires: golang(golang.org/x/oauth2)
1f64cbe
BuildRequires: golang(golang.org/x/oauth2/google)
1f64cbe
BuildRequires: golang(golang.org/x/oauth2/internal)
1f64cbe
BuildRequires: golang(golang.org/x/oauth2/jws)
1f64cbe
BuildRequires: golang(golang.org/x/oauth2/jwt)
1f64cbe
BuildRequires: golang(github.com/golang/protobuf/proto)
1f64cbe
BuildRequires: golang(github.com/golang/protobuf/ptypes)
1f64cbe
BuildRequires: golang(github.com/golang/protobuf/ptypes)
1f64cbe
BuildRequires: golang(github.com/golang/protobuf/ptypes/duration)
1f64cbe
BuildRequires: golang(github.com/golang/protobuf/ptypes/any)
1f64cbe
BuildRequires: golang(github.com/golang/protobuf/ptypes/timestamp)
1f64cbe
BuildRequires: golang(cloud.google.com/go/compute/metadata)
1f64cbe
BuildRequires: golang(gopkg.in/alexcesaro/quotedprintable.v3)
1f64cbe
BuildRequires: golang(gopkg.in/asn1-ber.v1)
1f64cbe
BuildRequires: golang(github.com/go-bufio/bufio)
1f64cbe
BuildRequires: golang(github.com/go-ini/ini)
1f64cbe
BuildRequires: golang(github.com/go-macaron/macaron)
1f64cbe
BuildRequires: golang(github.com/go-redis/redis)
1f64cbe
BuildRequires: golang(gopkg.in/square/go-jose.v2)
1f64cbe
BuildRequires: golang(gopkg.in/square/go-jose.v2/cipher)
1f64cbe
BuildRequires: golang(gopkg.in/square/go-jose.v2/json)
25db04d
%if 0%{fedora} >= 31
25db04d
BuildRequires: golang(gopkg.in/yaml.v2)
25db04d
%else
1f64cbe
BuildRequires: golang(github.com/go-yaml/yaml)
25db04d
%endif
1f64cbe
BuildRequires: golang(golang.org/x/sync/errgroup)
1f64cbe
BuildRequires: golang(gopkg.in/ldap.v3)
1f64cbe
BuildRequires: golang(gopkg.in/mail.v2)
25db04d
BuildRequires: golang(github.com/jonboulle/clockwork)
5c9d1ea
%endif
1f64cbe
1f64cbe
# Declare all nodejs modules bundled in the webpack - this is for security
1f64cbe
# purposes so if nodejs-foo ever needs an update, affected packages can be
1f64cbe
# easily identified. This is generated from package-lock.json once the webpack
1f64cbe
# has been built with make_webpack.sh.
1f64cbe
Provides: bundled(nodejs-abbrev) = 1.1.1
1f64cbe
Provides: bundled(nodejs-ansi-regex) = 2.1.1
1f64cbe
Provides: bundled(nodejs-ansi-styles) = 2.2.1
1f64cbe
Provides: bundled(nodejs-argparse) = 1.0.10
1f64cbe
Provides: bundled(nodejs-array-find-index) = 1.0.2
1f64cbe
Provides: bundled(nodejs-async) = 1.5.2
1f64cbe
Provides: bundled(nodejs-balanced-match) = 1.0.0
1f64cbe
Provides: bundled(nodejs-brace-expansion) = 1.1.11
1f64cbe
Provides: bundled(nodejs-builtin-modules) = 1.1.1
1f64cbe
Provides: bundled(nodejs-camelcase) = 2.1.1
1f64cbe
Provides: bundled(nodejs-camelcase-keys) = 2.1.0
1f64cbe
Provides: bundled(nodejs-chalk) = 1.1.3
1f64cbe
Provides: bundled(nodejs-coffee-script) = 1.10.0
1f64cbe
Provides: bundled(nodejs-colors) = 1.1.2
1f64cbe
Provides: bundled(nodejs-concat-map) = 0.0.1
1f64cbe
Provides: bundled(nodejs-currently-unhandled) = 0.4.1
1f64cbe
Provides: bundled(nodejs-dateformat) = 1.0.12
1f64cbe
Provides: bundled(nodejs-decamelize) = 1.2.0
1f64cbe
Provides: bundled(nodejs-error-ex) = 1.3.2
1f64cbe
Provides: bundled(nodejs-escape-string-regexp) = 1.0.5
1f64cbe
Provides: bundled(nodejs-esprima) = 2.7.3
1f64cbe
Provides: bundled(nodejs-eventemitter2) = 0.4.14
1f64cbe
Provides: bundled(nodejs-exit) = 0.1.2
1f64cbe
Provides: bundled(nodejs-find-up) = 1.1.2
1f64cbe
Provides: bundled(nodejs-findup-sync) = 0.3.0
1f64cbe
Provides: bundled(nodejs-fs.realpath) = 1.0.0
1f64cbe
Provides: bundled(nodejs-get-stdin) = 4.0.1
1f64cbe
Provides: bundled(nodejs-getobject) = 0.1.0
1f64cbe
Provides: bundled(nodejs-glob) = 7.0.6
1f64cbe
Provides: bundled(nodejs-graceful-fs) = 4.1.15
1f64cbe
Provides: bundled(nodejs-grunt) = 1.0.1
1f64cbe
Provides: bundled(nodejs-grunt-cli) = 1.2.0
1f64cbe
Provides: bundled(nodejs-grunt-known-options) = 1.1.1
1f64cbe
Provides: bundled(nodejs-grunt-legacy-log) = 1.0.2
1f64cbe
Provides: bundled(nodejs-lodash) = 4.17.11
1f64cbe
Provides: bundled(nodejs-grunt-legacy-log-utils) = 1.0.0
1f64cbe
Provides: bundled(nodejs-grunt-legacy-util) = 1.0.0
1f64cbe
Provides: bundled(nodejs-has-ansi) = 2.0.0
1f64cbe
Provides: bundled(nodejs-hooker) = 0.2.3
1f64cbe
Provides: bundled(nodejs-hosted-git-info) = 2.7.1
1f64cbe
Provides: bundled(nodejs-iconv-lite) = 0.4.24
1f64cbe
Provides: bundled(nodejs-indent-string) = 2.1.0
1f64cbe
Provides: bundled(nodejs-inflight) = 1.0.6
1f64cbe
Provides: bundled(nodejs-inherits) = 2.0.3
1f64cbe
Provides: bundled(nodejs-is-arrayish) = 0.2.1
1f64cbe
Provides: bundled(nodejs-is-builtin-module) = 1.0.0
1f64cbe
Provides: bundled(nodejs-is-finite) = 1.0.2
1f64cbe
Provides: bundled(nodejs-is-utf8) = 0.2.1
1f64cbe
Provides: bundled(nodejs-isexe) = 2.0.0
1f64cbe
Provides: bundled(nodejs-js-yaml) = 3.5.5
1f64cbe
Provides: bundled(nodejs-load-json-file) = 1.1.0
1f64cbe
Provides: bundled(nodejs-loud-rejection) = 1.6.0
1f64cbe
Provides: bundled(nodejs-map-obj) = 1.0.1
1f64cbe
Provides: bundled(nodejs-meow) = 3.7.0
1f64cbe
Provides: bundled(nodejs-minimatch) = 3.0.4
1f64cbe
Provides: bundled(nodejs-minimist) = 1.2.0
1f64cbe
Provides: bundled(nodejs-nopt) = 3.0.6
1f64cbe
Provides: bundled(nodejs-normalize-package-data) = 2.4.2
1f64cbe
Provides: bundled(nodejs-number-is-nan) = 1.0.1
1f64cbe
Provides: bundled(nodejs-object-assign) = 4.1.1
1f64cbe
Provides: bundled(nodejs-once) = 1.4.0
1f64cbe
Provides: bundled(nodejs-parse-json) = 2.2.0
1f64cbe
Provides: bundled(nodejs-path-exists) = 2.1.0
1f64cbe
Provides: bundled(nodejs-path-is-absolute) = 1.0.1
1f64cbe
Provides: bundled(nodejs-path-type) = 1.1.0
1f64cbe
Provides: bundled(nodejs-pify) = 2.3.0
1f64cbe
Provides: bundled(nodejs-pinkie) = 2.0.4
1f64cbe
Provides: bundled(nodejs-pinkie-promise) = 2.0.1
1f64cbe
Provides: bundled(nodejs-read-pkg) = 1.1.0
1f64cbe
Provides: bundled(nodejs-read-pkg-up) = 1.0.1
1f64cbe
Provides: bundled(nodejs-redent) = 1.0.0
1f64cbe
Provides: bundled(nodejs-repeating) = 2.0.1
1f64cbe
Provides: bundled(nodejs-resolve) = 1.1.7
1f64cbe
Provides: bundled(nodejs-rimraf) = 2.2.8
1f64cbe
Provides: bundled(nodejs-safer-buffer) = 2.1.2
1f64cbe
Provides: bundled(nodejs-semver) = 5.6.0
1f64cbe
Provides: bundled(nodejs-signal-exit) = 3.0.2
1f64cbe
Provides: bundled(nodejs-spdx-correct) = 3.1.0
1f64cbe
Provides: bundled(nodejs-spdx-exceptions) = 2.2.0
1f64cbe
Provides: bundled(nodejs-spdx-expression-parse) = 3.0.0
1f64cbe
Provides: bundled(nodejs-spdx-license-ids) = 3.0.3
1f64cbe
Provides: bundled(nodejs-sprintf-js) = 1.0.3
1f64cbe
Provides: bundled(nodejs-strip-ansi) = 3.0.1
1f64cbe
Provides: bundled(nodejs-strip-bom) = 2.0.0
1f64cbe
Provides: bundled(nodejs-strip-indent) = 1.0.1
1f64cbe
Provides: bundled(nodejs-supports-color) = 2.0.0
1f64cbe
Provides: bundled(nodejs-trim-newlines) = 1.0.0
1f64cbe
Provides: bundled(nodejs-underscore.string) = 3.2.3
1f64cbe
Provides: bundled(nodejs-validate-npm-package-license) = 3.0.4
1f64cbe
Provides: bundled(nodejs-which) = 1.2.14
1f64cbe
Provides: bundled(nodejs-wrappy) = 1.0.2
1f64cbe
Provides: bundled(nodejs-yarn) = 1.13.0
1f64cbe
1f64cbe
1f64cbe
%description
1f64cbe
Grafana is an open source, feature rich metrics dashboard and graph editor for
1f64cbe
Graphite, InfluxDB & OpenTSDB.
1f64cbe
1f64cbe
5c9d1ea
%package cloudwatch
5c9d1ea
Requires: %{name} = %{version}-%{release}
5c9d1ea
Summary: Grafana cloudwatch datasource
5c9d1ea
5c9d1ea
%description cloudwatch
5c9d1ea
The Grafana cloudwatch datasource.
5c9d1ea
5c9d1ea
%package elasticsearch
5c9d1ea
Requires: %{name} = %{version}-%{release}
5c9d1ea
Summary: Grafana elasticsearch datasource
5c9d1ea
5c9d1ea
%description elasticsearch
5c9d1ea
The Grafana elasticsearch datasource.
5c9d1ea
5c9d1ea
%package azure-monitor
5c9d1ea
Requires: %{name} = %{version}-%{release}
5c9d1ea
Summary: Grafana azure-monitor datasource
5c9d1ea
5c9d1ea
%description azure-monitor
5c9d1ea
The Grafana azure-monitor datasource.
5c9d1ea
5c9d1ea
%package graphite
5c9d1ea
Requires: %{name} = %{version}-%{release}
5c9d1ea
Summary: Grafana graphite datasource
5c9d1ea
5c9d1ea
%description graphite
5c9d1ea
The Grafana graphite datasource.
5c9d1ea
5c9d1ea
%package influxdb
5c9d1ea
Requires: %{name} = %{version}-%{release}
5c9d1ea
Summary: Grafana influxdb datasource
5c9d1ea
5c9d1ea
%description influxdb
5c9d1ea
The Grafana influxdb datasource.
5c9d1ea
5c9d1ea
%package loki
5c9d1ea
Requires: %{name} = %{version}-%{release}
5c9d1ea
Summary: Grafana loki datasource
5c9d1ea
5c9d1ea
%description loki
5c9d1ea
The Grafana loki datasource.
5c9d1ea
5c9d1ea
%package mssql
5c9d1ea
Requires: %{name} = %{version}-%{release}
5c9d1ea
Summary: Grafana mssql datasource
5c9d1ea
5c9d1ea
%description mssql
5c9d1ea
The Grafana mssql datasource.
5c9d1ea
5c9d1ea
%package mysql
5c9d1ea
Requires: %{name} = %{version}-%{release}
5c9d1ea
Summary: Grafana mysql datasource
5c9d1ea
5c9d1ea
%description mysql
5c9d1ea
The Grafana mysql datasource.
5c9d1ea
5c9d1ea
%package opentsdb
5c9d1ea
Requires: %{name} = %{version}-%{release}
5c9d1ea
Summary: Grafana opentsdb datasource
5c9d1ea
5c9d1ea
%description opentsdb
5c9d1ea
The Grafana opentsdb datasource.
5c9d1ea
5c9d1ea
%package postgres
5c9d1ea
Requires: %{name} = %{version}-%{release}
5c9d1ea
Summary: Grafana postgres datasource
5c9d1ea
5c9d1ea
%description postgres
5c9d1ea
The Grafana postgres datasource.
5c9d1ea
5c9d1ea
%package prometheus
5c9d1ea
Requires: %{name} = %{version}-%{release}
5c9d1ea
Summary: Grafana prometheus datasource
5c9d1ea
5c9d1ea
%description prometheus
5c9d1ea
The Grafana prometheus datasource.
5c9d1ea
5c9d1ea
%package stackdriver
5c9d1ea
Requires: %{name} = %{version}-%{release}
5c9d1ea
Summary: Grafana stackdriver datasource
5c9d1ea
5c9d1ea
%description stackdriver
5c9d1ea
The Grafana stackdriver datasource.
5c9d1ea
5c9d1ea
1f64cbe
%prep
1f64cbe
%setup -q -T -D -b 0
1f64cbe
%setup -q -T -D -b 1
1f64cbe
%patch1 -p1
1f64cbe
%patch2 -p1
1f64cbe
%patch3 -p1
25db04d
%patch4 -p1
47a36c9
%patch5 -p1
1f64cbe
1f64cbe
# Set up build subdirs and links
1f64cbe
mkdir -p %{_builddir}/src/github.com/grafana
1f64cbe
ln -sf %{_builddir}/%{name}-%{version} \
1f64cbe
    %{_builddir}/src/github.com/grafana/grafana
1f64cbe
1f64cbe
# remove some (apparent) development files, for rpmlint
5c9d1ea
rm -f public/sass/.sass-lint.yml public/test/.jshintrc
1f64cbe
5c9d1ea
%if 0%{?unbundle_vendor_sources}
1f64cbe
# Unbundle all grafana vendor sources, as per BuildRequires above.
1f64cbe
# An exception is grafana-plugin-model, which is part of grafana.
25db04d
cp --parents -a vendor/github.com/grafana \
25db04d
    vendor/golang.org/x/xerrors \
25db04d
    vendor/github.com/robfig vendor/github.com/crewjam/saml \
25db04d
    vendor/github.com/ua-parser/uap-go/uaparser  \
25db04d
    vendor/github.com/beevik/etree \
25db04d
    vendor/github.com/russellhaering/goxmldsig \
25db04d
    %{_builddir}
1f64cbe
rm -r vendor # remove all vendor sources
1f64cbe
mv %{_builddir}/vendor vendor # put back what we're keeping
5c9d1ea
%endif
1f64cbe
1f64cbe
1f64cbe
%build
25db04d
# Build the server-side binaries
5c9d1ea
cd %{_builddir}/src/github.com/grafana/grafana
25db04d
%global archbindir bin/`go env GOOS`-`go env GOARCH`
25db04d
echo _builddir=%{_builddir} archbindir=%{archbindir}
25db04d
[ ! -d %{archbindir} ] && mkdir -p %{archbindir}
5c9d1ea
export GOPATH=%{_builddir}:%{gopath}
25db04d
# export GO111MODULE=off
25db04d
%if 0%{?fedora} >= 31
25db04d
# native fedora golang build but without modules (no grafana support yet)
25db04d
go build -mod=vendor -o %{archbindir}/grafana-cli ./pkg/cmd/grafana-cli
25db04d
go build -mod=vendor -o %{archbindir}/grafana-server ./pkg/cmd/grafana-server
25db04d
%else
25db04d
# use the grafana build.go script.
5c9d1ea
go run build.go build
5c9d1ea
%endif
1f64cbe
1f64cbe
1f64cbe
%install
5c9d1ea
# Fix up arch bin directories
5c9d1ea
[ ! -d bin/x86_64 ] && ln -sf linux-amd64 bin/x86_64
5c9d1ea
[ ! -d bin/i386 ] && ln -sf linux-386 bin/i386
5c9d1ea
[ ! -d bin/ppc64le ] && ln -sf linux-ppc64le bin/ppc64le
5c9d1ea
[ ! -d bin/s390x ] && ln -sf linux-s390x bin/s390x
5c9d1ea
[ ! -d bin/arm ] && ln -sf linux-arm bin/arm
5c9d1ea
[ ! -d bin/arm64 ] && ln -sf linux-arm64 bin/aarch64
5c9d1ea
[ ! -d bin/aarch64 ] && ln -sf linux-aarch64 bin/aarch64
5c9d1ea
25db04d
# dirs, shared files, public html, webpack
1f64cbe
install -d %{buildroot}%{_sbindir}
25db04d
install -d %{buildroot}%{_datadir}/%{name}/bin
1f64cbe
cp -a conf public %{buildroot}%{_datadir}/%{name}
1f64cbe
25db04d
# wrappers
25db04d
install -p -m 755 packaging/wrappers/grafana-cli %{buildroot}%{_sbindir}/%{name}-cli
25db04d
25db04d
# binaries
25db04d
install -p -m 755 %{archbindir}/%{name}-server %{buildroot}%{_sbindir}
25db04d
install -p -m 755 %{archbindir}/%{name}-cli %{buildroot}%{_datadir}/%{name}/bin
25db04d
1f64cbe
# man pages
1f64cbe
install -d %{buildroot}%{_mandir}/man1
1f64cbe
install -p -m 644 docs/man/man1/* %{buildroot}%{_mandir}/man1
1f64cbe
1f64cbe
# config dirs
1f64cbe
install -d %{buildroot}%{_sysconfdir}/%{name}
1f64cbe
install -d %{buildroot}%{_sysconfdir}/sysconfig
1f64cbe
1f64cbe
# config defaults
1f64cbe
install -p -m 644 conf/distro-defaults.ini \
1f64cbe
    %{buildroot}%{_sysconfdir}/%{name}/grafana.ini
1f64cbe
install -p -m 644 conf/distro-defaults.ini \
1f64cbe
    %{buildroot}%{_datadir}/%{name}/conf/defaults.ini
1f64cbe
install -p -m 644 conf/ldap.toml %{buildroot}%{_sysconfdir}/%{name}/ldap.toml
1f64cbe
install -p -m 644 packaging/rpm/sysconfig/grafana-server \
1f64cbe
    %{buildroot}%{_sysconfdir}/sysconfig/grafana-server
1f64cbe
1f64cbe
# config database directory and plugins
1f64cbe
install -d %{buildroot}%{_sharedstatedir}/%{name}
1f64cbe
install -d -m 755 %{buildroot}%{_sharedstatedir}/%{name}
1f64cbe
install -d -m 755 %{buildroot}%{_sharedstatedir}/%{name}/plugins
1f64cbe
1f64cbe
# log directory
1f64cbe
install -d %{buildroot}%{_localstatedir}/log/%{name}
1f64cbe
1f64cbe
# systemd service files
1f64cbe
install -d %{buildroot}%{_unitdir} # only needed for manual rpmbuilds
1f64cbe
install -p -m 644 packaging/rpm/systemd/grafana-server.service \
1f64cbe
    %{buildroot}%{_unitdir}
1f64cbe
1f64cbe
# daemon run pid file config for using tmpfs
1f64cbe
install -d %{buildroot}%{_tmpfilesdir}
1f64cbe
echo "d %{_rundir}/%{name} 0755 %{GRAFANA_USER} %{GRAFANA_GROUP} -" \
1f64cbe
    > %{buildroot}%{_tmpfilesdir}/%{name}.conf
1f64cbe
1f64cbe
%pre
1f64cbe
getent group %{GRAFANA_GROUP} >/dev/null || groupadd -r %{GRAFANA_GROUP}
1f64cbe
getent passwd %{GRAFANA_USER} >/dev/null || \
1f64cbe
    useradd -r -g %{GRAFANA_GROUP} -d %{GRAFANA_HOME} -s /sbin/nologin \
1f64cbe
    -c "%{GRAFANA_USER} user account" %{GRAFANA_USER}
1f64cbe
exit 0
1f64cbe
1f64cbe
%preun
1f64cbe
%systemd_preun grafana-server.service
1f64cbe
1f64cbe
%post
1f64cbe
%systemd_post grafana-server.service
1f64cbe
1f64cbe
%postun
1f64cbe
%systemd_postun_with_restart grafana-server.service
1f64cbe
1f64cbe
1f64cbe
%check
1f64cbe
cd %{_builddir}/src/github.com/grafana/grafana
1f64cbe
export GOPATH=%{_builddir}:%{gopath}
5c9d1ea
# remove tests currently failing
1f64cbe
rm -f pkg/services/provisioning/dashboards/file_reader_linux_test.go
5c9d1ea
rm -f pkg/services/provisioning/dashboards/file_reader_test.go
5c9d1ea
rm -f pkg/services/sqlstore/alert_test.go
25db04d
rm -f pkg/services/sqlstore/apikey_test.go
25db04d
export GO111MODULE=off
1f64cbe
go test ./pkg/...
1f64cbe
1f64cbe
1f64cbe
%files
1f64cbe
# binaries
1f64cbe
%{_sbindir}/%{name}-server
1f64cbe
%{_sbindir}/%{name}-cli
1f64cbe
1f64cbe
# config files
1f64cbe
%dir %{_sysconfdir}/%{name}
1f64cbe
%config(noreplace) %attr(644, root, %{GRAFANA_GROUP}) %{_sysconfdir}/%{name}/grafana.ini
1f64cbe
%config(noreplace) %attr(644, root, %{GRAFANA_GROUP}) %{_sysconfdir}/%{name}/ldap.toml
1f64cbe
%config(noreplace) %{_sysconfdir}/sysconfig/grafana-server
1f64cbe
1f64cbe
# Grafana configuration to dynamically create /run/grafana/grafana.pid on tmpfs
1f64cbe
%{_tmpfilesdir}/%{name}.conf
1f64cbe
1f64cbe
# config database directory and plugins (actual db files are created by grafana-server)
1f64cbe
%attr(-, %{GRAFANA_USER}, %{GRAFANA_GROUP}) %dir %{_sharedstatedir}/%{name}
1f64cbe
%attr(-, %{GRAFANA_USER}, %{GRAFANA_GROUP}) %dir %{_sharedstatedir}/%{name}/plugins
1f64cbe
5c9d1ea
# shared directory and all files therein, except some datasources
25db04d
%{_datadir}/%{name}/bin
1f64cbe
%{_datadir}/%{name}/public
5c9d1ea
5c9d1ea
# built-in datasources that are sub-packaged
5c9d1ea
%global dsdir %{_datadir}/%{name}/public/app/plugins/datasource
5c9d1ea
%exclude %{dsdir}/cloudwatch 
5c9d1ea
%exclude %{dsdir}/elasticsearch 
5c9d1ea
%exclude %{dsdir}/graphite
5c9d1ea
%exclude %{dsdir}/grafana-azure-monitor-datasource
5c9d1ea
%exclude %{dsdir}/influxdb
5c9d1ea
%exclude %{dsdir}/loki
5c9d1ea
%exclude %{dsdir}/mssql
5c9d1ea
%exclude %{dsdir}/mysql
5c9d1ea
%exclude %{dsdir}/opentsdb
5c9d1ea
%exclude %{dsdir}/postgres
5c9d1ea
%exclude %{dsdir}/prometheus
5c9d1ea
%exclude %{dsdir}/stackdriver
5c9d1ea
1f64cbe
%dir %{_datadir}/%{name}/conf
1f64cbe
%attr(-, root, %{GRAFANA_GROUP}) %{_datadir}/%{name}/conf/*
1f64cbe
1f64cbe
# systemd service file
1f64cbe
%{_unitdir}/grafana-server.service
1f64cbe
1f64cbe
# log directory - grafana.log is created by grafana-server, and it does it's own log rotation
1f64cbe
%attr(0755, %{GRAFANA_USER}, %{GRAFANA_GROUP}) %dir %{_localstatedir}/log/%{name}
1f64cbe
1f64cbe
# man pages for grafana binaries
1f64cbe
%{_mandir}/man1/%{name}-server.1*
1f64cbe
%{_mandir}/man1/%{name}-cli.1*
1f64cbe
1f64cbe
# other docs and license
1f64cbe
%license LICENSE
1f64cbe
%doc CHANGELOG.md CODE_OF_CONDUCT.md CONTRIBUTING.md NOTICE.md
1f64cbe
%doc PLUGIN_DEV.md README.md ROADMAP.md UPGRADING_DEPENDENCIES.md
1f64cbe
5c9d1ea
#
5c9d1ea
# datasources split out into subpackages
5c9d1ea
#
5c9d1ea
%files cloudwatch
5c9d1ea
%{_datadir}/%{name}/public/app/plugins/datasource/cloudwatch
5c9d1ea
5c9d1ea
%files elasticsearch
5c9d1ea
%{_datadir}/%{name}/public/app/plugins/datasource/elasticsearch
5c9d1ea
5c9d1ea
%files azure-monitor
5c9d1ea
%{_datadir}/%{name}/public/app/plugins/datasource/grafana-azure-monitor-datasource
5c9d1ea
5c9d1ea
%files graphite
5c9d1ea
%{_datadir}/%{name}/public/app/plugins/datasource/graphite
5c9d1ea
5c9d1ea
%files influxdb
5c9d1ea
%{_datadir}/%{name}/public/app/plugins/datasource/influxdb
5c9d1ea
5c9d1ea
%files loki
5c9d1ea
%{_datadir}/%{name}/public/app/plugins/datasource/loki
5c9d1ea
5c9d1ea
%files mssql
5c9d1ea
%{_datadir}/%{name}/public/app/plugins/datasource/mssql
5c9d1ea
5c9d1ea
%files mysql
5c9d1ea
%{_datadir}/%{name}/public/app/plugins/datasource/mysql
5c9d1ea
5c9d1ea
%files opentsdb
5c9d1ea
%{_datadir}/%{name}/public/app/plugins/datasource/opentsdb
5c9d1ea
5c9d1ea
%files postgres
5c9d1ea
%{_datadir}/%{name}/public/app/plugins/datasource/postgres
5c9d1ea
5c9d1ea
%files prometheus
5c9d1ea
%{_datadir}/%{name}/public/app/plugins/datasource/prometheus
5c9d1ea
5c9d1ea
%files stackdriver
5c9d1ea
%{_datadir}/%{name}/public/app/plugins/datasource/stackdriver
5c9d1ea
1f64cbe
1f64cbe
%changelog
47a36c9
* Wed Nov 20 2019 Mark Goodwin <mgoodwin@redhat.com> 6.3.6-1
47a36c9
- add weak depenency on grafana-pcp
47a36c9
- add patch to mute shellcheck SC1090 for grafana-cli
47a36c9
- update to 6.3.6 upstream community sources, see CHANGELOG
47a36c9
25db04d
* Thu Sep 05 2019 Mark Goodwin <mgoodwin@redhat.com> 6.3.5-1
25db04d
- drop uaparser patch now it's upstream
25db04d
- add xerrors patch, see https://github.com/golang/go/issues/32246
25db04d
- use vendor sources on rawhide until modules are fully supported
25db04d
- update to latest upstream community sources, see CHANGELOG
25db04d
25db04d
* Fri Aug 30 2019 Mark Goodwin <mgoodwin@redhat.com> 6.3.4-1
25db04d
- include fix for CVE-2019-15043
25db04d
- add patch for uaparser on 32bit systems
25db04d
- update to latest upstream community sources, see CHANGELOG
25db04d
25db04d
* Wed Jul 31 2019 Mark Goodwin <mgoodwin@redhat.com> 6.2.5-1
25db04d
- update to latest upstream community sources, see CHANGELOG
25db04d
7c9a565
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 6.2.2-2
7c9a565
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
7c9a565
5c9d1ea
* Fri Jun 07 2019 Mark Goodwin <mgoodwin@redhat.com> 6.2.2-1
5c9d1ea
- split out some datasource plugins to sub-packages
5c9d1ea
- update to latest upstream community sources, see CHANGELOG
5c9d1ea
5c9d1ea
* Wed Jun 05 2019 Mark Goodwin <mgoodwin@redhat.com> 6.2.1-1
5c9d1ea
- update to latest upstream community sources, see CHANGELOG
5c9d1ea
5c9d1ea
* Fri May 24 2019 Mark Goodwin <mgoodwin@redhat.com> 6.2.0-1
5c9d1ea
- update to latest upstream community sources
5c9d1ea
- drop a couple of patches
5c9d1ea
5c9d1ea
* Wed May 08 2019 Mark Goodwin <mgoodwin@redhat.com> 6.1.6-2
5c9d1ea
- add conditional unbundle_vendor_sources macro
5c9d1ea
428ba58
* Tue Apr 30 2019 Mark Goodwin <mgoodwin@redhat.com> 6.1.6-1
428ba58
- update to latest upstream stable release 6.1.6, see CHANGELOG
428ba58
- includes jQuery 3.4.0 security update
428ba58
1f64cbe
* Wed Apr 24 2019 Mark Goodwin <mgoodwin@redhat.com> 6.1.4-1
1f64cbe
- update to latest upstream stable release 6.1.4, see CHANGELOG
1f64cbe
- use gobuild and gochecks macros, eliminate arch symlinks
1f64cbe
- re-enable grafana-debugsource package
1f64cbe
- fix GRAFANA_GROUP typo
1f64cbe
- fix more modes for brp-mangle-shebangs
1f64cbe
- vendor source unbundling now done in prep after patches
1f64cbe
- remove all rhel and fedora conditional guff
1f64cbe
1f64cbe
* Tue Apr 16 2019 Mark Goodwin <mgoodwin@redhat.com> 6.1.3-1
1f64cbe
- update to latest upstream stable release 6.1.3, see CHANGELOG
1f64cbe
- unbundle all vendor sources, replace with BuildRequires, see
1f64cbe
  the long list of blocker BZs linked to BZ#1670656
1f64cbe
- BuildRequires go-plugin >= v1.0.0 for grpc_broker (thanks eclipseo)
1f64cbe
- tweak make_webpack to no longer use grunt, switch to prod build
1f64cbe
- add ExclusiveArch lua script (thanks quantum.analyst)
1f64cbe
- move db directory and plugins to /var/lib/grafana
1f64cbe
- split out into 6 patches, ready for upstream PRs
1f64cbe
- add check to run go tests for gating checks
1f64cbe
1f64cbe
* Thu Apr 04 2019 Mark Goodwin <mgoodwin@redhat.com> 6.1.0-1
1f64cbe
- update to latest upstream stable release 6.1.0, see CHANGELOG
1f64cbe
1f64cbe
* Thu Mar 21 2019 Mark Goodwin <mgoodwin@redhat.com> 6.0.2-1
1f64cbe
- bump to latest upstream stable release 6.0.2-1
1f64cbe
- unbundle almost all remaining vendor code, see linked blockers in BZ#1670656
1f64cbe
1f64cbe
* Fri Mar 15 2019 Mark Goodwin <mgoodwin@redhat.com> 6.0.1-3
1f64cbe
- bump to latest upstream stable release 6.0.1-1
1f64cbe
1f64cbe
* Thu Mar 14 2019 Mark Goodwin <mgoodwin@redhat.com> 6.0.1-2
1f64cbe
- unbundle and add BuildRequires for golang-github-rainycape-unidecode-devel
1f64cbe
1f64cbe
* Thu Mar 07 2019 Mark Goodwin <mgoodwin@redhat.com> 6.0.1-1
1f64cbe
- update to v6.0.1 upstream sources, tweak distro config, re-do patch
1f64cbe
- simplify make_webpack.sh script (Elliott Sales de Andrade)
1f64cbe
- vendor/github.com/go-ldap is now gone, so don't unbundle it
1f64cbe
1f64cbe
* Thu Mar 07 2019 Mark Goodwin <mgoodwin@redhat.com> 5.4.3-11
1f64cbe
- tweak after latest feedback, bump to 5.4.3-11 (BZ 1670656)
1f64cbe
- build debuginfo package again
1f64cbe
- unbundle BuildRequires for golang-github-hashicorp-version-devel
1f64cbe
- remove some unneeded development files
1f64cbe
- remove macros from changelog and other rpmlint tweaks
1f64cbe
1f64cbe
* Fri Feb 22 2019 Mark Goodwin <mgoodwin@redhat.com> 5.4.3-10
1f64cbe
- tweak spec for available and unavailable (bundled) golang packages
1f64cbe
1f64cbe
* Wed Feb 20 2019 Xavier Bachelot <xavier@bachelot.org> 5.4.3-9
1f64cbe
- Remove extraneous slash (cosmetic)
1f64cbe
- Create directories just before moving stuff in them
1f64cbe
- Truncate long lines
1f64cbe
- Group all golang stuff
1f64cbe
- Simplify BuildRequires/bundled Provides
1f64cbe
- Sort BuildRequires/bundled Provides
1f64cbe
- Fix bundled go packages Provides
1f64cbe
1f64cbe
* Fri Feb 15 2019 Mark Goodwin <mgoodwin@redhat.com> 5.4.3-8
1f64cbe
- add BuildRequires (and unbundle) vendor sources available in Fedora
1f64cbe
- declare Provides for remaining (bundled) vendor go sources
1f64cbe
- do not attempt to unbundle anything on RHEL < 7 or Fedora < 28
1f64cbe
1f64cbe
* Thu Feb 07 2019 Mark Goodwin <mgoodwin@redhat.com> 5.4.3-7
1f64cbe
- further refinement for spec doc section from Xavier Bachelot
1f64cbe
- disable debug_package to avoid empty debugsourcefiles.list
1f64cbe
1f64cbe
* Wed Feb 06 2019 Mark Goodwin <mgoodwin@redhat.com> 5.4.3-6
1f64cbe
- further refinement following review by Xavier Bachelot
1f64cbe
1f64cbe
* Tue Feb 05 2019 Mark Goodwin <mgoodwin@redhat.com> 5.4.3-5
1f64cbe
- further refinement following review by Xavier Bachelot
1f64cbe
1f64cbe
* Fri Feb 01 2019 Mark Goodwin <mgoodwin@redhat.com> 5.4.3-4
1f64cbe
- further spec updates after packaging review
1f64cbe
- reworked post-install scriplets
1f64cbe
1f64cbe
* Thu Jan 31 2019 Mark Goodwin <mgoodwin@redhat.com> 5.4.3-3
1f64cbe
- tweak FHS patch, update spec after packaging review
1f64cbe
1f64cbe
* Wed Jan 30 2019 Mark Goodwin <mgoodwin@redhat.com> 5.4.3-2
1f64cbe
- add patch to be standard FHS compliant, remove phantomjs
1f64cbe
- update to v5.4.3 upstream community sources
1f64cbe
1f64cbe
* Wed Jan 09 2019 Mark Goodwin <mgoodwin@redhat.com> 5.4.2-1
1f64cbe
- update to v5.4.2 upstream community sources
1f64cbe
1f64cbe
* Thu Oct 18 2018 Mark Goodwin <mgoodwin@redhat.com> 5.3.1-1
1f64cbe
- update to v5.3.1 upstream community sources
1f64cbe
1f64cbe
* Tue Oct 02 2018 Mark Goodwin <mgoodwin@redhat.com> 5.2.5-1
1f64cbe
- native RPM spec build with current tagged v5.2.5 sources