Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
/feeds
/reports
/vendor
/cvetool
/cvetool
/cvetool*.tar.*
67 changes: 44 additions & 23 deletions cvetool.spec
Original file line number Diff line number Diff line change
@@ -1,38 +1,59 @@
%global debug_package %{nil}
# Generated by go2rpm 1.19.0
%bcond check 1

# https://github.com/ComplianceAsCode/cvetool
%global goipath github.com/ComplianceAsCode/cvetool
Version: 0.1.1

%gometa -L -f


Name: cvetool
Version: 0.0.1
Release: 1%{?dist}
Release: %autorelease
Summary: A Claircore-based CVE manager

License: Apache-2.0
URL: https://github.com/ComplianceAsCode/cvetool
Source0: https://github.com/ComplianceAsCode/cvetool/archive/v%{version}/%{name}-%{version}.tar.gz
# Generated by go-vendor-tools
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)
URL: %{gourl}
Source0: %{gosource}
# Generated by go-vendor-tools
Source1: %{archivename}-vendor.tar.bz2
Source2: go-vendor-tools.toml

BuildRequires: golang
BuildRequires: git
Requires: glibc
BuildRequires: go-vendor-tools

%description
%{summary}
A Claircore-based CVE manager

%prep
%setup -q
%goprep -p1
tar -xf %{S:1}

%build
export CGO_CPPFLAGS="${CPPFLAGS}"
export CGO_CFLAGS="${CFLAGS}"
export CGO_CXXFLAGS="${CXXFLAGS}"
export CGO_LDFLAGS="${LDFLAGS}"
export GOFLAGS="-buildmode=pie -trimpath -mod=readonly -modcacherw"
%generate_buildrequires
%go_vendor_license_buildrequires -c %{S:2}

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

%install
install -Dm0755 %{name} %{buildroot}%{_bindir}/%{name}
%go_vendor_license_install -c %{S:2}
install -m 0755 -vd %{buildroot}%{_bindir}
install -m 0755 -vp %{gobuilddir}/bin/* %{buildroot}%{_bindir}/

%check
%go_vendor_license_check -c %{S:2}
%if %{with check}
%gotest ./...
%endif

%files
%{_bindir}/%{name}
%license LICENSE
%files -f %{go_vendor_license_filelist}
%doc README.md
%{_bindir}/cvetool


%changelog
%autochangelog
14 changes: 14 additions & 0 deletions go-vendor-tools.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[archive]

[licensing]
detector = "askalono"
exclude_files = ["vendor/modernc.org/memory/LICENSE-LOGO"]
[[licensing.licenses]]
path = "vendor/modernc.org/libc/COPYRIGHT-MUSL"
sha256sum = "f9bc4423732350eb0b3f7ed7e91d530298476f8fec0c6c427a1c04ade22655af"
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)"

[[licensing.licenses]]
path = "vendor/modernc.org/sqlite/SQLITE-LICENSE"
sha256sum = "8438c9c89b849131ead81d5435cb97fcf052df5b0b286dda8a2d4c29e6cb3fd0"
expression = "LicenseRef-scancode-public-domain"