Blame SPECS/weldr-client.spec

58294b
# Pass --with tests to rpmbuild to build composer-cli-tests
58294b
%bcond_with tests
58294b
# Pass --without signed to skip gpg signed tar.gz (DO NOT DO THAT IN PRODUCTION)
58294b
%bcond_without signed
58294b
58294b
%global goipath         github.com/osbuild/weldr-client/v2
58294b
58294b
Name:      weldr-client
58294b
Version:   35.3
58294b
Release:   2%{?dist}
58294b
# Upstream license specification: Apache-2.0
58294b
License:   ASL 2.0
58294b
Summary:   Command line utility to control osbuild-composer
58294b
Url:       %{gourl}
58294b
Source0:   https://github.com/osbuild/weldr-client/releases/download/v%{version}/%{name}-%{version}.tar.gz
58294b
%if %{with signed}
58294b
Source1:   https://github.com/osbuild/weldr-client/releases/download/v%{version}/%{name}-%{version}.tar.gz.asc
58294b
Source2:   https://keys.openpgp.org/vks/v1/by-fingerprint/117E8C168EFE3A7F#/gpg-117E8C168EFE3A7F.key
58294b
%endif
58294b
58294b
Obsoletes: composer-cli < 35.0
58294b
Provides: composer-cli = %{version}-%{release}
58294b
58294b
%gometa
58294b
58294b
BuildRequires:  %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
58294b
%if 0%{?fedora}
58294b
BuildRequires:  golang(github.com/BurntSushi/toml)
58294b
BuildRequires:  golang(github.com/spf13/cobra)
58294b
# Required for tests and %check
58294b
BuildRequires:  golang(github.com/stretchr/testify/assert)
58294b
BuildRequires:  golang(github.com/stretchr/testify/require)
58294b
%endif
58294b
58294b
BuildRequires: git-core
58294b
BuildRequires: make
58294b
BuildRequires: gnupg2
58294b
58294b
58294b
%description
58294b
Command line utility to control osbuild-composer
58294b
58294b
%prep
58294b
%if %{with signed}
58294b
%{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}'
58294b
%endif
58294b
%if 0%{?rhel}
58294b
%forgeautosetup -p1
58294b
%else
58294b
%goprep
58294b
%endif
58294b
58294b
%build
58294b
export LDFLAGS="-X %{goipath}/cmd/composer-cli/root.Version=%{version} "
58294b
58294b
%if 0%{?rhel}
58294b
GO_BUILD_PATH=$PWD/_build
58294b
install -m 0755 -vd $(dirname $GO_BUILD_PATH/src/%{goipath})
58294b
ln -fs $PWD $GO_BUILD_PATH/src/%{goipath}
58294b
cd $GO_BUILD_PATH/src/%{goipath}
58294b
install -m 0755 -vd _bin
58294b
export PATH=$PWD/_bin${PATH:+:$PATH}
58294b
export GOPATH=$GO_BUILD_PATH:%{gopath}
58294b
export GOFLAGS=-mod=vendor
58294b
%gobuild -o composer-cli %{goipath}/cmd/composer-cli
58294b
%else
58294b
export GOPATH="%{gobuilddir}:${GOPATH:+${GOPATH}:}%{?gopath}"
58294b
export GO111MODULE=off
58294b
make GOBUILDFLAGS="%{gobuildflags}" build
58294b
%endif
58294b
58294b
58294b
## TODO
58294b
##make man
58294b
58294b
%if %{with tests} || 0%{?rhel}
58294b
export BUILDTAGS="integration"
58294b
58294b
# Build test binaries with `go test -c`, so that they can take advantage of
58294b
# golang's testing package. The RHEL golang rpm macros don't support building them
58294b
# directly. Thus, do it manually, taking care to also include a build id.
58294b
#
58294b
# On Fedora, also turn off go modules and set the path to the one into which
58294b
# the golang-* packages install source code.
58294b
%if 0%{?rhel}
58294b
export LDFLAGS="${LDFLAGS:-} -linkmode=external -compressdwarf=false -B 0x$(od -N 20 -An -tx1 -w100 /dev/urandom | tr -d ' ')"
58294b
go test -c -tags=integration -buildmode pie -compiler gc -ldflags="${LDFLAGS}" -o composer-cli-tests %{goipath}/weldr
58294b
%else
58294b
make GOBUILDFLAGS="%{gobuildflags}" integration
58294b
%endif
58294b
%endif
58294b
58294b
%install
58294b
make DESTDIR=%{buildroot} install
58294b
58294b
%if %{with tests} || 0%{?rhel}
58294b
make DESTDIR=%{buildroot} install-tests
58294b
%endif
58294b
58294b
%check
58294b
%if 0%{?fedora}
58294b
export GOPATH="%{gobuilddir}:${GOPATH:+${GOPATH}:}%{?gopath}"
58294b
export GO111MODULE=off
58294b
%endif
58294b
58294b
# Run the unit tests
58294b
export LDFLAGS="-X %{goipath}/cmd/composer-cli/root.Version=%{version} "
58294b
make test
58294b
58294b
58294b
%files
58294b
%license LICENSE
58294b
%doc examples HACKING.md README.md
58294b
%{_bindir}/composer-cli
58294b
%dir %{_sysconfdir}/bash_completion.d
58294b
%{_sysconfdir}/bash_completion.d/composer-cli
58294b
%{_mandir}/man1/composer-cli*
58294b
58294b
%if %{with tests} || 0%{?rhel}
58294b
%package tests
58294b
Summary:    Integration tests for composer-cli
58294b
58294b
%description tests
58294b
Integration tests to be run on a pristine-dedicated system to test the
58294b
composer-cli package.
58294b
58294b
%files tests
58294b
%license LICENSE
58294b
%{_libexecdir}/tests/composer-cli/
58294b
%endif
58294b
58294b
58294b
%changelog
58294b
* Mon Oct 04 2021 Brian C. Lane <bcl@redhat.com> - 35.3-1
58294b
- New release: 35.3 (bcl)
58294b
- spec: Adjust build methods for RHEL 8 (bcl)
58294b
- github: Run build-in-podman to test building package (bcl)
58294b
- spec: Use v2 module (bcl)
58294b
- Makefile: Use v2 module (bcl)
58294b
- Makefile: Add a build-in-podman target (bcl)
58294b
- tests: Add JSON and error result testing to status (bcl)
58294b
- tests: Add JSON and error result testing to sources (bcl)
58294b
- tests: Add JSON and error result testing to projects (bcl)
58294b
- tests: Add JSON and error result testing to modules (bcl)
58294b
- tests: Add JSON and error result testing to distros (bcl)
58294b
- tests: Add JSON and error result testing to compose (bcl)
58294b
- tests: Add JSON and error result testing to blueprints (bcl)
58294b
- test: Fix test client setup and output capture code (bcl)
58294b
- test: Close output capture in printwrap_test (bcl)
58294b
- test: reset the root flags on every ExecuteTest call (bcl)
58294b
- status: Use ExecutionErrors for API errors (bcl)
58294b
- sources: Use ExecutionErrors for API errors (bcl)
58294b
- projects: Use ExecutionErrors for API errors (bcl)
58294b
- modules: Use ExecutionErrors for API errors (bcl)
58294b
- distros: Use ExecutionErrors for API errors (bcl)
58294b
- compose: Use ExecutionErrors for API errors (bcl)
58294b
- blueprints: Use ExecutionErrors for API errors (bcl)
58294b
- composer-cli: Turn off normal command Stdout when --json is used (bcl)
58294b
- weldr: Fix Stringer interface on API messages (bcl)
58294b
- weldr: Clean up error message return code (bcl)
58294b
- weldr: Move Unmarshal error to error position (bcl)
58294b
- root: Add a helper function to print a list of errors (bcl)
58294b
- Use GetFilePath for ComposeImage (bcl)
58294b
- Use GetFilePath for ComposeResults (bcl)
58294b
- Use GetFilePath for ComposerMetadata (bcl)
58294b
- Use GetFilePath for ComposeLogs (bcl)
58294b
- weldr: Add GetFilePath to download a file to a path (bcl)
58294b
- Creating v2 module for breaking API changes (bcl)
58294b
- Makefile: Add update-mods target (bcl)
58294b
- vendor: Update the modules and vendor directory (bcl)
58294b
- Bump go version to 1.15 (bcl)
58294b
- Limit dependabot to 1 PR (bcl)
58294b
- Enable Dependabot service (atodorov)
58294b
- tests: Fix integration tests (bcl)