diff --git a/.gitignore b/.gitignore index 97b89a5..7b36179 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ /feeds /reports /vendor -/cvetool \ No newline at end of file +/cvetool +/cvetool*.tar.* diff --git a/cvetool.spec b/cvetool.spec index fb336fb..b49ab88 100644 --- a/cvetool.spec +++ b/cvetool.spec @@ -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 diff --git a/go-vendor-tools.toml b/go-vendor-tools.toml new file mode 100644 index 0000000..77e5567 --- /dev/null +++ b/go-vendor-tools.toml @@ -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"