Blame SPECS/weldr-client.spec

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