Blame SPECS/weldr-client.spec

1c27b5
# Pass --with tests to rpmbuild to build composer-cli-tests
1c27b5
%bcond_with tests
1c27b5
1c27b5
%global goipath         github.com/osbuild/weldr-client
1c27b5
1c27b5
Name:      weldr-client
b1fbcc
Version:   35.1
b1fbcc
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
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
1c27b5
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
1c27b5
%{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}'
1c27b5
%if 0%{?rhel}
1c27b5
%forgeautosetup -p1
1c27b5
%else
1c27b5
%goprep
1c27b5
%endif
1c27b5
1c27b5
%build
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
1c27b5
1c27b5
export LDFLAGS="-X github.com/osbuild/weldr-client/cmd/composer-cli/root.Version=%{version} "
1c27b5
make GOBUILDFLAGS="%{gobuildflags}" build
1c27b5
1c27b5
## TODO
1c27b5
##make man
1c27b5
1c27b5
%if %{with tests} || 0%{?rhel}
1c27b5
# Build test binaries with `go test -c`, so that they can take advantage of
1c27b5
# golang's testing package. The golang rpm macros don't support building them
1c27b5
# directly. Thus, do it manually, taking care to also include a build id.
1c27b5
#
1c27b5
# On Fedora, also turn off go modules and set the path to the one into which
1c27b5
# the golang-* packages install source code.
1c27b5
%if 0%{?fedora}
1c27b5
export GOPATH="%{gobuilddir}:${GOPATH:+${GOPATH}:}%{?gopath}"
1c27b5
export GO111MODULE=off
1c27b5
%endif
1c27b5
1c27b5
export LDFLAGS="-X github.com/osbuild/weldr-client/cmd/composer-cli/root.Version=%{version} "
1c27b5
export BUILDTAGS="integration"
1c27b5
make GOBUILDFLAGS="%{gobuildflags}" integration
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
1c27b5
export LDFLAGS="-X github.com/osbuild/weldr-client/cmd/composer-cli/root.Version=%{version} "
1c27b5
make GOBUILDFLAGS="%{gotestflags}" test
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
1c27b5
* Tue Aug 10 2021 Mohan Boddu <mboddu@redhat.com> - 35.1-4
1c27b5
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
1c27b5
  Related: rhbz#1991688
1c27b5
1c27b5
* Tue Jun 22 2021 Mohan Boddu <mboddu@redhat.com> - 35.1-3
1c27b5
- Rebuilt for RHEL 9 BETA for openssl 3.0
1c27b5
  Related: rhbz#1971065
1c27b5
1c27b5
* Thu Apr 22 2021 Brian C. Lane <bcl@redhat.com> - 35.1-2
1c27b5
- Obsolete composer-cli < 35.0 instead of 34.0
1c27b5
  Patch until next upstream release
1c27b5
1c27b5
* Mon Apr 12 2021 Brian C. Lane <bcl@redhat.com> - 35.1-1
1c27b5
- New release: 35.1 (bcl)
1c27b5
- spec: Change release back to 1 (bcl)
1c27b5
- spec: Move testify BuildRequires into fedora block (bcl)
1c27b5
- vendor: Add vendored dependencies for RHEL (bcl)
1c27b5
- tools: Add prepare-source.sh vendoring helper script (bcl)
1c27b5
- Makefile: skip vendor directory for check target (bcl)
1c27b5
- spec: Bump release to 2 (bcl)
1c27b5
- spec: Fix BuildRequires for tests (bcl)
1c27b5
- Makefile: Remove executable from bash completion (bcl)
1c27b5
- Makefile: Only use GOBUILDFLAGS (bcl)
1c27b5
- spec: Bump release to 2 (bcl)
1c27b5
- spec: Add doc files (bcl)
1c27b5
- spec: Add gpg signature verification (bcl)
1c27b5
- spec: Use git-core instead of git (bcl)
1c27b5
- spec: Set License to Apache 2.0 (bcl)
1c27b5
- spec: Update Source urls with new project location (bcl)