Blame SPECS/weldr-client.spec

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