diff --git a/.gitignore b/.gitignore index 15693e5..015c8fd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,2 @@ /grafana-*.tar.gz -/grafana-*.tar.gz.manifest -/grafana-*/ +/grafana_webpack-*.tar.gz diff --git a/001-login-oauth-use-oauth2-exchange.patch b/001-login-oauth-use-oauth2-exchange.patch new file mode 100644 index 0000000..f6dff49 --- /dev/null +++ b/001-login-oauth-use-oauth2-exchange.patch @@ -0,0 +1,13 @@ +diff --git a/pkg/api/login_oauth.go b/pkg/api/login_oauth.go +index c8c9f05b33..1b5a67aec2 100644 +--- a/pkg/api/login_oauth.go ++++ b/pkg/api/login_oauth.go +@@ -134,7 +134,7 @@ func (hs *HTTPServer) OAuthLogin(ctx *m.ReqContext) { + oauthCtx := context.WithValue(context.Background(), oauth2.HTTPClient, oauthClient) + + // get token from provider +- token, err := connect.Exchange(oauthCtx, code) ++ token, err := connect.Exchange(oauthCtx, code, oauth2.AccessTypeOnline) + if err != nil { + ctx.Handle(500, "login.OAuthLogin(NewTransportWithCode)", err) + return diff --git a/002-remove-jaeger-tracing.patch b/002-remove-jaeger-tracing.patch new file mode 100644 index 0000000..e6fae49 --- /dev/null +++ b/002-remove-jaeger-tracing.patch @@ -0,0 +1,279 @@ +diff --git a/pkg/cmd/grafana-server/server.go b/pkg/cmd/grafana-server/server.go +index 0dace4ebab..f1a4bfde53 100644 +--- a/pkg/cmd/grafana-server/server.go ++++ b/pkg/cmd/grafana-server/server.go +@@ -23,7 +23,6 @@ import ( + _ "github.com/grafana/grafana/pkg/infra/metrics" + _ "github.com/grafana/grafana/pkg/infra/remotecache" + _ "github.com/grafana/grafana/pkg/infra/serverlock" +- _ "github.com/grafana/grafana/pkg/infra/tracing" + _ "github.com/grafana/grafana/pkg/infra/usagestats" + "github.com/grafana/grafana/pkg/login" + "github.com/grafana/grafana/pkg/login/social" +diff --git a/pkg/infra/tracing/tracing.go b/pkg/infra/tracing/tracing.go +deleted file mode 100644 +index 923459786b..0000000000 +--- a/pkg/infra/tracing/tracing.go ++++ /dev/null +@@ -1,161 +0,0 @@ +-package tracing +- +-import ( +- "context" +- "fmt" +- "io" +- "strings" +- +- "github.com/grafana/grafana/pkg/infra/log" +- "github.com/grafana/grafana/pkg/registry" +- "github.com/grafana/grafana/pkg/setting" +- +- opentracing "github.com/opentracing/opentracing-go" +- jaegercfg "github.com/uber/jaeger-client-go/config" +- "github.com/uber/jaeger-client-go/zipkin" +-) +- +-func init() { +- registry.RegisterService(&TracingService{}) +-} +- +-type TracingService struct { +- enabled bool +- address string +- customTags map[string]string +- samplerType string +- samplerParam float64 +- log log.Logger +- closer io.Closer +- zipkinPropagation bool +- disableSharedZipkinSpans bool +- +- Cfg *setting.Cfg `inject:""` +-} +- +-func (ts *TracingService) Init() error { +- ts.log = log.New("tracing") +- ts.parseSettings() +- +- if ts.enabled { +- return ts.initGlobalTracer() +- } +- +- return nil +-} +- +-func (ts *TracingService) parseSettings() { +- var section, err = ts.Cfg.Raw.GetSection("tracing.jaeger") +- if err != nil { +- return +- } +- +- ts.address = section.Key("address").MustString("") +- if ts.address != "" { +- ts.enabled = true +- } +- +- ts.customTags = splitTagSettings(section.Key("always_included_tag").MustString("")) +- ts.samplerType = section.Key("sampler_type").MustString("") +- ts.samplerParam = section.Key("sampler_param").MustFloat64(1) +- ts.zipkinPropagation = section.Key("zipkin_propagation").MustBool(false) +- ts.disableSharedZipkinSpans = section.Key("disable_shared_zipkin_spans").MustBool(false) +-} +- +-func (ts *TracingService) initJaegerCfg() (jaegercfg.Configuration, error) { +- cfg := jaegercfg.Configuration{ +- ServiceName: "grafana", +- Disabled: !ts.enabled, +- Sampler: &jaegercfg.SamplerConfig{ +- Type: ts.samplerType, +- Param: ts.samplerParam, +- }, +- Reporter: &jaegercfg.ReporterConfig{ +- LogSpans: false, +- LocalAgentHostPort: ts.address, +- }, +- } +- +- _, err := cfg.FromEnv() +- if err != nil { +- return cfg, err +- } +- return cfg, nil +-} +- +-func (ts *TracingService) initGlobalTracer() error { +- cfg, err := ts.initJaegerCfg() +- if err != nil { +- return err +- } +- +- jLogger := &jaegerLogWrapper{logger: log.New("jaeger")} +- +- options := []jaegercfg.Option{} +- options = append(options, jaegercfg.Logger(jLogger)) +- +- for tag, value := range ts.customTags { +- options = append(options, jaegercfg.Tag(tag, value)) +- } +- +- if ts.zipkinPropagation { +- zipkinPropagator := zipkin.NewZipkinB3HTTPHeaderPropagator() +- options = append(options, +- jaegercfg.Injector(opentracing.HTTPHeaders, zipkinPropagator), +- jaegercfg.Extractor(opentracing.HTTPHeaders, zipkinPropagator), +- ) +- +- if !ts.disableSharedZipkinSpans { +- options = append(options, jaegercfg.ZipkinSharedRPCSpan(true)) +- } +- } +- +- tracer, closer, err := cfg.NewTracer(options...) +- if err != nil { +- return err +- } +- +- opentracing.SetGlobalTracer(tracer) +- +- ts.closer = closer +- +- return nil +-} +- +-func (ts *TracingService) Run(ctx context.Context) error { +- <-ctx.Done() +- +- if ts.closer != nil { +- ts.log.Info("Closing tracing") +- ts.closer.Close() +- } +- +- return nil +-} +- +-func splitTagSettings(input string) map[string]string { +- res := map[string]string{} +- +- tags := strings.Split(input, ",") +- for _, v := range tags { +- kv := strings.Split(v, ":") +- if len(kv) > 1 { +- res[kv[0]] = kv[1] +- } +- } +- +- return res +-} +- +-type jaegerLogWrapper struct { +- logger log.Logger +-} +- +-func (jlw *jaegerLogWrapper) Error(msg string) { +- jlw.logger.Error(msg) +-} +- +-func (jlw *jaegerLogWrapper) Infof(format string, args ...interface{}) { +- msg := fmt.Sprintf(format, args...) +- jlw.logger.Info(msg) +-} +diff --git a/pkg/infra/tracing/tracing_test.go b/pkg/infra/tracing/tracing_test.go +deleted file mode 100644 +index a6d71cf165..0000000000 +--- a/pkg/infra/tracing/tracing_test.go ++++ /dev/null +@@ -1,94 +0,0 @@ +-package tracing +- +-import ( +- "github.com/stretchr/testify/assert" +- "github.com/stretchr/testify/require" +- "os" +- "testing" +-) +- +-func TestGroupSplit(t *testing.T) { +- tests := []struct { +- input string +- expected map[string]string +- }{ +- { +- input: "tag1:value1,tag2:value2", +- expected: map[string]string{ +- "tag1": "value1", +- "tag2": "value2", +- }, +- }, +- { +- input: "", +- expected: map[string]string{}, +- }, +- { +- input: "tag1", +- expected: map[string]string{}, +- }, +- } +- +- for _, test := range tests { +- tags := splitTagSettings(test.input) +- for k, v := range test.expected { +- value, exists := tags[k] +- assert.Truef(t, exists, "Tag %q not found for input %q", k, test.input) +- assert.Equalf(t, v, value, "Tag %q has wrong value for input %q", k, test.input) +- } +- } +-} +- +-func TestInitJaegerCfg_Default(t *testing.T) { +- ts := &TracingService{} +- cfg, err := ts.initJaegerCfg() +- require.NoError(t, err) +- +- assert.True(t, cfg.Disabled) +-} +- +-func TestInitJaegerCfg_Enabled(t *testing.T) { +- ts := &TracingService{enabled: true} +- cfg, err := ts.initJaegerCfg() +- require.NoError(t, err) +- +- assert.False(t, cfg.Disabled) +- assert.Equal(t, "localhost:6831", cfg.Reporter.LocalAgentHostPort) +-} +- +-func TestInitJaegerCfg_DisabledViaEnv(t *testing.T) { +- os.Setenv("JAEGER_DISABLED", "true") +- defer func() { +- os.Unsetenv("JAEGER_DISABLED") +- }() +- +- ts := &TracingService{enabled: true} +- cfg, err := ts.initJaegerCfg() +- require.NoError(t, err) +- +- assert.True(t, cfg.Disabled) +-} +- +-func TestInitJaegerCfg_EnabledViaEnv(t *testing.T) { +- os.Setenv("JAEGER_DISABLED", "false") +- defer func() { +- os.Unsetenv("JAEGER_DISABLED") +- }() +- +- ts := &TracingService{enabled: false} +- cfg, err := ts.initJaegerCfg() +- require.NoError(t, err) +- +- assert.False(t, cfg.Disabled) +-} +- +-func TestInitJaegerCfg_InvalidEnvVar(t *testing.T) { +- os.Setenv("JAEGER_DISABLED", "totallybogus") +- defer func() { +- os.Unsetenv("JAEGER_DISABLED") +- }() +- +- ts := &TracingService{} +- _, err := ts.initJaegerCfg() +- require.EqualError(t, err, "cannot parse env var JAEGER_DISABLED=totallybogus: strconv.ParseBool: parsing \"totallybogus\": invalid syntax") +-} diff --git a/003-golang1.15.patch b/003-golang1.15.patch deleted file mode 100644 index d568703..0000000 --- a/003-golang1.15.patch +++ /dev/null @@ -1,85 +0,0 @@ -diff --git a/pkg/api/dashboard_test.go b/pkg/api/dashboard_test.go -index b58cf217d3..90e110974e 100644 ---- a/pkg/api/dashboard_test.go -+++ b/pkg/api/dashboard_test.go -@@ -3,6 +3,7 @@ package api - import ( - "encoding/json" - "fmt" -+ "strconv" - "io/ioutil" - "testing" - -@@ -828,7 +829,7 @@ func TestDashboardApiEndpoint(t *testing.T) { - bus.AddHandler("test", func(query *models.GetDashboardVersionQuery) error { - query.Result = &models.DashboardVersion{ - Data: simplejson.NewFromAny(map[string]interface{}{ -- "title": "Dash" + string(query.DashboardId), -+ "title": "Dash" + strconv.FormatInt(query.DashboardId, 10), - }), - } - return nil -diff --git a/pkg/components/gtime/gtime_test.go b/pkg/components/gtime/gtime_test.go -index 4dab30fbf6..e4ba096a43 100644 ---- a/pkg/components/gtime/gtime_test.go -+++ b/pkg/components/gtime/gtime_test.go -@@ -22,7 +22,7 @@ func TestParseInterval(t *testing.T) { - {interval: "1M", duration: now.Sub(now.AddDate(0, -1, 0))}, - {interval: "1y", duration: now.Sub(now.AddDate(-1, 0, 0))}, - {interval: "5y", duration: now.Sub(now.AddDate(-5, 0, 0))}, -- {interval: "invalid-duration", err: "time: invalid duration invalid-duration"}, -+ {interval: "invalid-duration", err: "time: invalid duration \"invalid-duration\""}, - } - - for i, tc := range tcs { -diff --git a/pkg/services/sqlstore/alert_notification_test.go b/pkg/services/sqlstore/alert_notification_test.go -index 75d5582022..4986d0d781 100644 ---- a/pkg/services/sqlstore/alert_notification_test.go -+++ b/pkg/services/sqlstore/alert_notification_test.go -@@ -168,7 +168,7 @@ func TestAlertNotificationSQLAccess(t *testing.T) { - cmd.Frequency = "invalid duration" - - err := CreateAlertNotificationCommand(cmd) -- So(err.Error(), ShouldEqual, "time: invalid duration invalid duration") -+ So(err.Error(), ShouldEqual, "time: invalid duration \"invalid duration\"") - }) - }) - -@@ -199,7 +199,7 @@ func TestAlertNotificationSQLAccess(t *testing.T) { - - err := UpdateAlertNotification(updateCmd) - So(err, ShouldNotBeNil) -- So(err.Error(), ShouldEqual, "time: invalid duration invalid duration") -+ So(err.Error(), ShouldEqual, "time: invalid duration \"invalid duration\"") - }) - }) - -diff --git a/pkg/services/sqlstore/sqlbuilder_test.go b/pkg/services/sqlstore/sqlbuilder_test.go -index 42159171b0..abf669d294 100644 ---- a/pkg/services/sqlstore/sqlbuilder_test.go -+++ b/pkg/services/sqlstore/sqlbuilder_test.go -@@ -5,6 +5,7 @@ import ( - "math/rand" - "testing" - "time" -+ "strconv" - - "github.com/grafana/grafana/pkg/components/simplejson" - "github.com/grafana/grafana/pkg/models" -@@ -193,12 +194,12 @@ func test(t *testing.T, dashboardProps DashboardProps, dashboardPermission *Dash - func createDummyUser() (*models.User, error) { - uid := rand.Intn(9999999) - createUserCmd := &models.CreateUserCommand{ -- Email: string(uid) + "@example.com", -- Login: string(uid), -- Name: string(uid), -+ Email: strconv.Itoa(uid) + "@example.com", -+ Login: strconv.Itoa(uid), -+ Name: strconv.Itoa(uid), - Company: "", - OrgName: "", -- Password: string(uid), -+ Password: strconv.Itoa(uid), - EmailVerified: true, - IsAdmin: false, - SkipOrgSetup: false, diff --git a/002-manpages.patch b/003-manpages.patch similarity index 100% rename from 002-manpages.patch rename to 003-manpages.patch diff --git a/004-remove-goldenfiles-test.patch b/004-remove-goldenfiles-test.patch deleted file mode 100644 index bc08ffc..0000000 --- a/004-remove-goldenfiles-test.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/pkg/tsdb/influxdb/flux/executor_test.go b/pkg/tsdb/influxdb/flux/executor_test.go -index b42389c94d..a24e16f97e 100644 ---- a/pkg/tsdb/influxdb/flux/executor_test.go -+++ b/pkg/tsdb/influxdb/flux/executor_test.go -@@ -285,12 +285,3 @@ func TestBuckets(t *testing.T) { - fmt.Println("----------------------") - }) - } -- --func TestGoldenFiles(t *testing.T) { -- t.Run("Renamed", func(t *testing.T) { -- _, err := verifyGoldenResponse("renamed") -- if err != nil { -- t.Fatal(err.Error()) -- } -- }) --} diff --git a/001-wrappers-grafana-cli.patch b/004-wrappers-grafana-cli.patch similarity index 100% rename from 001-wrappers-grafana-cli.patch rename to 004-wrappers-grafana-cli.patch diff --git a/005-pkg-main-fix-import-paths.patch b/005-pkg-main-fix-import-paths.patch new file mode 100644 index 0000000..4021e3f --- /dev/null +++ b/005-pkg-main-fix-import-paths.patch @@ -0,0 +1,17 @@ +diff --git a/pkg/extensions/main.go b/pkg/extensions/main.go +index a88f67ff9e..7844aa1227 100644 +--- a/pkg/extensions/main.go ++++ b/pkg/extensions/main.go +@@ -9,10 +9,10 @@ import ( + "github.com/grafana/grafana/pkg/registry" + "github.com/grafana/grafana/pkg/services/licensing" + _ "github.com/jung-kurt/gofpdf" +- _ "github.com/linkedin/goavro/v2" ++ _ "github.com/linkedin/goavro" + _ "github.com/pkg/errors" + _ "github.com/robfig/cron" +- _ "github.com/robfig/cron/v3" ++ _ "gopkg.in/robfig/cron.v3" + _ "github.com/stretchr/testify/require" + _ "gopkg.in/square/go-jose.v2" + ) diff --git a/006-pkg-setting-ini-default-section.patch b/006-pkg-setting-ini-default-section.patch new file mode 100644 index 0000000..263c614 --- /dev/null +++ b/006-pkg-setting-ini-default-section.patch @@ -0,0 +1,13 @@ +diff --git a/pkg/setting/setting.go b/pkg/setting/setting.go +index 19181be84e..9a745f67e4 100644 +--- a/pkg/setting/setting.go ++++ b/pkg/setting/setting.go +@@ -387,7 +387,7 @@ func applyCommandLineDefaultProperties(props map[string]string, file *ini.File) + func applyCommandLineProperties(props map[string]string, file *ini.File) { + for _, section := range file.Sections() { + sectionName := section.Name() + "." +- if section.Name() == ini.DefaultSection { ++ if section.Name() == ini.DEFAULT_SECTION { + sectionName = "" + } + for _, key := range section.Keys() { diff --git a/007-pkg-prometheus-client-query-range.patch b/007-pkg-prometheus-client-query-range.patch new file mode 100644 index 0000000..5af4b40 --- /dev/null +++ b/007-pkg-prometheus-client-query-range.patch @@ -0,0 +1,18 @@ +diff --git a/pkg/tsdb/prometheus/prometheus.go b/pkg/tsdb/prometheus/prometheus.go +index 1244031bb4..c1d85b7e53 100644 +--- a/pkg/tsdb/prometheus/prometheus.go ++++ b/pkg/tsdb/prometheus/prometheus.go +@@ -112,10 +112,10 @@ func (e *PrometheusExecutor) Query(ctx context.Context, dsInfo *models.DataSourc + span.SetTag("stop_unixnano", query.End.UnixNano()) + defer span.Finish() + +- value, _, err := client.QueryRange(ctx, query.Expr, timeRange) ++ value, queryErr := client.QueryRange(ctx, query.Expr, timeRange) + +- if err != nil { +- return nil, err ++ if queryErr != nil { ++ return nil, queryErr + } + + queryResult, err := parseResponse(value, query) diff --git a/008-pkg-services-notifications-codes-Unknwon.patch b/008-pkg-services-notifications-codes-Unknwon.patch new file mode 100644 index 0000000..8263705 --- /dev/null +++ b/008-pkg-services-notifications-codes-Unknwon.patch @@ -0,0 +1,13 @@ +diff --git a/pkg/services/notifications/codes.go b/pkg/services/notifications/codes.go +index ae66aa1d1b..bfb95560fe 100644 +--- a/pkg/services/notifications/codes.go ++++ b/pkg/services/notifications/codes.go +@@ -6,7 +6,7 @@ import ( + "fmt" + "time" + +- "github.com/unknwon/com" ++ "github.com/Unknwon/com" + + "github.com/grafana/grafana/pkg/models" + "github.com/grafana/grafana/pkg/setting" diff --git a/009-pkg-fix-xorm-import.patch b/009-pkg-fix-xorm-import.patch new file mode 100644 index 0000000..c8a1c0a --- /dev/null +++ b/009-pkg-fix-xorm-import.patch @@ -0,0 +1,288 @@ +diff --git a/pkg/services/sqlstore/datasource.go b/pkg/services/sqlstore/datasource.go +index c84f6bb948..414e343a63 100644 +--- a/pkg/services/sqlstore/datasource.go ++++ b/pkg/services/sqlstore/datasource.go +@@ -5,7 +5,7 @@ import ( + "github.com/grafana/grafana/pkg/components/simplejson" + "github.com/grafana/grafana/pkg/models" + +- "github.com/go-xorm/xorm" ++ "xorm.io/xorm" + + "github.com/grafana/grafana/pkg/bus" + "github.com/grafana/grafana/pkg/components/securejsondata" +diff --git a/pkg/services/sqlstore/logger.go b/pkg/services/sqlstore/logger.go +index 498c2b58c1..850e10cd21 100644 +--- a/pkg/services/sqlstore/logger.go ++++ b/pkg/services/sqlstore/logger.go +@@ -5,7 +5,7 @@ import ( + + glog "github.com/grafana/grafana/pkg/infra/log" + +- "github.com/go-xorm/core" ++ "xorm.io/core" + ) + + type XormLogger struct { +diff --git a/pkg/services/sqlstore/migrations/annotation_mig.go b/pkg/services/sqlstore/migrations/annotation_mig.go +index 3ec5df841e..505ab5cf6e 100644 +--- a/pkg/services/sqlstore/migrations/annotation_mig.go ++++ b/pkg/services/sqlstore/migrations/annotation_mig.go +@@ -1,7 +1,7 @@ + package migrations + + import ( +- "github.com/go-xorm/xorm" ++ "xorm.io/xorm" + . "github.com/grafana/grafana/pkg/services/sqlstore/migrator" + ) + +diff --git a/pkg/services/sqlstore/migrations/migrations_test.go b/pkg/services/sqlstore/migrations/migrations_test.go +index 62ecbaad11..a9a3b38e62 100644 +--- a/pkg/services/sqlstore/migrations/migrations_test.go ++++ b/pkg/services/sqlstore/migrations/migrations_test.go +@@ -3,7 +3,7 @@ package migrations + import ( + "testing" + +- "github.com/go-xorm/xorm" ++ "xorm.io/xorm" + . "github.com/grafana/grafana/pkg/services/sqlstore/migrator" + "github.com/grafana/grafana/pkg/services/sqlstore/sqlutil" + +diff --git a/pkg/services/sqlstore/migrations/user_mig.go b/pkg/services/sqlstore/migrations/user_mig.go +index 53110fe49b..e1a54a57bf 100644 +--- a/pkg/services/sqlstore/migrations/user_mig.go ++++ b/pkg/services/sqlstore/migrations/user_mig.go +@@ -3,7 +3,7 @@ package migrations + import ( + "fmt" + +- "github.com/go-xorm/xorm" ++ "xorm.io/xorm" + . "github.com/grafana/grafana/pkg/services/sqlstore/migrator" + "github.com/grafana/grafana/pkg/util" + ) +diff --git a/pkg/services/sqlstore/migrator/column.go b/pkg/services/sqlstore/migrator/column.go +index 28cef60a94..af093a8e59 100644 +--- a/pkg/services/sqlstore/migrator/column.go ++++ b/pkg/services/sqlstore/migrator/column.go +@@ -1,7 +1,7 @@ + package migrator + + // Notice +-// code based on parts from from https://github.com/go-xorm/core/blob/3e0fa232ab5c90996406c0cd7ae86ad0e5ecf85f/column.go ++// code based on parts from from https://xorm.io/core/blob/3e0fa232ab5c90996406c0cd7ae86ad0e5ecf85f/column.go + + type Column struct { + Name string +diff --git a/pkg/services/sqlstore/migrator/dialect.go b/pkg/services/sqlstore/migrator/dialect.go +index 0aa2be7301..5246f17971 100644 +--- a/pkg/services/sqlstore/migrator/dialect.go ++++ b/pkg/services/sqlstore/migrator/dialect.go +@@ -4,7 +4,7 @@ import ( + "fmt" + "strings" + +- "github.com/go-xorm/xorm" ++ "xorm.io/xorm" + ) + + type Dialect interface { +diff --git a/pkg/services/sqlstore/migrator/migrator.go b/pkg/services/sqlstore/migrator/migrator.go +index 612a333a72..f314b6ea84 100644 +--- a/pkg/services/sqlstore/migrator/migrator.go ++++ b/pkg/services/sqlstore/migrator/migrator.go +@@ -4,7 +4,7 @@ import ( + "time" + + _ "github.com/go-sql-driver/mysql" +- "github.com/go-xorm/xorm" ++ "xorm.io/xorm" + "github.com/grafana/grafana/pkg/infra/log" + "github.com/grafana/grafana/pkg/util/errutil" + _ "github.com/lib/pq" +diff --git a/pkg/services/sqlstore/migrator/mysql_dialect.go b/pkg/services/sqlstore/migrator/mysql_dialect.go +index 147df03357..a658819ea2 100644 +--- a/pkg/services/sqlstore/migrator/mysql_dialect.go ++++ b/pkg/services/sqlstore/migrator/mysql_dialect.go +@@ -7,7 +7,7 @@ import ( + + "github.com/VividCortex/mysqlerr" + "github.com/go-sql-driver/mysql" +- "github.com/go-xorm/xorm" ++ "xorm.io/xorm" + ) + + type Mysql struct { +diff --git a/pkg/services/sqlstore/migrator/postgres_dialect.go b/pkg/services/sqlstore/migrator/postgres_dialect.go +index 70803f3a9e..5ae7c57ea5 100644 +--- a/pkg/services/sqlstore/migrator/postgres_dialect.go ++++ b/pkg/services/sqlstore/migrator/postgres_dialect.go +@@ -5,7 +5,7 @@ import ( + "strconv" + "strings" + +- "github.com/go-xorm/xorm" ++ "xorm.io/xorm" + "github.com/grafana/grafana/pkg/util/errutil" + "github.com/lib/pq" + ) +diff --git a/pkg/services/sqlstore/migrator/sqlite_dialect.go b/pkg/services/sqlstore/migrator/sqlite_dialect.go +index 8372898c35..a306badd82 100644 +--- a/pkg/services/sqlstore/migrator/sqlite_dialect.go ++++ b/pkg/services/sqlstore/migrator/sqlite_dialect.go +@@ -3,7 +3,7 @@ package migrator + import ( + "fmt" + +- "github.com/go-xorm/xorm" ++ "xorm.io/xorm" + "github.com/mattn/go-sqlite3" + ) + +diff --git a/pkg/services/sqlstore/migrator/types.go b/pkg/services/sqlstore/migrator/types.go +index 48354998d8..957bef392d 100644 +--- a/pkg/services/sqlstore/migrator/types.go ++++ b/pkg/services/sqlstore/migrator/types.go +@@ -4,7 +4,7 @@ import ( + "fmt" + "strings" + +- "github.com/go-xorm/xorm" ++ "xorm.io/xorm" + ) + + const ( +diff --git a/pkg/services/sqlstore/session.go b/pkg/services/sqlstore/session.go +index 07f1d4524c..e44105c79c 100644 +--- a/pkg/services/sqlstore/session.go ++++ b/pkg/services/sqlstore/session.go +@@ -4,7 +4,7 @@ import ( + "context" + "reflect" + +- "github.com/go-xorm/xorm" ++ "xorm.io/xorm" + ) + + type DBSession struct { +diff --git a/pkg/services/sqlstore/sqlstore.go b/pkg/services/sqlstore/sqlstore.go +index bede60f1ff..7076b76dd6 100644 +--- a/pkg/services/sqlstore/sqlstore.go ++++ b/pkg/services/sqlstore/sqlstore.go +@@ -11,7 +11,7 @@ import ( + "time" + + "github.com/go-sql-driver/mysql" +- "github.com/go-xorm/xorm" ++ "xorm.io/xorm" + "github.com/grafana/grafana/pkg/bus" + "github.com/grafana/grafana/pkg/infra/localcache" + "github.com/grafana/grafana/pkg/infra/log" +diff --git a/pkg/services/sqlstore/transactions.go b/pkg/services/sqlstore/transactions.go +index 27928f52a4..6d9888af39 100644 +--- a/pkg/services/sqlstore/transactions.go ++++ b/pkg/services/sqlstore/transactions.go +@@ -4,7 +4,7 @@ import ( + "context" + "time" + +- "github.com/go-xorm/xorm" ++ "xorm.io/xorm" + "github.com/grafana/grafana/pkg/bus" + "github.com/grafana/grafana/pkg/infra/log" + "github.com/grafana/grafana/pkg/util/errutil" +diff --git a/pkg/tsdb/mssql/mssql.go b/pkg/tsdb/mssql/mssql.go +index 1ca3778b9d..debe106fa7 100644 +--- a/pkg/tsdb/mssql/mssql.go ++++ b/pkg/tsdb/mssql/mssql.go +@@ -8,7 +8,7 @@ import ( + "github.com/grafana/grafana/pkg/setting" + + _ "github.com/denisenkom/go-mssqldb" +- "github.com/go-xorm/core" ++ "xorm.io/core" + "github.com/grafana/grafana/pkg/infra/log" + "github.com/grafana/grafana/pkg/models" + "github.com/grafana/grafana/pkg/tsdb" +diff --git a/pkg/tsdb/mssql/mssql_test.go b/pkg/tsdb/mssql/mssql_test.go +index 760c6dcf07..84e5e0e219 100644 +--- a/pkg/tsdb/mssql/mssql_test.go ++++ b/pkg/tsdb/mssql/mssql_test.go +@@ -8,7 +8,7 @@ import ( + "testing" + "time" + +- "github.com/go-xorm/xorm" ++ "xorm.io/xorm" + "github.com/grafana/grafana/pkg/components/securejsondata" + "github.com/grafana/grafana/pkg/components/simplejson" + "github.com/grafana/grafana/pkg/models" +diff --git a/pkg/tsdb/mysql/mysql.go b/pkg/tsdb/mysql/mysql.go +index 682c3bc456..5ae7a9a87d 100644 +--- a/pkg/tsdb/mysql/mysql.go ++++ b/pkg/tsdb/mysql/mysql.go +@@ -13,7 +13,7 @@ import ( + "github.com/grafana/grafana/pkg/setting" + + "github.com/go-sql-driver/mysql" +- "github.com/go-xorm/core" ++ "xorm.io/core" + "github.com/grafana/grafana/pkg/infra/log" + "github.com/grafana/grafana/pkg/models" + "github.com/grafana/grafana/pkg/tsdb" +diff --git a/pkg/tsdb/mysql/mysql_test.go b/pkg/tsdb/mysql/mysql_test.go +index b2ff2bc969..609f923d2c 100644 +--- a/pkg/tsdb/mysql/mysql_test.go ++++ b/pkg/tsdb/mysql/mysql_test.go +@@ -8,7 +8,7 @@ import ( + "testing" + "time" + +- "github.com/go-xorm/xorm" ++ "xorm.io/xorm" + "github.com/grafana/grafana/pkg/components/securejsondata" + "github.com/grafana/grafana/pkg/components/simplejson" + "github.com/grafana/grafana/pkg/models" +diff --git a/pkg/tsdb/postgres/postgres.go b/pkg/tsdb/postgres/postgres.go +index a417699c1d..f38b94913b 100644 +--- a/pkg/tsdb/postgres/postgres.go ++++ b/pkg/tsdb/postgres/postgres.go +@@ -7,7 +7,7 @@ import ( + + "github.com/grafana/grafana/pkg/setting" + +- "github.com/go-xorm/core" ++ "xorm.io/core" + "github.com/grafana/grafana/pkg/infra/log" + "github.com/grafana/grafana/pkg/models" + "github.com/grafana/grafana/pkg/tsdb" +diff --git a/pkg/tsdb/postgres/postgres_test.go b/pkg/tsdb/postgres/postgres_test.go +index 23d0830d3d..d839d42ddb 100644 +--- a/pkg/tsdb/postgres/postgres_test.go ++++ b/pkg/tsdb/postgres/postgres_test.go +@@ -8,7 +8,7 @@ import ( + "testing" + "time" + +- "github.com/go-xorm/xorm" ++ "xorm.io/xorm" + "github.com/grafana/grafana/pkg/components/securejsondata" + "github.com/grafana/grafana/pkg/components/simplejson" + "github.com/grafana/grafana/pkg/models" +diff --git a/pkg/tsdb/sqleng/sql_engine.go b/pkg/tsdb/sqleng/sql_engine.go +index 0cfb1560e4..13bc84bd06 100644 +--- a/pkg/tsdb/sqleng/sql_engine.go ++++ b/pkg/tsdb/sqleng/sql_engine.go +@@ -19,8 +19,8 @@ import ( + + "github.com/grafana/grafana/pkg/components/null" + +- "github.com/go-xorm/core" +- "github.com/go-xorm/xorm" ++ "xorm.io/core" ++ "xorm.io/xorm" + "github.com/grafana/grafana/pkg/components/simplejson" + "github.com/grafana/grafana/pkg/models" + ) diff --git a/Makefile b/Makefile deleted file mode 100644 index 3f1696f..0000000 --- a/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -all: grafana-vendor-$(VER).tar.gz \ - grafana-vendor-$(VER).tar.gz.manifest \ - grafana-webpack-$(VER).tar.gz \ - grafana-webpack-$(VER).tar.gz.manifest - -grafana-$(VER).tar.gz grafana-$(VER): - wget https://github.com/grafana/grafana/archive/v$(VER)/grafana-$(VER).tar.gz - tar xfz grafana-$(VER).tar.gz - -grafana-vendor-$(VER).tar.gz: grafana-$(VER).tar.gz - cd grafana-$(VER) && go mod vendor -v - tar cfz $@ grafana-$(VER)/vendor - -grafana-vendor-$(VER).tar.gz.manifest: grafana-$(VER).tar.gz - awk '$$2~/^v/ && $$4 != "indirect" {print "Provides: bundled(golang(" $$1 ")) = " substr($$2, 2)}' grafana-$(VER)/go.mod | \ - sed -E 's/=(.*)-(.*)-(.*)/=\1-\2.\3/g' > $@ - -grafana-webpack-$(VER).tar.gz: grafana-$(VER).tar.gz - cd grafana-$(VER) && yarn install --pure-lockfile && yarn run build - cd grafana-$(VER) && \ - mkdir plugins-bundled/external && yarn run plugins:build-bundled && \ - for plugin in plugins-bundled/internal/*; do mv $$plugin $$plugin.tmp; mv $$plugin.tmp/dist $$plugin; rm -rf $$plugin.tmp; done && \ - rm plugins-bundled/README.md plugins-bundled/.gitignore plugins-bundled/external.json - tar cfz $@ grafana-$(VER)/public/build grafana-$(VER)/public/views grafana-$(VER)/plugins-bundled - -grafana-webpack-$(VER).tar.gz.manifest: grafana-$(VER).tar.gz - ./create_webpack_manifest.py grafana-$(VER)/ > $@ - -clean: - rm -rf *.tar.gz grafana-*/ diff --git a/README.md b/README.md index 1c34177..a2871e3 100644 --- a/README.md +++ b/README.md @@ -5,11 +5,12 @@ The grafana package (replace X.Y.Z with the new Grafana version) * update `Version` and `%changelog` in the specfile -* create bundles and manifests: `VER=X.Y.Z make` -* update specfile with contents of `grafana-vendor-X.Y.Z.tar.gz.manifest` and `grafana-webpack-X.Y.Z.tar.gz.manifest` +* download source tarball and create webpack: `./make_grafana_webpack.sh X.Y.Z` +* update golang buildrequires: `./list_go_buildrequires.sh grafana-X.Y.Z` and replace the old golang `BuildRequires:` with the new ones +* update nodejs provides: `./list_bundled_nodejs_packages.py grafana-X.Y.Z` and replace the old nodejs `Provides:` with the new ones * check if the default configuration has changed: `diff grafana-X.Y.Z/conf/defaults.ini distro-defaults.ini` and update `distro-defaults.ini` if necessary -* run local build: `rpkg local` +* install all new golang build dependencies: `sudo dnf builddep grafana.spec` and create packages for missing dependencies +* run local build: `rpkg local`, and if any patches fail, update them accordingly * run rpm linter: `rpkg lint` -* run local builds with different OS versions: `./run_container_build.sh version` +* run local builds with different OS versions: `./run_container_build.sh version` (place not yet published dependencies in the `deps/` directory) * run a scratch build: `fedpkg scratch-build --srpm` -* upload new source tarballs: `fedpkg new-sources grafana-X.Y.Z.tar.gz grafana-vendor-X.Y.Z.tar.gz grafana-webpack-X.Y.Z.tar.gz` diff --git a/distro-defaults.ini b/distro-defaults.ini index 7b61f6e..b982480 100644 --- a/distro-defaults.ini +++ b/distro-defaults.ini @@ -24,7 +24,7 @@ logs = /var/log/grafana plugins = /var/lib/grafana/plugins # folder that contains provisioning config files that grafana will apply on startup and while running. -provisioning = /etc/grafana/provisioning +provisioning = conf/provisioning #################################### Server ############################## [server] @@ -126,8 +126,7 @@ connstr = # This enables data proxy logging, default is false logging = false -# How long the data proxy waits before timing out, default is 30 seconds. -# This setting also applies to core backend HTTP data sources where query requests use an HTTP client with timeout set. +# How long the data proxy should wait before timing out default is 30 (seconds) timeout = 30 # If enabled and user is not anonymous, data proxy will add X-Grafana-User header with username into the request, default is false. @@ -189,6 +188,7 @@ allow_embedding = false # Set to true if you want to enable http strict transport security (HSTS) response header. # This is only sent when HTTPS is enabled in this configuration. # HSTS tells browsers that the site should only be accessed using HTTPS. +# The default will change to true in the next minor release, 6.3. strict_transport_security = false # Sets how long a browser should cache HSTS. Only applied if strict_transport_security is enabled. @@ -202,12 +202,12 @@ strict_transport_security_subdomains = false # Set to true to enable the X-Content-Type-Options response header. # The X-Content-Type-Options response HTTP header is a marker used by the server to indicate that the MIME types advertised -# in the Content-Type headers should not be changed and be followed. -x_content_type_options = true +# in the Content-Type headers should not be changed and be followed. The default will change to true in the next minor release, 6.3. +x_content_type_options = false # Set to true to enable the X-XSS-Protection header, which tells browsers to stop pages from loading -# when they detect reflected cross-site scripting (XSS) attacks. -x_xss_protection = true +# when they detect reflected cross-site scripting (XSS) attacks. The default will change to true in the next minor release, 6.3. +x_xss_protection = false #################################### Snapshots ########################### @@ -230,12 +230,9 @@ snapshot_remove_expired = true # Number dashboard versions to keep (per dashboard). Default: 20, Minimum: 1 versions_to_keep = 20 -# Minimum dashboard refresh interval. When set, this will restrict users to set the refresh interval of a dashboard lower than given interval. Per default this is 5 seconds. +# Minimum dashboard refresh interval. When set, this will restrict users to set the refresh interval of a dashboard lower than given interval. Per default this is not set/unrestricted. # The interval string is a possibly signed sequence of decimal numbers, followed by a unit suffix (ms, s, m, h, d), e.g. 30s or 1m. -min_refresh_interval = 1s - -# Path to the default home dashboard. If this value is empty, then Grafana uses StaticRootPath + "dashboards/home.json" -default_home_dashboard_path = +min_refresh_interval = #################################### Users ############################### [users] @@ -301,9 +298,6 @@ signout_redirect_url = # This setting is ignored if multiple OAuth providers are configured. oauth_auto_login = false -# OAuth state max age cookie duration. Defaults to 60 seconds. -oauth_state_cookie_max_age = 60 - # limit of api_key seconds to live before expiration api_key_max_seconds_to_live = -1 @@ -318,9 +312,6 @@ org_name = Main Org. # specify role for unauthenticated users org_role = Viewer -# mask the Grafana version number for unauthenticated users -hide_version = false - #################################### Github Auth ######################### [auth.github] enabled = false @@ -392,21 +383,6 @@ token_url = https://login.microsoftonline.com//oauth2/v2.0/token allowed_domains = allowed_groups = -#################################### Okta OAuth ####################### -[auth.okta] -name = Okta -enabled = false -allow_sign_up = true -client_id = some_id -client_secret = some_secret -scopes = openid profile email groups -auth_url = https://.okta.com/oauth2/v1/authorize -token_url = https://.okta.com/oauth2/v1/token -api_url = https://.okta.com/oauth2/v1/userinfo -allowed_domains = -allowed_groups = -role_attribute_path = - #################################### Generic OAuth ####################### [auth.generic_oauth] name = OAuth @@ -429,6 +405,47 @@ tls_client_cert = tls_client_key = tls_client_ca = +#################################### SAML Auth ########################### +[auth.saml] # Enterprise only +# Defaults to false. If true, the feature is enabled +enabled = false + +# Base64-encoded public X.509 certificate. Used to sign requests to the IdP +certificate = + +# Path to the public X.509 certificate. Used to sign requests to the IdP +certificate_path = + +# Base64-encoded private key. Used to decrypt assertions from the IdP +private_key = + +# Path to the private key. Used to decrypt assertions from the IdP +private_key_path = + +# Base64-encoded IdP SAML metadata XML. Used to verify and obtain binding locations from the IdP +idp_metadata = + +# Path to the SAML metadata XML. Used to verify and obtain binding locations from the IdP +idp_metadata_path = + +# URL to fetch SAML IdP metadata. Used to verify and obtain binding locations from the IdP +idp_metadata_url = + +# Duration, since the IdP issued a response and the SP is allowed to process it. Defaults to 90 seconds +max_issue_delay = 90s + +# Duration, for how long the SP's metadata should be valid. Defaults to 48 hours +metadata_valid_duration = 48h + +# Friendly name or name of the attribute within the SAML assertion to use as the user's name +assertion_attribute_name = displayName + +# Friendly name or name of the attribute within the SAML assertion to use as the user's login handle +assertion_attribute_login = mail + +# Friendly name or name of the attribute within the SAML assertion to use as the user's email +assertion_attribute_email = mail + #################################### Basic Auth ########################## [auth.basic] enabled = true @@ -455,7 +472,7 @@ allow_sign_up = true # LDAP backround sync (Enterprise only) # At 1 am every day sync_cron = "0 0 1 * * *" -active_sync_enabled = true +active_sync_enabled = false #################################### SMTP / Emailing ##################### [smtp] @@ -470,7 +487,6 @@ skip_verify = false from_address = admin@grafana.localhost from_name = Grafana ehlo_identity = -startTLS_policy = [emails] welcome_email_on_sign_up = false @@ -690,9 +706,6 @@ container_name = server_url = # If the remote HTTP image renderer service runs on a different server than the Grafana server you may have to configure this to a URL where Grafana is reachable, e.g. http://grafana.domain/. callback_url = -# Concurrent render request limit affects when the /render HTTP endpoint is used. Rendering many images at the same time can overload the server, -# which this setting can help protect against by only allowing a certain amount of concurrent requests. -concurrent_render_request_limit = 30 [panels] # here for to support old env variables, can remove after a few months @@ -702,68 +715,6 @@ disable_sanitize_html = false [plugins] enable_alpha = false app_tls_skip_verify_insecure = false -# Enter a comma-separated list of plugin identifiers to identify plugins that are allowed to be loaded even if they lack a valid signature. -allow_loading_unsigned_plugins = - -#################################### Grafana Image Renderer Plugin ########################## -[plugin.grafana-image-renderer] -# Instruct headless browser instance to use a default timezone when not provided by Grafana, e.g. when rendering panel image of alert. -# See ICU’s metaZones.txt (https://cs.chromium.org/chromium/src/third_party/icu/source/data/misc/metaZones.txt) for a list of supported -# timezone IDs. Fallbacks to TZ environment variable if not set. -rendering_timezone = - -# Instruct headless browser instance to use a default language when not provided by Grafana, e.g. when rendering panel image of alert. -# Please refer to the HTTP header Accept-Language to understand how to format this value, e.g. 'fr-CH, fr;q=0.9, en;q=0.8, de;q=0.7, *;q=0.5'. -rendering_language = - -# Instruct headless browser instance to use a default device scale factor when not provided by Grafana, e.g. when rendering panel image of alert. -# Default is 1. Using a higher value will produce more detailed images (higher DPI), but will require more disk space to store an image. -rendering_viewport_device_scale_factor = - -# Instruct headless browser instance whether to ignore HTTPS errors during navigation. Per default HTTPS errors are not ignored. Due to -# the security risk it's not recommended to ignore HTTPS errors. -rendering_ignore_https_errors = - -# Instruct headless browser instance whether to capture and log verbose information when rendering an image. Default is false and will -# only capture and log error messages. When enabled, debug messages are captured and logged as well. -# For the verbose information to be included in the Grafana server log you have to adjust the rendering log level to debug, configure -# [log].filter = rendering:debug. -rendering_verbose_logging = - -# Instruct headless browser instance whether to output its debug and error messages into running process of remote rendering service. -# Default is false. This can be useful to enable (true) when troubleshooting. -rendering_dumpio = - -# Additional arguments to pass to the headless browser instance. Default is --no-sandbox. The list of Chromium flags can be found -# here (https://peter.sh/experiments/chromium-command-line-switches/). Multiple arguments is separated with comma-character. -rendering_args = - -# You can configure the plugin to use a different browser binary instead of the pre-packaged version of Chromium. -# Please note that this is not recommended, since you may encounter problems if the installed version of Chrome/Chromium is not -# compatible with the plugin. -rendering_chrome_bin = - -# Instruct how headless browser instances are created. Default is 'default' and will create a new browser instance on each request. -# Mode 'clustered' will make sure that only a maximum of browsers/incognito pages can execute concurrently. -# Mode 'reusable' will have one browser instance and will create a new incognito page on each request. -rendering_mode = - -# When rendering_mode = clustered you can instruct how many browsers or incognito pages can execute concurrently. Default is 'browser' -# and will cluster using browser instances. -# Mode 'context' will cluster using incognito pages. -rendering_clustering_mode = -# When rendering_mode = clustered you can define maximum number of browser instances/incognito pages that can execute concurrently.. -rendering_clustering_max_concurrency = - -# Limit the maximum viewport width, height and device scale factor that can be requested. -rendering_viewport_max_width = -rendering_viewport_max_height = -rendering_viewport_max_device_scale_factor = - -# Change the listening host and port of the gRPC server. Default host is 127.0.0.1 and default port is 0 and will automatically assign -# a port not in use. -grpc_host = -grpc_port = [enterprise] license_path = diff --git a/grafana.rpmlintrc b/grafana.rpmlintrc index d7a45e7..c6b221d 100644 --- a/grafana.rpmlintrc +++ b/grafana.rpmlintrc @@ -1,11 +1,10 @@ +addFilter("W: non-standard-gid.* grafana") +addFilter("W: non-standard-uid.* grafana") +addFilter("E: script-without-shebang .*\.json") +addFilter("E: zero-length /usr/share/grafana/public/.*") +addFilter("W: log-files-without-logrotate .*") +addFilter("W: no-documentation") addFilter("E: non-readable /etc/grafana/grafana.ini 640") addFilter("E: non-readable /etc/grafana/ldap.toml 640") addFilter("E: non-standard-dir-perm /var/lib/grafana 750") -addFilter("E: zero-length /usr/share/grafana/public/.*") -addFilter("E: script-without-shebang .*\.json") - -addFilter("W: non-standard-uid.* grafana") -addFilter("W: non-standard-gid.* grafana") -addFilter("W: hidden-file-or-dir /usr/share/grafana/public/.*") -addFilter("W: log-files-without-logrotate .*") addFilter("W: dangerous-command-in-%post chown") diff --git a/grafana.spec b/grafana.spec index 875ca4a..a783904 100644 --- a/grafana.spec +++ b/grafana.spec @@ -8,9 +8,15 @@ end end} +# Unbundle Grafana vendor sources and instead use BuildRequires +# on platforms that have enough golang devel support. +%if 0%{?rhel} == 0 +%global unbundle_vendor_sources 1 +%endif + Name: grafana -Version: 7.1.1 -Release: 2%{?dist} +Version: 6.7.4 +Release: 1%{?dist} Summary: Metrics dashboard and graph editor License: ASL 2.0 URL: https://grafana.org @@ -18,35 +24,32 @@ URL: https://grafana.org # Source0 contains the tagged upstream sources Source0: https://github.com/grafana/grafana/archive/v%{version}/%{name}-%{version}.tar.gz -# Source1 contains the bundled Go dependencies -Source1: grafana-vendor-%{version}.tar.gz +# Source1 contains the front-end javascript modules bundled into a webpack +Source1: grafana_webpack-%{version}.tar.gz -# Source2 contains the front-end javascript modules bundled into a webpack -Source2: grafana-webpack-%{version}.tar.gz +# Source2 contains Grafana configuration defaults for distributions +Source2: distro-defaults.ini -# Source3 contains Grafana configuration defaults for distributions -Source3: distro-defaults.ini +# Source3 is the script to create the webpack from grafana sources +Source3: make_grafana_webpack.sh -# Source4 contains the Makefile to create a Go vendor tarball and a webpack from grafana sources -Source4: Makefile +# Source4 is the script to generate the list of Go build dependencies: +Source4: list_go_buildrequires.sh + +# Source5 is the script to generate the list of bundled nodejs packages +Source5: list_bundled_nodejs_packages.py -# Source5 contains the script to generate the list of bundled nodejs packages -Source5: create_webpack_manifest.py # Patches -Patch1: 001-wrappers-grafana-cli.patch -Patch2: 002-manpages.patch - -# Required for Go >= 1.15 -# https://github.com/golang/go/commit/201cb046b745f8bb00e3d382290190c74ba7b7e1 -# https://github.com/golang/go/issues/32479 -Patch3: 003-golang1.15.patch - -# Required for s390x -# the golden files include memory dumps from a x86 machine -# integers are stored as little endian on x86, but as big endian on s390x -# therefore loading this memory dump fails on s390x -Patch4: 004-remove-goldenfiles-test.patch +Patch1: 001-login-oauth-use-oauth2-exchange.patch +Patch2: 002-remove-jaeger-tracing.patch +Patch3: 003-manpages.patch +Patch4: 004-wrappers-grafana-cli.patch +Patch5: 005-pkg-main-fix-import-paths.patch +Patch6: 006-pkg-setting-ini-default-section.patch +Patch7: 007-pkg-prometheus-client-query-range.patch +Patch8: 008-pkg-services-notifications-codes-Unknwon.patch +Patch9: 009-pkg-fix-xorm-import.patch # Intersection of go_arches and nodejs_arches ExclusiveArch: %{grafana_arches} @@ -65,176 +68,203 @@ Requires(pre): shadow-utils BuildRequires: git, systemd, golang, go-srpm-macros, go-rpm-macros -Obsoletes: grafana-cloudwatch < 7.1.1-1 -Obsoletes: grafana-elasticsearch < 7.1.1-1 -Obsoletes: grafana-azure-monitor < 7.1.1-1 -Obsoletes: grafana-graphite < 7.1.1-1 -Obsoletes: grafana-influxdb < 7.1.1-1 -Obsoletes: grafana-loki < 7.1.1-1 -Obsoletes: grafana-mssql < 7.1.1-1 -Obsoletes: grafana-mysql < 7.1.1-1 -Obsoletes: grafana-opentsdb < 7.1.1-1 -Obsoletes: grafana-postgres < 7.1.1-1 -Obsoletes: grafana-prometheus < 7.1.1-1 -Obsoletes: grafana-stackdriver < 7.1.1-1 - %if 0%{?fedora} || 0%{?rhel} > 7 -Recommends: grafana-pcp >= 3.0.0 +Recommends: grafana-cloudwatch = %{version}-%{release} +Recommends: grafana-elasticsearch = %{version}-%{release} +Recommends: grafana-azure-monitor = %{version}-%{release} +Recommends: grafana-graphite = %{version}-%{release} +Recommends: grafana-influxdb = %{version}-%{release} +Recommends: grafana-loki = %{version}-%{release} +Recommends: grafana-mssql = %{version}-%{release} +Recommends: grafana-mysql = %{version}-%{release} +Recommends: grafana-opentsdb = %{version}-%{release} +Recommends: grafana-postgres = %{version}-%{release} +Recommends: grafana-prometheus = %{version}-%{release} +Recommends: grafana-stackdriver = %{version}-%{release} +Recommends: grafana-pcp >= 2 %endif -# vendored golang build dependencies -# Note: generated by the Makefile (see README.md) -Provides: bundled(golang(github.com/BurntSushi/toml)) = 0.3.1 -Provides: bundled(golang(github.com/VividCortex/mysqlerr)) = 0.0.0-20170204212430.6c6b55f8796f -Provides: bundled(golang(github.com/aws/aws-sdk-go)) = 1.29.20 -Provides: bundled(golang(github.com/benbjohnson/clock)) = 0.0.0-20161215174838.7dc76406b6d3 -Provides: bundled(golang(github.com/bradfitz/gomemcache)) = 0.0.0-20190329173943.551aad21a668 -Provides: bundled(golang(github.com/crewjam/saml)) = 0.0.0-20191031171751.c42136edf9b1 -Provides: bundled(golang(github.com/davecgh/go-spew)) = 1.1.1 -Provides: bundled(golang(github.com/denisenkom/go-mssqldb)) = 0.0.0-20190707035753.2be1aa521ff4 -Provides: bundled(golang(github.com/facebookgo/inject)) = 0.0.0-20180706035515.f23751cae28b -Provides: bundled(golang(github.com/fatih/color)) = 1.7.0 -Provides: bundled(golang(github.com/go-macaron/binding)) = 0.0.0-20190806013118.0b4f37bab25b -Provides: bundled(golang(github.com/go-macaron/gzip)) = 0.0.0-20160222043647.cad1c6580a07 -Provides: bundled(golang(github.com/go-macaron/session)) = 0.0.0-20190805070824.1a3cdc6f5659 -Provides: bundled(golang(github.com/go-sql-driver/mysql)) = 1.5.0 -Provides: bundled(golang(github.com/go-stack/stack)) = 1.8.0 -Provides: bundled(golang(github.com/gobwas/glob)) = 0.2.3 -Provides: bundled(golang(github.com/golang/protobuf)) = 1.4.0 -Provides: bundled(golang(github.com/google/go-cmp)) = 0.4.0 -Provides: bundled(golang(github.com/gorilla/websocket)) = 1.4.1 -Provides: bundled(golang(github.com/gosimple/slug)) = 1.4.2 -Provides: bundled(golang(github.com/grafana/grafana-plugin-model)) = 0.0.0-20190930120109.1fc953a61fb4 -Provides: bundled(golang(github.com/grafana/grafana-plugin-sdk-go)) = 0.75.0 -Provides: bundled(golang(github.com/hashicorp/go-hclog)) = 0.0.0-20180709165350.ff2cf002a8dd -Provides: bundled(golang(github.com/hashicorp/go-plugin)) = 1.2.2 -Provides: bundled(golang(github.com/hashicorp/go-version)) = 1.1.0 -Provides: bundled(golang(github.com/inconshreveable/log15)) = 0.0.0-20180818164646.67afb5ed74ec -Provides: bundled(golang(github.com/influxdata/influxdb-client-go)) = 1.3.0 -Provides: bundled(golang(github.com/jmespath/go-jmespath)) = 0.0.0-20180206201540.c2b33e8439af -Provides: bundled(golang(github.com/jung-kurt/gofpdf)) = 1.10.1 -Provides: bundled(golang(github.com/lib/pq)) = 1.2.0 -Provides: bundled(golang(github.com/linkedin/goavro/v2)) = 2.9.7 -Provides: bundled(golang(github.com/mattn/go-isatty)) = 0.0.12 -Provides: bundled(golang(github.com/mattn/go-sqlite3)) = 1.11.0 -Provides: bundled(golang(github.com/opentracing/opentracing-go)) = 1.1.0 -Provides: bundled(golang(github.com/patrickmn/go-cache)) = 2.1.0+incompatible -Provides: bundled(golang(github.com/pkg/errors)) = 0.9.1 -Provides: bundled(golang(github.com/prometheus/client_golang)) = 1.3.0 -Provides: bundled(golang(github.com/prometheus/client_model)) = 0.1.0 -Provides: bundled(golang(github.com/prometheus/common)) = 0.7.0 -Provides: bundled(golang(github.com/robfig/cron)) = 0.0.0-20180505203441.b41be1df6967 -Provides: bundled(golang(github.com/robfig/cron/v3)) = 3.0.0 -Provides: bundled(golang(github.com/smartystreets/goconvey)) = 0.0.0-20190731233626.505e41936337 -Provides: bundled(golang(github.com/stretchr/testify)) = 1.5.1 -Provides: bundled(golang(github.com/teris-io/shortid)) = 0.0.0-20171029131806.771a37caa5cf -Provides: bundled(golang(github.com/timberio/go-datemath)) = 0.1.1-0.20200323150745.74ddef604fff -Provides: bundled(golang(github.com/ua-parser/uap-go)) = 0.0.0-20190826212731.daf92ba38329 -Provides: bundled(golang(github.com/uber/jaeger-client-go)) = 2.24.0+incompatible -Provides: bundled(golang(github.com/unknwon/com)) = 1.0.1 -Provides: bundled(golang(github.com/urfave/cli/v2)) = 2.1.1 -Provides: bundled(golang(github.com/xorcare/pointer)) = 1.1.0 -Provides: bundled(golang(github.com/yudai/gojsondiff)) = 1.0.0 -Provides: bundled(golang(golang.org/x/crypto)) = 0.0.0-20200406173513.056763e48d71 -Provides: bundled(golang(golang.org/x/net)) = 0.0.0-20200501053045.e0ff5e5a1de5 -Provides: bundled(golang(golang.org/x/oauth2)) = 0.0.0-20200107190931.bf48bf16ab8d -Provides: bundled(golang(golang.org/x/sync)) = 0.0.0-20200317015054.43a5402ce75a -Provides: bundled(golang(golang.org/x/xerrors)) = 0.0.0-20191204190536.9bdfabe68543 -Provides: bundled(golang(google.golang.org/grpc)) = 1.29.1 -Provides: bundled(golang(gopkg.in/ini.v1)) = 1.46.0 -Provides: bundled(golang(gopkg.in/ldap.v3)) = 3.0.2 -Provides: bundled(golang(gopkg.in/macaron.v1)) = 1.3.9 -Provides: bundled(golang(gopkg.in/mail.v2)) = 2.3.1 -Provides: bundled(golang(gopkg.in/redis.v5)) = 5.2.9 -Provides: bundled(golang(gopkg.in/square/go-jose.v2)) = 2.4.1 -Provides: bundled(golang(gopkg.in/yaml.v2)) = 2.2.8 -Provides: bundled(golang(xorm.io/core)) = 0.7.3 -Provides: bundled(golang(xorm.io/xorm)) = 0.8.1 +%if 0%{?unbundle_vendor_sources} +# golang build deps. These allow us to unbundle vendor golang source. +# Note: generated with the list_go_buildrequires.sh script (see README.md) +BuildRequires: golang(github.com/apache/arrow/go/arrow) +BuildRequires: golang(github.com/apache/arrow/go/arrow/array) +BuildRequires: golang(github.com/apache/arrow/go/arrow/ipc) +BuildRequires: golang(github.com/apache/arrow/go/arrow/memory) +BuildRequires: golang(github.com/aws/aws-sdk-go/aws) +BuildRequires: golang(github.com/aws/aws-sdk-go/aws/awsutil) +BuildRequires: golang(github.com/aws/aws-sdk-go/aws/credentials) +BuildRequires: golang(github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds) +BuildRequires: golang(github.com/aws/aws-sdk-go/aws/credentials/endpointcreds) +BuildRequires: golang(github.com/aws/aws-sdk-go/aws/defaults) +BuildRequires: golang(github.com/aws/aws-sdk-go/aws/ec2metadata) +BuildRequires: golang(github.com/aws/aws-sdk-go/aws/request) +BuildRequires: golang(github.com/aws/aws-sdk-go/aws/session) +BuildRequires: golang(github.com/aws/aws-sdk-go/service/cloudwatch) +BuildRequires: golang(github.com/aws/aws-sdk-go/service/ec2) +BuildRequires: golang(github.com/aws/aws-sdk-go/service/ec2/ec2iface) +BuildRequires: golang(github.com/aws/aws-sdk-go/service/resourcegroupstaggingapi) +BuildRequires: golang(github.com/aws/aws-sdk-go/service/resourcegroupstaggingapi/resourcegroupstaggingapiiface) +BuildRequires: golang(github.com/aws/aws-sdk-go/service/s3/s3manager) +BuildRequires: golang(github.com/aws/aws-sdk-go/service/sts) +BuildRequires: golang(github.com/benbjohnson/clock) +BuildRequires: golang(github.com/bradfitz/gomemcache/memcache) +BuildRequires: golang(github.com/BurntSushi/toml) +BuildRequires: golang(github.com/cheekybits/genny/generic) +BuildRequires: golang(github.com/crewjam/saml) +BuildRequires: golang(github.com/davecgh/go-spew/spew) +BuildRequires: golang(github.com/denisenkom/go-mssqldb) +BuildRequires: golang(github.com/facebookgo/inject) +BuildRequires: golang(github.com/fatih/color) +BuildRequires: golang(github.com/gobwas/glob) +BuildRequires: golang(github.com/golang/protobuf/proto) +BuildRequires: golang(github.com/go-macaron/binding) +BuildRequires: golang(github.com/go-macaron/gzip) +BuildRequires: golang(github.com/go-macaron/session) +BuildRequires: golang(github.com/google/go-cmp/cmp) +BuildRequires: golang(github.com/google/go-cmp/cmp/cmpopts) +BuildRequires: golang(github.com/gorilla/websocket) +BuildRequires: golang(github.com/gosimple/slug) +BuildRequires: golang(github.com/go-sql-driver/mysql) +BuildRequires: golang(github.com/go-stack/stack) +BuildRequires: golang(github.com/go-xorm/core) +BuildRequires: golang(github.com/hashicorp/go-hclog) +BuildRequires: golang(github.com/hashicorp/go-plugin) +BuildRequires: golang(github.com/hashicorp/go-version) +BuildRequires: golang(github.com/inconshreveable/log15) +BuildRequires: golang(github.com/jmespath/go-jmespath) +BuildRequires: golang(github.com/jung-kurt/gofpdf) +BuildRequires: golang(github.com/lib/pq) +BuildRequires: golang(github.com/linkedin/goavro) +BuildRequires: golang(github.com/mattetti/filebuffer) +BuildRequires: golang(github.com/mattn/go-isatty) +BuildRequires: golang(github.com/mattn/go-sqlite3) +BuildRequires: golang(github.com/opentracing/opentracing-go) +BuildRequires: golang(github.com/opentracing/opentracing-go/ext) +BuildRequires: golang(github.com/opentracing/opentracing-go/log) +BuildRequires: golang(github.com/patrickmn/go-cache) +BuildRequires: golang(github.com/pkg/errors) +BuildRequires: golang(github.com/prometheus/client_golang/api) +BuildRequires: golang(github.com/prometheus/client_golang/api/prometheus/v1) +BuildRequires: golang(github.com/prometheus/client_golang/prometheus) +BuildRequires: golang(github.com/prometheus/client_golang/prometheus/promhttp) +BuildRequires: golang(github.com/prometheus/client_model/go) +BuildRequires: golang(github.com/prometheus/common/expfmt) +BuildRequires: golang(github.com/prometheus/common/model) +BuildRequires: golang(github.com/robfig/cron) +BuildRequires: golang(github.com/smartystreets/goconvey/convey) +BuildRequires: golang(github.com/stretchr/testify/require) +BuildRequires: golang(github.com/teris-io/shortid) +BuildRequires: golang(github.com/ua-parser/uap-go/uaparser) +BuildRequires: golang(github.com/uber/jaeger-client-go/config) +BuildRequires: golang(github.com/uber/jaeger-client-go/zipkin) +BuildRequires: golang(github.com/Unknwon/com) +BuildRequires: golang(github.com/urfave/cli/v2) +BuildRequires: golang(github.com/VividCortex/mysqlerr) +BuildRequires: golang(github.com/yudai/gojsondiff) +BuildRequires: golang(github.com/yudai/gojsondiff/formatter) +BuildRequires: golang(golang.org/x/crypto/pbkdf2) +BuildRequires: golang(golang.org/x/net/context) +BuildRequires: golang(golang.org/x/net/context/ctxhttp) +BuildRequires: golang(golang.org/x/oauth2) +BuildRequires: golang(golang.org/x/oauth2/google) +BuildRequires: golang(golang.org/x/oauth2/jwt) +BuildRequires: golang(golang.org/x/sync/errgroup) +BuildRequires: golang(golang.org/x/xerrors) +BuildRequires: golang(google.golang.org/grpc) +BuildRequires: golang(google.golang.org/grpc/codes) +BuildRequires: golang(google.golang.org/grpc/metadata) +BuildRequires: golang(google.golang.org/grpc/status) +BuildRequires: golang(gopkg.in/ini.v1) +BuildRequires: golang(gopkg.in/ldap.v3) +BuildRequires: golang(gopkg.in/macaron.v1) +BuildRequires: golang(gopkg.in/mail.v2) +BuildRequires: golang(gopkg.in/redis.v5) +BuildRequires: golang(gopkg.in/robfig/cron.v3) +BuildRequires: golang(gopkg.in/square/go-jose.v2) +BuildRequires: golang(gopkg.in/square/go-jose.v2/jwt) +BuildRequires: golang(gopkg.in/yaml.v2) +BuildRequires: golang(xorm.io/xorm) +%endif # Declare all nodejs modules bundled in the webpack - this is for security # purposes so if nodejs-foo ever needs an update, affected packages can be # easily identified. -# Note: generated with the Makefile (see README.md) +# Note: generated with the list_bundled_nodejs_packages.sh script (see README.md) +Provides: bundled(nodejs-@braintree/sanitize-url) = 4.0.0 Provides: bundled(nodejs-@grafana/slate-react) = 0.22.9-grafana -Provides: bundled(nodejs-@reduxjs/toolkit) = 1.3.4 +Provides: bundled(nodejs-@reduxjs/toolkit) = 1.2.1 Provides: bundled(nodejs-@torkelo/react-select) = 3.0.8 -Provides: bundled(nodejs-@types/antlr4) = 4.7.1 -Provides: bundled(nodejs-@types/braintree__sanitize-url) = 4.0.0 -Provides: bundled(nodejs-@types/common-tags) = 1.8.0 -Provides: bundled(nodejs-@types/jsurl) = 1.2.28 Provides: bundled(nodejs-@types/md5) = 2.1.33 Provides: bundled(nodejs-@types/react-loadable) = 5.5.2 Provides: bundled(nodejs-@types/react-virtualized-auto-sizer) = 1.0.0 -Provides: bundled(nodejs-@welldone-software/why-did-you-render) = 4.0.6 +Provides: bundled(nodejs-@types/uuid) = 3.4.7 Provides: bundled(nodejs-abortcontroller-polyfill) = 1.4.0 Provides: bundled(nodejs-angular) = 1.6.9 Provides: bundled(nodejs-angular-bindonce) = 0.3.1 Provides: bundled(nodejs-angular-native-dragdrop) = 1.2.2 Provides: bundled(nodejs-angular-route) = 1.6.6 Provides: bundled(nodejs-angular-sanitize) = 1.6.6 -Provides: bundled(nodejs-antlr4) = 4.8.0 Provides: bundled(nodejs-baron) = 3.0.3 -Provides: bundled(nodejs-brace) = 0.11.1 +Provides: bundled(nodejs-brace) = 0.10.0 Provides: bundled(nodejs-calculate-size) = 1.1.1 Provides: bundled(nodejs-classnames) = 2.2.6 Provides: bundled(nodejs-clipboard) = 2.0.4 -Provides: bundled(nodejs-common-tags) = 1.8.0 Provides: bundled(nodejs-core-js) = 1.2.7 Provides: bundled(nodejs-d3) = 5.15.0 Provides: bundled(nodejs-d3-scale-chromatic) = 1.5.0 -Provides: bundled(nodejs-dangerously-set-html-content) = 1.0.6 Provides: bundled(nodejs-emotion) = 10.0.27 -Provides: bundled(nodejs-eventemitter3) = 3.1.2 +Provides: bundled(nodejs-eventemitter3) = 2.0.3 Provides: bundled(nodejs-fast-text-encoding) = 1.0.0 -Provides: bundled(nodejs-file-saver) = 2.0.2 -Provides: bundled(nodejs-hoist-non-react-statics) = 2.5.5 +Provides: bundled(nodejs-file-saver) = 1.3.8 +Provides: bundled(nodejs-hoist-non-react-statics) = 3.3.0 Provides: bundled(nodejs-immutable) = 3.8.2 Provides: bundled(nodejs-is-hotkey) = 0.1.4 Provides: bundled(nodejs-jquery) = 3.4.1 -Provides: bundled(nodejs-jsurl) = 0.1.5 Provides: bundled(nodejs-lodash) = 3.10.1 Provides: bundled(nodejs-lru-cache) = 4.1.5 Provides: bundled(nodejs-marked) = 0.3.19 Provides: bundled(nodejs-md5) = 2.2.1 Provides: bundled(nodejs-memoize-one) = 4.1.0 Provides: bundled(nodejs-moment) = 2.24.0 -Provides: bundled(nodejs-moment-timezone) = 0.5.28 -Provides: bundled(nodejs-mousetrap) = 1.6.5 +Provides: bundled(nodejs-mousetrap) = 1.6.3 Provides: bundled(nodejs-mousetrap-global-bind) = 1.1.0 -Provides: bundled(nodejs-nodemon) = 2.0.2 +Provides: bundled(nodejs-nodemon) = 1.18.10 Provides: bundled(nodejs-papaparse) = 4.6.3 -Provides: bundled(nodejs-prismjs) = 1.17.1 +Provides: bundled(nodejs-prismjs) = 1.16.0 Provides: bundled(nodejs-prop-types) = 15.7.2 -Provides: bundled(nodejs-rc-cascader) = 1.0.1 +Provides: bundled(nodejs-rc-cascader) = 0.17.5 Provides: bundled(nodejs-re-resizable) = 6.2.0 Provides: bundled(nodejs-react) = 16.10.2 Provides: bundled(nodejs-react-dom) = 16.10.2 Provides: bundled(nodejs-react-grid-layout) = 0.17.1 -Provides: bundled(nodejs-react-highlight-words) = 0.16.0 +Provides: bundled(nodejs-react-highlight-words) = 0.11.0 Provides: bundled(nodejs-react-loadable) = 5.5.0 Provides: bundled(nodejs-react-popper) = 1.3.3 -Provides: bundled(nodejs-react-redux) = 7.2.0 -Provides: bundled(nodejs-react-sizeme) = 2.6.8 +Provides: bundled(nodejs-react-redux) = 7.1.1 +Provides: bundled(nodejs-react-sizeme) = 2.5.2 Provides: bundled(nodejs-react-split-pane) = 0.1.89 -Provides: bundled(nodejs-react-transition-group) = 2.9.0 -Provides: bundled(nodejs-react-use) = 13.27.0 +Provides: bundled(nodejs-react-transition-group) = 2.6.1 +Provides: bundled(nodejs-react-use) = 12.8.0 Provides: bundled(nodejs-react-virtualized-auto-sizer) = 1.0.2 -Provides: bundled(nodejs-react-window) = 1.8.5 +Provides: bundled(nodejs-react-window) = 1.7.1 Provides: bundled(nodejs-redux) = 3.7.2 Provides: bundled(nodejs-redux-logger) = 3.0.6 Provides: bundled(nodejs-redux-thunk) = 2.3.0 Provides: bundled(nodejs-regenerator-runtime) = 0.11.1 Provides: bundled(nodejs-reselect) = 4.0.0 Provides: bundled(nodejs-rst2html) = 1.0.4 -Provides: bundled(nodejs-rxjs) = 6.5.5 -Provides: bundled(nodejs-search-query-parser) = 1.5.4 +Provides: bundled(nodejs-rxjs) = 5.5.12 +Provides: bundled(nodejs-search-query-parser) = 1.5.2 Provides: bundled(nodejs-slate) = 0.47.8 Provides: bundled(nodejs-slate-plain-serializer) = 0.7.10 -Provides: bundled(nodejs-tether) = 1.4.7 +Provides: bundled(nodejs-tether) = 1.4.5 Provides: bundled(nodejs-tether-drop) = 1.5.0 Provides: bundled(nodejs-tinycolor2) = 1.4.1 Provides: bundled(nodejs-tti-polyfill) = 0.2.2 +Provides: bundled(nodejs-uuid) = 3.3.3 Provides: bundled(nodejs-whatwg-fetch) = 3.0.0 +Provides: bundled(nodejs-xss) = 1.0.3 %description @@ -242,19 +272,105 @@ Grafana is an open source, feature rich metrics dashboard and graph editor for Graphite, InfluxDB & OpenTSDB. +%package cloudwatch +Requires: %{name} = %{version}-%{release} +Summary: Grafana cloudwatch datasource + +%description cloudwatch +The Grafana cloudwatch datasource. + +%package elasticsearch +Requires: %{name} = %{version}-%{release} +Summary: Grafana elasticsearch datasource + +%description elasticsearch +The Grafana elasticsearch datasource. + +%package azure-monitor +Requires: %{name} = %{version}-%{release} +Summary: Grafana azure-monitor datasource + +%description azure-monitor +The Grafana azure-monitor datasource. + +%package graphite +Requires: %{name} = %{version}-%{release} +Summary: Grafana graphite datasource + +%description graphite +The Grafana graphite datasource. + +%package influxdb +Requires: %{name} = %{version}-%{release} +Summary: Grafana influxdb datasource + +%description influxdb +The Grafana influxdb datasource. + +%package loki +Requires: %{name} = %{version}-%{release} +Summary: Grafana loki datasource + +%description loki +The Grafana loki datasource. + +%package mssql +Requires: %{name} = %{version}-%{release} +Summary: Grafana mssql datasource + +%description mssql +The Grafana mssql datasource. + +%package mysql +Requires: %{name} = %{version}-%{release} +Summary: Grafana mysql datasource + +%description mysql +The Grafana mysql datasource. + +%package opentsdb +Requires: %{name} = %{version}-%{release} +Summary: Grafana opentsdb datasource + +%description opentsdb +The Grafana opentsdb datasource. + +%package postgres +Requires: %{name} = %{version}-%{release} +Summary: Grafana postgres datasource + +%description postgres +The Grafana postgres datasource. + +%package prometheus +Requires: %{name} = %{version}-%{release} +Summary: Grafana prometheus datasource + +%description prometheus +The Grafana prometheus datasource. + +%package stackdriver +Requires: %{name} = %{version}-%{release} +Summary: Grafana stackdriver datasource + +%description stackdriver +The Grafana stackdriver datasource. + + %prep %setup -q -T -D -b 0 -rm -r plugins-bundled # compiled bundled plugins are in grafana-webpack %setup -q -T -D -b 1 -%setup -q -T -D -b 2 - %patch1 -p1 %patch2 -p1 -%if 0%{?fedora} >= 33 %patch3 -p1 -%endif -%ifarch s390x %patch4 -p1 +%patch6 -p1 + +%if 0%{?unbundle_vendor_sources} +%patch5 -p1 +%patch7 -p1 +%patch8 -p1 +%patch9 -p1 %endif # Set up build subdirs and links @@ -262,32 +378,59 @@ mkdir -p %{_builddir}/src/github.com/grafana ln -sf %{_builddir}/%{name}-%{version} \ %{_builddir}/src/github.com/grafana/grafana +# remove some (apparent) development files, for rpmlint +rm -f public/sass/.sass-lint.yml public/test/.jshintrc + +%if 0%{?unbundle_vendor_sources} +# Unbundle all grafana vendor sources, as per BuildRequires above. +# Note there are some exceptions. +cp --parents -a \ + vendor/github.com/grafana/grafana-plugin-model \ + vendor/github.com/grafana/grafana-plugin-sdk-go \ + %{_builddir} +rm -r vendor # remove all vendor sources +mv %{_builddir}/vendor vendor # put back what we're keeping +%endif %build # Build the server-side binaries cd %{_builddir}/src/github.com/grafana/grafana -export GOPATH=%{_builddir} +%global archbindir bin/`go env GOOS`-`go env GOARCH` +echo _builddir=%{_builddir} archbindir=%{archbindir} gopath=%{gopath} +[ ! -d %{archbindir} ] && mkdir -p %{archbindir} + +# non-modular build +export GOPATH=%{_builddir}:%{gopath} +export GO111MODULE=off; rm -f go.mod # see grafana-X.X.X/build.go export LDFLAGS="-X main.version=%{version} -X main.buildstamp=${SOURCE_DATE_EPOCH}" for cmd in grafana-cli grafana-server; do - %gobuild -o %{_builddir}/bin/${cmd} ./pkg/cmd/${cmd} + %gobuild -o %{archbindir}/${cmd} ./pkg/cmd/${cmd} done %install +# Fix up arch bin directories +[ ! -d bin/x86_64 ] && ln -sf linux-amd64 bin/x86_64 +[ ! -d bin/i386 ] && ln -sf linux-386 bin/i386 +[ ! -d bin/ppc64le ] && ln -sf linux-ppc64le bin/ppc64le +[ ! -d bin/s390x ] && ln -sf linux-s390x bin/s390x +[ ! -d bin/arm ] && ln -sf linux-arm bin/arm +[ ! -d bin/arm64 ] && ln -sf linux-arm64 bin/aarch64 +[ ! -d bin/aarch64 ] && ln -sf linux-aarch64 bin/aarch64 # dirs, shared files, public html, webpack install -d %{buildroot}%{_sbindir} install -d %{buildroot}%{_datadir}/%{name} install -d %{buildroot}%{_libexecdir}/%{name} -cp -a conf public plugins-bundled %{buildroot}%{_datadir}/%{name} +cp -a conf public %{buildroot}%{_datadir}/%{name} # wrappers install -p -m 755 packaging/wrappers/grafana-cli %{buildroot}%{_sbindir}/%{name}-cli # binaries -install -p -m 755 %{_builddir}/bin/%{name}-server %{buildroot}%{_sbindir} -install -p -m 755 %{_builddir}/bin/%{name}-cli %{buildroot}%{_libexecdir}/%{name} +install -p -m 755 %{archbindir}/%{name}-server %{buildroot}%{_sbindir} +install -p -m 755 %{archbindir}/%{name}-cli %{buildroot}%{_libexecdir}/%{name} # man pages install -d %{buildroot}%{_mandir}/man1 @@ -295,17 +438,12 @@ install -p -m 644 docs/man/man1/* %{buildroot}%{_mandir}/man1 # config dirs install -d %{buildroot}%{_sysconfdir}/%{name} -install -d %{buildroot}%{_sysconfdir}/%{name}/provisioning -install -d %{buildroot}%{_sysconfdir}/%{name}/provisioning/dashboards -install -d %{buildroot}%{_sysconfdir}/%{name}/provisioning/datasources -install -d %{buildroot}%{_sysconfdir}/%{name}/provisioning/notifiers -install -d %{buildroot}%{_sysconfdir}/%{name}/provisioning/plugins install -d %{buildroot}%{_sysconfdir}/sysconfig # config defaults -install -p -m 640 %{SOURCE3} %{buildroot}%{_sysconfdir}/%{name}/grafana.ini +install -p -m 640 %{SOURCE2} %{buildroot}%{_sysconfdir}/%{name}/grafana.ini install -p -m 640 conf/ldap.toml %{buildroot}%{_sysconfdir}/%{name}/ldap.toml -install -p -m 644 %{SOURCE3} %{buildroot}%{_datadir}/%{name}/conf/defaults.ini +install -p -m 644 %{SOURCE2} %{buildroot}%{_datadir}/%{name}/conf/defaults.ini install -p -m 644 packaging/rpm/sysconfig/grafana-server \ %{buildroot}%{_sysconfdir}/sysconfig/grafana-server @@ -365,11 +503,12 @@ chmod 640 %{_sysconfdir}/%{name}/ldap.toml %check cd %{_builddir}/src/github.com/grafana/grafana -export GOPATH=%{_builddir} +export GOPATH=%{_builddir}:%{gopath} # remove tests currently failing - these two are due to a symlink # BUILD/src/github.com/grafana/grafana -> BUILD/grafana-6.6.1 rm -f pkg/services/provisioning/dashboards/file_reader_linux_test.go rm -f pkg/services/provisioning/dashboards/file_reader_test.go +export GO111MODULE=off %gotest ./pkg/... @@ -381,24 +520,36 @@ rm -f pkg/services/provisioning/dashboards/file_reader_test.go # config files %dir %{_sysconfdir}/%{name} -%attr(0755, root, %{GRAFANA_GROUP}) %dir %{_sysconfdir}/%{name}/provisioning -%attr(0755, root, %{GRAFANA_GROUP}) %dir %{_sysconfdir}/%{name}/provisioning/dashboards -%attr(0755, root, %{GRAFANA_GROUP}) %dir %{_sysconfdir}/%{name}/provisioning/datasources -%attr(0755, root, %{GRAFANA_GROUP}) %dir %{_sysconfdir}/%{name}/provisioning/notifiers -%attr(0755, root, %{GRAFANA_GROUP}) %dir %{_sysconfdir}/%{name}/provisioning/plugins -%config(noreplace) %attr(0640, root, %{GRAFANA_GROUP}) %{_sysconfdir}/%{name}/grafana.ini -%config(noreplace) %attr(0640, root, %{GRAFANA_GROUP}) %{_sysconfdir}/%{name}/ldap.toml +%config(noreplace) %attr(640, root, %{GRAFANA_GROUP}) %{_sysconfdir}/%{name}/grafana.ini +%config(noreplace) %attr(640, root, %{GRAFANA_GROUP}) %{_sysconfdir}/%{name}/ldap.toml %config(noreplace) %{_sysconfdir}/sysconfig/grafana-server # Grafana configuration to dynamically create /run/grafana/grafana.pid on tmpfs %{_tmpfilesdir}/%{name}.conf # config database directory and plugins -%attr(0750, %{GRAFANA_USER}, %{GRAFANA_GROUP}) %dir %{_sharedstatedir}/%{name} +%attr(750, %{GRAFANA_USER}, %{GRAFANA_GROUP}) %dir %{_sharedstatedir}/%{name} %attr(-, %{GRAFANA_USER}, %{GRAFANA_GROUP}) %dir %{_sharedstatedir}/%{name}/plugins -# shared directory and all files therein +# shared directory and all files therein, except some datasources %{_datadir}/%{name} + +# built-in datasources that are sub-packaged +%global dsdir %{_datadir}/%{name}/public/app/plugins/datasource +%exclude %{dsdir}/cloudwatch +%exclude %{dsdir}/elasticsearch +%exclude %{dsdir}/graphite +%exclude %{dsdir}/grafana-azure-monitor-datasource +%exclude %{dsdir}/influxdb +%exclude %{dsdir}/loki +%exclude %{dsdir}/mssql +%exclude %{dsdir}/mysql +%exclude %{dsdir}/opentsdb +%exclude %{dsdir}/postgres +%exclude %{dsdir}/prometheus +%exclude %{dsdir}/stackdriver + +%dir %{_datadir}/%{name}/conf %attr(-, root, %{GRAFANA_GROUP}) %{_datadir}/%{name}/conf/* # systemd service file @@ -413,23 +564,61 @@ rm -f pkg/services/provisioning/dashboards/file_reader_test.go # other docs and license %license LICENSE -%doc CHANGELOG.md CODE_OF_CONDUCT.md CONTRIBUTING.md GOVERNANCE.md ISSUE_TRIAGE.md MAINTAINERS.md NOTICE.md -%doc PLUGIN_DEV.md README.md ROADMAP.md SECURITY.md SUPPORT.md UPGRADING_DEPENDENCIES.md WORKFLOW.md +%doc CHANGELOG.md CODE_OF_CONDUCT.md CONTRIBUTING.md NOTICE.md +%doc PLUGIN_DEV.md README.md ROADMAP.md UPGRADING_DEPENDENCIES.md + +# +# datasources split out into subpackages +# +%files cloudwatch +%{_datadir}/%{name}/public/app/plugins/datasource/cloudwatch +%doc %{_datadir}/%{name}/public/app/plugins/datasource/cloudwatch/README.md + +%files elasticsearch +%{_datadir}/%{name}/public/app/plugins/datasource/elasticsearch +%doc %{_datadir}/%{name}/public/app/plugins/datasource/elasticsearch/README.md + +%files azure-monitor +%{_datadir}/%{name}/public/app/plugins/datasource/grafana-azure-monitor-datasource + +%files graphite +%{_datadir}/%{name}/public/app/plugins/datasource/graphite +%doc %{_datadir}/%{name}/public/app/plugins/datasource/graphite/README.md + +%files influxdb +%{_datadir}/%{name}/public/app/plugins/datasource/influxdb +%doc %{_datadir}/%{name}/public/app/plugins/datasource/influxdb/README.md + +%files loki +%{_datadir}/%{name}/public/app/plugins/datasource/loki +%doc %{_datadir}/%{name}/public/app/plugins/datasource/loki/README.md + +%files mssql +%{_datadir}/%{name}/public/app/plugins/datasource/mssql +%doc %{_datadir}/%{name}/public/app/plugins/datasource/mssql/README.md + +%files mysql +%{_datadir}/%{name}/public/app/plugins/datasource/mysql +%doc %{_datadir}/%{name}/public/app/plugins/datasource/mysql/README.md + +%files opentsdb +%{_datadir}/%{name}/public/app/plugins/datasource/opentsdb +%doc %{_datadir}/%{name}/public/app/plugins/datasource/opentsdb/README.md + +%files postgres +%{_datadir}/%{name}/public/app/plugins/datasource/postgres +%doc %{_datadir}/%{name}/public/app/plugins/datasource/postgres/README.md + +%files prometheus +%{_datadir}/%{name}/public/app/plugins/datasource/prometheus +%doc %{_datadir}/%{name}/public/app/plugins/datasource/prometheus/README.md + +%files stackdriver +%{_datadir}/%{name}/public/app/plugins/datasource/stackdriver +%doc %{_datadir}/%{name}/public/app/plugins/datasource/stackdriver/README.md %changelog -* Sat Aug 01 2020 Fedora Release Engineering - 7.1.1-2 -- Second attempt - Rebuilt for - https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild - -* Thu Jul 30 2020 Andreas Gerstmayr 7.1.1-1 -- update to 7.1.1 tagged upstream community sources, see CHANGELOG -- merge all datasources into main grafana package -- bundle golang dependencies - -* Tue Jul 28 2020 Fedora Release Engineering - 6.7.4-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild - * Fri Jun 05 2020 Andreas Gerstmayr 6.7.4-1 - update to 6.7.4 tagged upstream community sources, see CHANGELOG - security fix for CVE-2020-13379 diff --git a/create_webpack_manifest.py b/list_bundled_nodejs_packages.py similarity index 100% rename from create_webpack_manifest.py rename to list_bundled_nodejs_packages.py diff --git a/list_go_buildrequires.sh b/list_go_buildrequires.sh new file mode 100755 index 0000000..62e4d06 --- /dev/null +++ b/list_go_buildrequires.sh @@ -0,0 +1,20 @@ +#!/bin/bash -eu + +[ $# -ne 1 ] && echo "Usage: $0 grafana-X.Y.Z/" && exit 1 +GRAFANA_SOURCES="$(readlink -f "$1")" + +cd "$(mktemp -d)" +mkdir -p src/github.com/grafana +ln -s "${GRAFANA_SOURCES}" src/github.com/grafana/grafana +ln -s "${GRAFANA_SOURCES}/vendor/github.com/grafana/grafana-plugin-model" src/github.com/grafana/grafana-plugin-model +ln -s "${GRAFANA_SOURCES}/vendor/github.com/grafana/grafana-plugin-sdk-go" src/github.com/grafana/grafana-plugin-sdk-go + +for pkg in grafana grafana-plugin-model grafana-plugin-sdk-go +do + GOPATH=$(pwd) golist --imported --package-path "github.com/grafana/$pkg" --skip-self --template 'BuildRequires: golang({{.}})\n' +done | sed \ + -e "s,github.com/linkedin/goavro/v2,github.com/linkedin/goavro,g" \ + -e "s,github.com/go-xorm/xorm,xorm.io/xorm,g" \ + -e "s,github.com/robfig/cron/v3,gopkg.in/robfig/cron.v3,g" \ + -e "s,github.com/unknwon/com,github.com/Unknwon/com,g" \ + | sort | uniq diff --git a/make_grafana_webpack.sh b/make_grafana_webpack.sh new file mode 100755 index 0000000..7baf487 --- /dev/null +++ b/make_grafana_webpack.sh @@ -0,0 +1,58 @@ +#! /bin/bash +# +# Copyright (c) 2019-2020 Red Hat. +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# + +[ $# -ne 1 ] && echo "Usage: $0 version" && exit 1 + +# grafana version (must be tagged on github.com/grafana/grafana as "v$VER") +VER=$1 + +command -v yarn || { echo Error, please install the yarn package manager. && exit 1; } + +# get src tree and set cwd +echo Fetching pristine upstream git tagged branch for grafana version v$VER ... +git clone https://github.com/grafana/grafana grafana-$VER +cd grafana-$VER +git checkout -b v$VER v$VER + +# exclude the phantomjs-prebuilt binary module from the webpack +sed -i '/phantomjs-prebuilt/d' package.json + +# nuke grunt task for copying phantomjs +rm -f scripts/grunt/options/phantomjs.js +sed -i '/phantomjs/d' scripts/grunt/*.js + +# populate node_modules using package.json +echo Running yarn to populate local node_modules .... +yarn --non-interactive --no-progress --ignore-engines install --pure-lockfile > yarn.out 2>&1 + +# build the webpack +echo;echo Building production webpack .... +node_modules/webpack/bin/webpack.js --display errors-only --mode production --config scripts/webpack/webpack.prod.js + +cd .. + +# webpack tarball. Includes public/views because index.html references the webpack +tar czf grafana_webpack-$VER.tar.gz grafana-$VER/public/build grafana-$VER/public/views + +# source tarball (if needed) +if [ ! -f grafana-$VER.tar.gz ]; then + wget --quiet -O grafana-$VER.tar.gz https://github.com/grafana/grafana/archive/v$VER/grafana-$VER.tar.gz +fi + +# done +echo Both grafana-$VER.tar.gz and grafana_webpack-$VER.tar.gz +echo should now be in your working directory. + +exit 0 diff --git a/run_container_build.sh b/run_container_build.sh index 69ed10d..e6746e6 100755 --- a/run_container_build.sh +++ b/run_container_build.sh @@ -16,7 +16,7 @@ RUN mkdir /grafana /deps ${INSTALL_UNPUBLISHED_DEPENDENCIES} -COPY grafana.spec *.patch grafana-*.tar.gz distro-defaults.ini Makefile create_webpack_manifest.py /grafana +COPY grafana.spec *.patch grafana-*.tar.gz grafana_webpack-*.tar.gz make_grafana_webpack.sh distro-defaults.ini /grafana WORKDIR /grafana RUN dnf -y builddep grafana.spec RUN rpkg local diff --git a/sources b/sources index 0bf5376..212fa97 100644 --- a/sources +++ b/sources @@ -1,3 +1,2 @@ -SHA512 (grafana-7.1.1.tar.gz) = 487322d6d26cdc1ce6fc03719ded482380c2be4bb01279367ff166b2bc9e3ca7691edc32a6c42bb9a64eb39d6620ca47855786e259dbfeb636585add5e1fe5b0 -SHA512 (grafana-vendor-7.1.1.tar.gz) = 966ec92abdd644e4a189e8c381c0ffc6e54995983ae4746eee183cdc65a6817e3368faf1366990795cb18299fe8a9883257ba7e2b7b5f24db0631e16ae223884 -SHA512 (grafana-webpack-7.1.1.tar.gz) = 5e271ecd9539dba4f902d3c2a14e5deb5b0f1fa686d20bf6ac3db11af54c6571477a56d270dae9c43f374c485c7cdc48155acfdeb7428ac3a1a09dd6abc71d90 +SHA512 (grafana-6.7.4.tar.gz) = f05f09d476a8be4b7d331f8a769c3353b0fffd17b3317fe1c14aa8a776187cdfdf4b9a13fb58d0b40c7734f603af2c47220aa8c40797acad0258275705167166 +SHA512 (grafana_webpack-6.7.4.tar.gz) = 3182caa9fd7d9398b6cd3ed596558c2d051c99c359bd8de80f149e5fb55f7f003b5e7679786e8c9861b2afe1ddd5056c36b702145dd0a89d5d184cbe1e9b14bd