2022-12-14 23:55:07 +00:00
|
|
|
# Pass --without tests to skip building composer-cli-tests
|
|
|
|
%bcond_without tests
|
2021-08-23 19:09:53 +00:00
|
|
|
# Pass --without signed to skip gpg signed tar.gz (DO NOT DO THAT IN PRODUCTION)
|
|
|
|
%bcond_without signed
|
2021-04-12 21:52:47 +00:00
|
|
|
|
2021-10-04 21:34:04 +00:00
|
|
|
%global goipath github.com/osbuild/weldr-client/v2
|
2021-04-12 21:52:47 +00:00
|
|
|
|
|
|
|
Name: weldr-client
|
2023-04-11 21:37:10 +00:00
|
|
|
Version: 35.10
|
|
|
|
Release: 1%{?dist}
|
2021-04-12 21:52:47 +00:00
|
|
|
# Upstream license specification: Apache-2.0
|
2023-04-11 21:37:10 +00:00
|
|
|
License: Apache-2.0
|
2021-04-12 21:52:47 +00:00
|
|
|
Summary: Command line utility to control osbuild-composer
|
2022-09-08 22:21:20 +00:00
|
|
|
|
|
|
|
%gometa
|
2021-04-12 21:52:47 +00:00
|
|
|
Url: %{gourl}
|
|
|
|
Source0: https://github.com/osbuild/weldr-client/releases/download/v%{version}/%{name}-%{version}.tar.gz
|
2021-08-23 19:09:53 +00:00
|
|
|
%if %{with signed}
|
2021-04-12 21:52:47 +00:00
|
|
|
Source1: https://github.com/osbuild/weldr-client/releases/download/v%{version}/%{name}-%{version}.tar.gz.asc
|
|
|
|
Source2: https://keys.openpgp.org/vks/v1/by-fingerprint/117E8C168EFE3A7F#/gpg-117E8C168EFE3A7F.key
|
2021-08-23 19:09:53 +00:00
|
|
|
%endif
|
2021-04-12 21:52:47 +00:00
|
|
|
|
2021-04-22 21:40:19 +00:00
|
|
|
Obsoletes: composer-cli < 35.0
|
2021-04-12 21:52:47 +00:00
|
|
|
Provides: composer-cli = %{version}-%{release}
|
|
|
|
|
2022-12-01 00:27:23 +00:00
|
|
|
Requires: diffutils
|
|
|
|
|
2021-04-12 21:52:47 +00:00
|
|
|
BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
|
|
|
|
%if 0%{?fedora}
|
|
|
|
BuildRequires: golang(github.com/BurntSushi/toml)
|
|
|
|
BuildRequires: golang(github.com/spf13/cobra)
|
|
|
|
# Required for tests and %check
|
|
|
|
BuildRequires: golang(github.com/stretchr/testify/assert)
|
|
|
|
BuildRequires: golang(github.com/stretchr/testify/require)
|
|
|
|
%endif
|
|
|
|
|
|
|
|
BuildRequires: git-core
|
|
|
|
BuildRequires: make
|
|
|
|
BuildRequires: gnupg2
|
|
|
|
|
|
|
|
|
|
|
|
%description
|
|
|
|
Command line utility to control osbuild-composer
|
|
|
|
|
|
|
|
%prep
|
2021-08-23 19:09:53 +00:00
|
|
|
%if %{with signed}
|
2021-04-12 21:52:47 +00:00
|
|
|
%{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}'
|
2021-08-23 19:09:53 +00:00
|
|
|
%endif
|
2021-04-12 21:52:47 +00:00
|
|
|
%if 0%{?rhel}
|
|
|
|
%forgeautosetup -p1
|
|
|
|
%else
|
|
|
|
%goprep
|
|
|
|
%endif
|
|
|
|
|
|
|
|
%build
|
2021-10-04 21:34:04 +00:00
|
|
|
export LDFLAGS="-X %{goipath}/cmd/composer-cli/root.Version=%{version} "
|
|
|
|
|
2021-04-12 21:52:47 +00:00
|
|
|
%if 0%{?rhel}
|
|
|
|
GO_BUILD_PATH=$PWD/_build
|
|
|
|
install -m 0755 -vd $(dirname $GO_BUILD_PATH/src/%{goipath})
|
|
|
|
ln -fs $PWD $GO_BUILD_PATH/src/%{goipath}
|
|
|
|
cd $GO_BUILD_PATH/src/%{goipath}
|
|
|
|
install -m 0755 -vd _bin
|
|
|
|
export PATH=$PWD/_bin${PATH:+:$PATH}
|
|
|
|
export GOPATH=$GO_BUILD_PATH:%{gopath}
|
|
|
|
export GOFLAGS=-mod=vendor
|
|
|
|
%else
|
|
|
|
export GOPATH="%{gobuilddir}:${GOPATH:+${GOPATH}:}%{?gopath}"
|
|
|
|
export GO111MODULE=off
|
|
|
|
%endif
|
2022-02-14 22:36:26 +00:00
|
|
|
%gobuild -o composer-cli %{goipath}/cmd/composer-cli
|
2021-04-12 21:52:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
## TODO
|
|
|
|
##make man
|
|
|
|
|
|
|
|
%if %{with tests} || 0%{?rhel}
|
2021-10-04 21:34:04 +00:00
|
|
|
export BUILDTAGS="integration"
|
|
|
|
|
2021-04-12 21:52:47 +00:00
|
|
|
# Build test binaries with `go test -c`, so that they can take advantage of
|
2021-10-04 21:34:04 +00:00
|
|
|
# golang's testing package. The RHEL golang rpm macros don't support building them
|
2021-04-12 21:52:47 +00:00
|
|
|
# directly. Thus, do it manually, taking care to also include a build id.
|
|
|
|
#
|
2022-02-14 22:36:26 +00:00
|
|
|
# On Fedora go modules have already been turned off, and the path set to the one into which
|
2021-04-12 21:52:47 +00:00
|
|
|
# the golang-* packages install source code.
|
2021-10-29 15:47:43 +00:00
|
|
|
export LDFLAGS="${LDFLAGS:-} -linkmode=external -compressdwarf=false -B 0x$(od -N 20 -An -tx1 -w100 /dev/urandom | tr -d ' ')"
|
|
|
|
go test -c -tags=integration -buildmode pie -compiler gc -ldflags="${LDFLAGS}" -o composer-cli-tests %{goipath}/weldr
|
2021-10-04 21:34:04 +00:00
|
|
|
%endif
|
2021-04-12 21:52:47 +00:00
|
|
|
|
|
|
|
%install
|
|
|
|
make DESTDIR=%{buildroot} install
|
|
|
|
|
|
|
|
%if %{with tests} || 0%{?rhel}
|
|
|
|
make DESTDIR=%{buildroot} install-tests
|
|
|
|
%endif
|
|
|
|
|
|
|
|
%check
|
|
|
|
%if 0%{?fedora}
|
|
|
|
export GOPATH="%{gobuilddir}:${GOPATH:+${GOPATH}:}%{?gopath}"
|
|
|
|
export GO111MODULE=off
|
|
|
|
%endif
|
|
|
|
|
2021-10-04 21:34:04 +00:00
|
|
|
# Run the unit tests
|
|
|
|
export LDFLAGS="-X %{goipath}/cmd/composer-cli/root.Version=%{version} "
|
|
|
|
make test
|
|
|
|
|
2021-04-12 21:52:47 +00:00
|
|
|
|
|
|
|
%files
|
|
|
|
%license LICENSE
|
|
|
|
%doc examples HACKING.md README.md
|
|
|
|
%{_bindir}/composer-cli
|
|
|
|
%dir %{_sysconfdir}/bash_completion.d
|
|
|
|
%{_sysconfdir}/bash_completion.d/composer-cli
|
|
|
|
%{_mandir}/man1/composer-cli*
|
|
|
|
|
|
|
|
%if %{with tests} || 0%{?rhel}
|
|
|
|
%package tests
|
|
|
|
Summary: Integration tests for composer-cli
|
|
|
|
|
2023-04-11 21:37:10 +00:00
|
|
|
Requires: createrepo_c
|
|
|
|
|
2021-04-12 21:52:47 +00:00
|
|
|
%description tests
|
|
|
|
Integration tests to be run on a pristine-dedicated system to test the
|
|
|
|
composer-cli package.
|
|
|
|
|
|
|
|
%files tests
|
|
|
|
%license LICENSE
|
|
|
|
%{_libexecdir}/tests/composer-cli/
|
|
|
|
%endif
|
|
|
|
|
|
|
|
|
|
|
|
%changelog
|
2023-04-11 21:37:10 +00:00
|
|
|
* Tue Apr 11 2023 Brian C. Lane <bcl@redhat.com> - 35.10-1
|
|
|
|
- New release: 35.10 (bcl)
|
|
|
|
- Add support for compose start warning messages (bcl)
|
|
|
|
- build(deps): bump github.com/spf13/cobra from 1.6.1 to 1.7.0 (49699333+dependabot[bot])
|
|
|
|
- workflow: Ignore govulncheck failures (bcl)
|
|
|
|
- build(deps): bump actions/setup-go from 3 to 4 (49699333+dependabot[bot])
|
|
|
|
- workflow: Switch to testing on go 1.18, 1.19, 1.20 (bcl)
|
|
|
|
- maint: Update to use go v1.18 by default (bcl)
|
|
|
|
- build(deps): bump github.com/stretchr/testify from 1.8.1 to 1.8.2 (49699333+dependabot[bot])
|
|
|
|
- spec: Require createrepo_c for weldr-client-tests package (bcl)
|
|
|
|
- Build weldr-client-tests by default (bcl)
|
|
|
|
- spec: migrate the license field to SPDX (ondrej)
|