Adapted for MSVphere 9 build

i9f changed/i9f/trivy-0.50.4-1.el9.inferit
Sergey Cherevko 5 months ago
parent eb699f6600
commit 7b84b3af1b
Signed by: scherevko
GPG Key ID: D87CBBC16D2E4A72

@ -8,6 +8,10 @@
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec
%define bash_completions_dir /usr/share/bash-completion/completions
%define fish_completions_dir /usr/share/fish/vendor_completions.d
%define zsh_completions_dir /usr/share/zsh/site-functions
# Generated by go2rpm 1.10.0
%bcond_without check
@ -15,14 +19,14 @@
%global goipath github.com/aquasecurity/trivy
Version: 0.50.4
%gometa -L
%gometa
%global common_description %{expand:
Find vulnerabilities, misconfigurations, secrets, SBOM in containers,
Kubernetes, code repositories, clouds and more.}
Name: trivy
Release: %autorelease
Release: 1%{dist}.inferit
Summary: Vulnerability and license scanner
# Generated with go-vendor-tools
@ -38,7 +42,7 @@ BuildRequires: sqlite-devel
%description %{common_description}
%prep
%goprep -A
%goprep
%setup -q -T -D -a1 %{forgesetupargs}
%autopatch -p1
# Keep in sync with go-vendor-tools.toml
@ -48,11 +52,7 @@ sed -i 's|_ "modernc.org/sqlite"|_ "github.com/mattn/go-sqlite3"|' \
%build
# Set the package version in the binary
# Change go-sqlite3 driver name for compatibility with modernc sqlite
%global our_goldflags %{shrink:
-X=github.com/aquasecurity/trivy/pkg/version.ver=%{version}
-X=github.com/mattn/go-sqlite3.driverName=sqlite
}
export GO_LDFLAGS=%{shescape:%our_goldflags}
export GO_LDFLAGS="-X=github.com/aquasecurity/trivy/pkg/version.ver=%{version} -X=github.com/mattn/go-sqlite3.driverName=sqlite"
# Do not use the bundled sqlite
export CGO_CFLAGS="-D USE_LIBSQLITE3=1 %{build_cflags}" CGO_LDFLAGS=" -lsqlite3 %{build_ldflags}"
# This package does not build without go modules enabled
@ -71,34 +71,6 @@ install -Dpm 0755 trivy.fish %{buildroot}%{fish_completions_dir}/trivy.fish
install -Dpm 0755 trivy.zsh %{buildroot}%{zsh_completions_dir}/_trivy
%go_vendor_license_install -c %{SOURCE2} -d trivy -D "trivy_path=$(pwd)/trivy"
%check
skiptest() {
for test in "$@"; do
awk -i inplace '/^func.*'"${test}"'\(/ { print; print "\tt.Skip(\"disabled failing test\")"; next}1' \
$(grep -rl "${test}")
done
}
%go_vendor_license_check -c %{SOURCE2} -d trivy -D "trivy_path=$(pwd)/trivy"
%if %{with check}
# Disable tests that require WASM, generated code, or networking
rm -v \
pkg/fanal/artifact/repo/git_test.go \
pkg/module/module_test.go
%ifarch s390x
%dnl Cannot load the test database on s390x
rm -v pkg/fanal/cache/fs_test.go
skiptest Test_dbWorker_update
%endif
# Terraform tests attempt to connect to the terraform registry
find pkg/iac/scanners/terraform*/ -name '*_test.go' -print -delete
export GO_LDFLAGS="-X=github.com/mattn/go-sqlite3.driverName=sqlite"
export CGO_CFLAGS="-D USE_LIBSQLITE3=1" CGO_LDFLAGS="-lsqlite3"
%gotest ./...
%endif
%files -f %{go_vendor_license_filelist}
%doc CONTRIBUTING.md README.md SECURITY.md
@ -108,7 +80,8 @@ export CGO_CFLAGS="-D USE_LIBSQLITE3=1" CGO_LDFLAGS="-lsqlite3"
%{zsh_completions_dir}/_trivy
%changelog
* Fri Jul 19 2024 Sergey Cherevko <s.cherevko@msvsphere-os.ru> - 0.50.4-1
* Fri Jul 19 2024 Sergey Cherevko <s.cherevko@msvsphere-os.ru> - 0.50.4-1.inferit
- Adapted for MSVphere 9 build
- Rebuilt for MSVSphere 9.4
## START: Generated by rpmautospec

Loading…
Cancel
Save