From b758ff07455eecdbf579447847c235ac04bbc816 Mon Sep 17 00:00:00 2001 From: desert-sailor Date: Thu, 13 Apr 2023 19:44:43 +0800 Subject: [PATCH] bugfix for gtime test fail --- 018-fix-gtime-test-fail.patch | 50 +++++++++++++++++++++++++++++++++++ grafana.spec | 7 ++++- 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 018-fix-gtime-test-fail.patch diff --git a/018-fix-gtime-test-fail.patch b/018-fix-gtime-test-fail.patch new file mode 100644 index 0000000..4dfebad --- /dev/null +++ b/018-fix-gtime-test-fail.patch @@ -0,0 +1,50 @@ +From 0a611b22feda385cb24b971ae785bc55b4f6741e Mon Sep 17 00:00:00 2001 +From: desert-sailor +Date: Thu, 13 Apr 2023 19:36:38 +0800 +Subject: [PATCH] bugfix for gtime test fail sync upstream patch + +--- + 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..8cc1fb1 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,7 @@ Patch15: 015-CVE-2022-21698.vendor.patch #https://github.com/grafana/grafana/pull/49223 Patch16: CVE-2022-29170.patch Patch17: CVE-2022-31107.patch +Patch18: 018-fix-gtime-test-fail.patch BuildRequires: git, systemd, golang @@ -421,6 +422,7 @@ rm -r plugins-bundled %patch15 -p1 %patch16 -p1 %patch17 -p1 +%patch18 -p1 # Set up build subdirs and links @@ -585,6 +587,9 @@ rm -r pkg/macaron %changelog +* Thu Apr 13 2023 Dongxing Wang - 7.5.15-4 +- Fix gtime test fail, sync upstream patch + * Wed Aug 17 2022 yaoxin - 7.5.15-3 - Fix CVE-2022-31107 -- Gitee