From 65aa925483ddc4f64f6f7b093f29ad6f692eeb69 Mon Sep 17 00:00:00 2001 From: wk333 <13474090681@163.com> Date: Thu, 13 Apr 2023 20:06:36 +0800 Subject: [PATCH] Fix gtime_test --- fix-gtime_test.patch | 50 ++++++++++++++++++++++++++++++++++++++++++++ grafana.spec | 8 ++++++- 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 fix-gtime_test.patch diff --git a/fix-gtime_test.patch b/fix-gtime_test.patch new file mode 100644 index 0000000..02b0fa0 --- /dev/null +++ b/fix-gtime_test.patch @@ -0,0 +1,50 @@ +From 3e491ce63e1c8f63abc891765848a7484f0d6005 Mon Sep 17 00:00:00 2001 +From: Andres Martinez Gotor +Date: Wed, 1 Mar 2023 13:08:34 +0100 +Subject: [PATCH] fix gtime_test (#637) + +--- + pkg/components/gtime/gtime_test.go | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/pkg/components/gtime/gtime_test.go b/pkg/components/gtime/gtime_test.go +index 0b1b23a..a7b952d 100644 +--- a/pkg/components/gtime/gtime_test.go ++++ b/pkg/components/gtime/gtime_test.go +@@ -72,13 +72,13 @@ func TestParseDuration(t *testing.T) { + + func calculateDays() (int, int) { + now := time.Now().UTC() +- currentYear, currentMonth, _ := now.Date() ++ currentYear, currentMonth, currentDay := now.Date() + + firstDayOfMonth := time.Date(currentYear, currentMonth, 1, 0, 0, 0, 0, time.UTC) + daysInMonth := firstDayOfMonth.AddDate(0, 1, -1).Day() + +- t1 := time.Date(currentYear, 1, 1, 0, 0, 0, 0, time.UTC) +- t2 := time.Date(currentYear+1, 1, 1, 0, 0, 0, 0, time.UTC) ++ t1 := time.Date(currentYear, currentMonth, currentDay, 0, 0, 0, 0, time.UTC) ++ t2 := t1.AddDate(1, 0, 0) + + daysInYear := int(t2.Sub(t1).Hours() / 24) + +@@ -87,13 +87,13 @@ func calculateDays() (int, int) { + + func calculateDays5y() int { + now := time.Now().UTC() +- currentYear, _, _ := now.Date() ++ currentYear, currentMonth, currentDay := now.Date() + + var daysInYear int + + for i := 0; i < 5; i++ { +- t1 := time.Date(currentYear+i, 1, 1, 0, 0, 0, 0, time.UTC) +- t2 := time.Date(currentYear+i+1, 1, 1, 0, 0, 0, 0, time.UTC) ++ t1 := time.Date(currentYear+i, currentMonth, currentDay, 0, 0, 0, 0, time.UTC) ++ t2 := t1.AddDate(1, 0, 0) + + daysInYear = daysInYear + int(t2.Sub(t1).Hours()/24) + } +-- +2.33.0 + diff --git a/grafana.spec b/grafana.spec index f8df3a7..f0847ef 100644 --- a/grafana.spec +++ b/grafana.spec @@ -7,7 +7,7 @@ Name: grafana Version: 7.5.15 -Release: 3 +Release: 4 Summary: Metrics dashboard and graph editor License: Apache 2.0 URL: https://grafana.org @@ -46,6 +46,8 @@ Patch15: 015-CVE-2022-21698.vendor.patch #https://github.com/grafana/grafana/pull/49223 Patch16: CVE-2022-29170.patch Patch17: CVE-2022-31107.patch +# https://github.com/grafana/grafana-plugin-sdk-go/pull/637 +Patch18: fix-gtime_test.patch BuildRequires: git, systemd, golang @@ -421,6 +423,7 @@ rm -r plugins-bundled %patch15 -p1 %patch16 -p1 %patch17 -p1 +%patch18 -p1 # Set up build subdirs and links @@ -585,6 +588,9 @@ rm -r pkg/macaron %changelog +* Thu Apr 13 2023 wangkai <13474090681@163.com> - 7.5.15-4 +- Fix gtime_test + * Wed Aug 17 2022 yaoxin - 7.5.15-3 - Fix CVE-2022-31107 -- Gitee