Blame SPECS/weldr-client.spec

d77f94
# Pass --with tests to rpmbuild to build composer-cli-tests
d77f94
%bcond_with tests
d77f94
# Pass --without signed to skip gpg signed tar.gz (DO NOT DO THAT IN PRODUCTION)
d77f94
%bcond_without signed
d77f94
d77f94
%global goipath         github.com/osbuild/weldr-client/v2
d77f94
d77f94
Name:      weldr-client
d77f94
Version:   35.5
58f0ac
Release:   4%{?dist}
d77f94
# Upstream license specification: Apache-2.0
d77f94
License:   ASL 2.0
d77f94
Summary:   Command line utility to control osbuild-composer
d77f94
Url:       %{gourl}
d77f94
Source0:   https://github.com/osbuild/weldr-client/releases/download/v%{version}/%{name}-%{version}.tar.gz
d77f94
%if %{with signed}
d77f94
Source1:   https://github.com/osbuild/weldr-client/releases/download/v%{version}/%{name}-%{version}.tar.gz.asc
d77f94
Source2:   https://keys.openpgp.org/vks/v1/by-fingerprint/117E8C168EFE3A7F#/gpg-117E8C168EFE3A7F.key
d77f94
%endif
d77f94
58f0ac
Patch0001: 0001-tests-Update-tests-for-osbuild-composer-changes.patch
58f0ac
d77f94
Obsoletes: composer-cli < 35.0
d77f94
Provides: composer-cli = %{version}-%{release}
d77f94
d77f94
%gometa
d77f94
d77f94
BuildRequires:  %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
d77f94
%if 0%{?fedora}
d77f94
BuildRequires:  golang(github.com/BurntSushi/toml)
d77f94
BuildRequires:  golang(github.com/spf13/cobra)
d77f94
# Required for tests and %check
d77f94
BuildRequires:  golang(github.com/stretchr/testify/assert)
d77f94
BuildRequires:  golang(github.com/stretchr/testify/require)
d77f94
%endif
d77f94
d77f94
BuildRequires: git-core
d77f94
BuildRequires: make
d77f94
BuildRequires: gnupg2
d77f94
d77f94
d77f94
%description
d77f94
Command line utility to control osbuild-composer
d77f94
d77f94
%prep
d77f94
%if %{with signed}
d77f94
%{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}'
d77f94
%endif
d77f94
%if 0%{?rhel}
d77f94
%forgeautosetup -p1
d77f94
%else
d77f94
%goprep
d77f94
%endif
d77f94
d77f94
%build
d77f94
export LDFLAGS="-X %{goipath}/cmd/composer-cli/root.Version=%{version} "
d77f94
d77f94
%if 0%{?rhel}
d77f94
GO_BUILD_PATH=$PWD/_build
d77f94
install -m 0755 -vd $(dirname $GO_BUILD_PATH/src/%{goipath})
d77f94
ln -fs $PWD $GO_BUILD_PATH/src/%{goipath}
d77f94
cd $GO_BUILD_PATH/src/%{goipath}
d77f94
install -m 0755 -vd _bin
d77f94
export PATH=$PWD/_bin${PATH:+:$PATH}
d77f94
export GOPATH=$GO_BUILD_PATH:%{gopath}
d77f94
export GOFLAGS=-mod=vendor
d77f94
%else
d77f94
export GOPATH="%{gobuilddir}:${GOPATH:+${GOPATH}:}%{?gopath}"
d77f94
export GO111MODULE=off
d77f94
%endif
d77f94
%gobuild -o composer-cli %{goipath}/cmd/composer-cli
d77f94
d77f94
d77f94
## TODO
d77f94
##make man
d77f94
d77f94
%if %{with tests} || 0%{?rhel}
d77f94
export BUILDTAGS="integration"
d77f94
d77f94
# Build test binaries with `go test -c`, so that they can take advantage of
d77f94
# golang's testing package. The RHEL golang rpm macros don't support building them
d77f94
# directly. Thus, do it manually, taking care to also include a build id.
d77f94
#
d77f94
# On Fedora go modules have already been turned off, and the path set to the one into which
d77f94
# the golang-* packages install source code.
d77f94
export LDFLAGS="${LDFLAGS:-} -linkmode=external -compressdwarf=false -B 0x$(od -N 20 -An -tx1 -w100 /dev/urandom | tr -d ' ')"
d77f94
go test -c -tags=integration -buildmode pie -compiler gc -ldflags="${LDFLAGS}" -o composer-cli-tests %{goipath}/weldr
d77f94
%endif
d77f94
d77f94
%install
d77f94
make DESTDIR=%{buildroot} install
d77f94
d77f94
%if %{with tests} || 0%{?rhel}
d77f94
make DESTDIR=%{buildroot} install-tests
d77f94
%endif
d77f94
d77f94
%check
d77f94
%if 0%{?fedora}
d77f94
export GOPATH="%{gobuilddir}:${GOPATH:+${GOPATH}:}%{?gopath}"
d77f94
export GO111MODULE=off
d77f94
%endif
d77f94
d77f94
# Run the unit tests
d77f94
export LDFLAGS="-X %{goipath}/cmd/composer-cli/root.Version=%{version} "
d77f94
make test
d77f94
d77f94
d77f94
%files
d77f94
%license LICENSE
d77f94
%doc examples HACKING.md README.md
d77f94
%{_bindir}/composer-cli
d77f94
%dir %{_sysconfdir}/bash_completion.d
d77f94
%{_sysconfdir}/bash_completion.d/composer-cli
d77f94
%{_mandir}/man1/composer-cli*
d77f94
d77f94
%if %{with tests} || 0%{?rhel}
d77f94
%package tests
d77f94
Summary:    Integration tests for composer-cli
d77f94
d77f94
%description tests
d77f94
Integration tests to be run on a pristine-dedicated system to test the
d77f94
composer-cli package.
d77f94
d77f94
%files tests
d77f94
%license LICENSE
d77f94
%{_libexecdir}/tests/composer-cli/
d77f94
%endif
d77f94
d77f94
d77f94
%changelog
58f0ac
* Tue Aug 16 2022 Brian C. Lane <bcl@redhat.com> - 35.5-4
58f0ac
- tests: Update tests for osbuild composer changes
58f0ac
  Resolves: rhbz#2118829
