Skip to content

Commit 5d8dbe8

Browse files
authored
Merge pull request #81 from Mab879/go2rpm
Move spec to use go2rpm
2 parents a94921d + b63afa9 commit 5d8dbe8

4 files changed

Lines changed: 68 additions & 23 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
/vendor
66
/cvetool
77
/*.db*
8+
/cvetool*.tar.*

.packit.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
upstream_package_name: cvetool
22
downstream_package_name: cvetool
33
specfile_path: cvetool.spec
4+
upstream_tag_template: v{version}
5+
6+
actions:
7+
fix-spec-file:
8+
- go_vendor_archive create cvetool.spec
9+
10+
srpm_build_deps:
11+
- go-vendor-tools
12+
- golang
413

514
jobs:
615
- job: copr_build

cvetool.spec

Lines changed: 44 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,59 @@
1-
%global debug_package %{nil}
1+
# Generated by go2rpm 1.19.0
2+
%bcond check 1
3+
4+
# https://github.com/ComplianceAsCode/cvetool
5+
%global goipath github.com/ComplianceAsCode/cvetool
6+
Version: 0.1.1
7+
8+
%gometa -L -f
9+
210

311
Name: cvetool
4-
Version: 0.0.1
5-
Release: 1%{?dist}
12+
Release: %autorelease
613
Summary: A Claircore-based CVE manager
714

8-
License: Apache-2.0
9-
URL: https://github.com/ComplianceAsCode/cvetool
10-
Source0: https://github.com/ComplianceAsCode/cvetool/archive/v%{version}/%{name}-%{version}.tar.gz
15+
# Generated by go-vendor-tools
16+
License: Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND LicenseRef-Fedora-Public-Domain AND LicenseRef-scancode-other-permissive AND MIT AND MIT WITH LicenseRef-scancode-musl-exception AND MPL-2.0 AND (LicenseRef-Fedora-Public-Domain OR LicenseRef-scancode-other-permissive)
17+
URL: %{gourl}
18+
Source0: %{gosource}
19+
# Generated by go-vendor-tools
20+
Source1: %{archivename}-vendor.tar.bz2
21+
Source2: go-vendor-tools.toml
1122

12-
BuildRequires: golang
13-
BuildRequires: git
14-
Requires: glibc
23+
BuildRequires: go-vendor-tools
1524

1625
%description
17-
%{summary}
26+
A Claircore-based CVE manager
1827

1928
%prep
20-
%setup -q
29+
%goprep -p1
30+
tar -xf %{S:1}
2131

22-
%build
23-
export CGO_CPPFLAGS="${CPPFLAGS}"
24-
export CGO_CFLAGS="${CFLAGS}"
25-
export CGO_CXXFLAGS="${CXXFLAGS}"
26-
export CGO_LDFLAGS="${LDFLAGS}"
27-
export GOFLAGS="-buildmode=pie -trimpath -mod=readonly -modcacherw"
32+
%generate_buildrequires
33+
%go_vendor_license_buildrequires -c %{S:2}
2834

29-
go mod tidy
30-
go build -ldflags="-linkmode=external -X main.Version=%{version}-%{release}" ./cmd/cvetool
35+
%build
36+
%global gomodulesmode GO111MODULE=on
37+
export GO_LDFLAGS='-X main.Version=%{version}'
38+
for cmd in cmd/* ; do
39+
%gobuild -o %{gobuilddir}/bin/$(basename $cmd) %{goipath}/$cmd
40+
done
3141

3242
%install
33-
install -Dm0755 %{name} %{buildroot}%{_bindir}/%{name}
43+
%go_vendor_license_install -c %{S:2}
44+
install -m 0755 -vd %{buildroot}%{_bindir}
45+
install -m 0755 -vp %{gobuilddir}/bin/* %{buildroot}%{_bindir}/
46+
47+
%check
48+
%go_vendor_license_check -c %{S:2}
49+
%if %{with check}
50+
%gotest ./...
51+
%endif
3452

35-
%files
36-
%{_bindir}/%{name}
37-
%license LICENSE
53+
%files -f %{go_vendor_license_filelist}
3854
%doc README.md
55+
%{_bindir}/cvetool
56+
57+
58+
%changelog
59+
%autochangelog

go-vendor-tools.toml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[archive]
2+
3+
[licensing]
4+
detector = "askalono"
5+
exclude_files = ["vendor/modernc.org/memory/LICENSE-LOGO"]
6+
[[licensing.licenses]]
7+
path = "vendor/modernc.org/libc/LICENSE-3RD-PARTY.md"
8+
sha256sum = "f597097efe3d97021f89170746bd3a0fb9a8b6fb26b82043ed68a4e0283bee6c"
9+
expression = "(MIT WITH LicenseRef-scancode-musl-exception) AND (LicenseRef-scancode-other-permissive AND BSD-2-Clause) AND (BSD-3-Clause AND (LicenseRef-scancode-public-domain OR LicenseRef-scancode-other-permissive) AND MIT)"
10+
11+
[[licensing.licenses]]
12+
path = "vendor/modernc.org/sqlite/SQLITE-LICENSE"
13+
sha256sum = "8438c9c89b849131ead81d5435cb97fcf052df5b0b286dda8a2d4c29e6cb3fd0"
14+
expression = "LicenseRef-scancode-public-domain"

0 commit comments

Comments
 (0)