Update package to version 0.15.0

(cherry picked from commit 764bb6e23989ef8c07cc95c0554ea8fbde43ae1d)
This commit is contained in:
jxy_git 2023-09-07 16:35:29 +08:00 committed by openeuler-sync-bot
parent eb624969e7
commit f82aad19a5
6 changed files with 40 additions and 109 deletions

View File

@ -1,8 +1,19 @@
--- c/.promu.yml 2023-03-07 11:30:19.037256381 +0800
+++ a/.promu.yml 2023-03-07 11:32:48.661260604 +0800
@@ -7,12 +7,11 @@ repository:
build:
flags: -mod=vendor -a -tags 'netgo static_build'
From b754346641b7875dc920c26dcf96a7541e5365ba Mon Sep 17 00:00:00 2001
From: jxy_git <jiangxinyu@kylinos.cn>
Date: Thu, 7 Sep 2023 16:02:54 +0800
Subject: [PATCH] add parameters to solve the strip
---
.promu.yml | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/.promu.yml b/.promu.yml
index 45081b8..d586c86 100644
--- a/.promu.yml
+++ b/.promu.yml
@@ -10,12 +10,11 @@ build:
windows: [static_build]
flags: -a
ldflags: |
- -s
- -X github.com/prometheus/common/version.Version={{.Version}}
@ -18,3 +29,6 @@
tarball:
files:
- LICENSE
--
2.41.0

BIN
promu-0.15.0.tar.gz Normal file

Binary file not shown.

BIN
promu-vendor.tar.gz Normal file

Binary file not shown.

View File

@ -1,46 +1,47 @@
%define debug_package %{nil}
Name: promu
Version: 0.7.0
Release: 4
Summary: Prometheus Utility Tool
License: ASL 2.0
URL: https://github.com/prometheus/promu
Name: promu
Version: 0.15.0
Release: 1
Summary: Prometheus Utility Tool
License: Apache-2.0
URL: https://github.com/prometheus/promu
Source0: https://github.com/prometheus/promu/archive/refs/tags/v%{version}.tar.gz#/promu-0.15.0.tar.gz
# tar -xvf Source0
# run 'go mod vendor' in it
# tar -czvf promu-vendor.tar.gz vendor
Source1: promu-vendor.tar.gz
Patch0: add-parameters-to-solve-the-strip.patch
Source0: https://github.com/prometheus/promu/archive/v%{version}.tar.gz
Patch0: add-parameters-to-solve-the-strip.patch
BuildRequires: golang >= 1.14
BuildRequires: gcc
#RISC-V support
Patch100: riscv64-support.patch
BuildRequires: golang >= 1.13
BuildRequires: gcc
Conflicts: promu
Provides: %{name} = %{version}
Conflicts: promu
Provides: %{name} = %{version}-%{release}
%description
promu is the utility tool for building and releasing Prometheus projects
%prep
%setup -q -T -n %{name}-%{version} -b 0
tar -xzvf %{SOURCE1}
%patch0 -p1
%ifarch riscv64
%patch100 -p1
%endif
%build
export GOFLAGS="-mod=vendor -buildmode=pie"
make build
%install
install -D -m 755 %{name}-%{version} %{buildroot}%{_bindir}/promu
install -D -m 0755 %{name}-%{version} %{buildroot}%{_bindir}/promu
%files
%defattr(-,root,root,-)
%{_bindir}/promu
%changelog
* Thu Sep 07 2023 jiangxinyu <jiangxinyu@kylinos.cn> - 0.15.0-1
- Update package to version 0.15.0
* Wed Jun 14 2023 EastDong <xudong23@iscas.ac.cn> - 0.7.0-4
- backport to support riscv

View File

@ -1,84 +0,0 @@
diff --git a/vendor/github.com/prometheus/procfs/cpuinfo.go b/vendor/github.com/prometheus/procfs/cpuinfo.go
index 31d42f7..02693d1 100644
--- a/vendor/github.com/prometheus/procfs/cpuinfo.go
+++ b/vendor/github.com/prometheus/procfs/cpuinfo.go
@@ -19,6 +19,7 @@ import (
"bufio"
"bytes"
"errors"
+ "fmt"
"regexp"
"strconv"
"strings"
@@ -407,6 +408,46 @@ func parseCPUInfoPPC(info []byte) ([]CPUInfo, error) {
return cpuinfo, nil
}
+func parseCPUInfoRISCV(info []byte) ([]CPUInfo, error) {
+ scanner := bufio.NewScanner(bytes.NewReader(info))
+
+ firstLine := firstNonEmptyLine(scanner)
+ if !strings.HasPrefix(firstLine, "processor") || !strings.Contains(firstLine, ":") {
+ return nil, fmt.Errorf("invalid cpuinfo file: %q", firstLine)
+ }
+ field := strings.SplitN(firstLine, ": ", 2)
+ v, err := strconv.ParseUint(field[1], 0, 32)
+ if err != nil {
+ return nil, err
+ }
+ firstcpu := CPUInfo{Processor: uint(v)}
+ cpuinfo := []CPUInfo{firstcpu}
+ i := 0
+
+ for scanner.Scan() {
+ line := scanner.Text()
+ if !strings.Contains(line, ":") {
+ continue
+ }
+ field := strings.SplitN(line, ": ", 2)
+ switch strings.TrimSpace(field[0]) {
+ case "processor":
+ v, err := strconv.ParseUint(field[1], 0, 32)
+ if err != nil {
+ return nil, err
+ }
+ i = int(v)
+ cpuinfo = append(cpuinfo, CPUInfo{}) // start of the next processor
+ cpuinfo[i].Processor = uint(v)
+ case "hart":
+ cpuinfo[i].CoreID = field[1]
+ case "isa":
+ cpuinfo[i].ModelName = field[1]
+ }
+ }
+ return cpuinfo, nil
+}
+
// firstNonEmptyLine advances the scanner to the first non-empty line
// and returns the contents of that line
func firstNonEmptyLine(scanner *bufio.Scanner) string {
diff --git a/vendor/github.com/prometheus/procfs/cpuinfo_riscvx.go b/vendor/github.com/prometheus/procfs/cpuinfo_riscvx.go
new file mode 100644
index 0000000..e83c2e2
--- /dev/null
+++ b/vendor/github.com/prometheus/procfs/cpuinfo_riscvx.go
@@ -0,0 +1,19 @@
+// Copyright 2020 The Prometheus Authors
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// +build linux
+// +build riscv riscv64
+
+package procfs
+
+var parseCPUInfo = parseCPUInfoRISCV

Binary file not shown.