58f0ac
58f0ac
* Tue Aug 16 2022 Brian C. Lane <bcl@redhat.com> - 35.5-3
58f0ac
- tests: Update repositories so tests will run
58f0ac
  Related: rhbz#2116773
58f0ac
58f0ac
* Tue Aug 16 2022 Brian C. Lane <bcl@redhat.com> - 35.5-2
58f0ac
- Rebuild with golang 1.18.4 for multiple golang CVEs
58f0ac
  Resolves: rhbz#2116773
58f0ac
d77f94
* Tue Feb 15 2022 Brian C. Lane <bcl@redhat.com> - 35.5-1
d77f94
- New release: 35.5 (bcl)
d77f94
  Resolves: rhbz#2052604
d77f94
- docs: Explain how to undo blueprints delete (bcl)
d77f94
- test: server status no longer returns devel (bcl)
d77f94
- Use GetFrozenBlueprintsTOML for blueprints freeze save (bcl)
d77f94
- Add a test for float uid/gid in frozen blueprint (bcl)
d77f94
- Use GetBlueprintsTOML for blueprints save (bcl)
d77f94
- test: Add a test for float uid/gid in saved blueprint (bcl)
d77f94
- build(deps): bump github.com/BurntSushi/toml from 0.4.1 to 1.0.0 (49699333+dependabot[bot])
d77f94
- tests: trigger on push to main (jrusz)
d77f94
- build(deps): bump github.com/spf13/cobra from 1.2.1 to 1.3.0 (49699333+dependabot[bot])
d77f94
- ci: add keystore for sonarqube (jrusz)
d77f94
- spec: Switch to using %%gobuild macro on Fedora (bcl)
d77f94
- ci: change workflow name (jrusz)
d77f94
- ci: add gitlab-ci and sonarqube (jrusz)
d77f94
- doc: fix example links from the README (tdecacqu)
d77f94
- build(deps): bump actions/checkout from 2.3.4 to 2.4.0 (49699333+dependabot[bot])
d77f94
- ci: Enable Coverity Scan tool (atodorov)