diff --git a/.gitignore b/.gitignore index 0074695..c9f53a7 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ /weldr-client-35.1.tar.gz /weldr-client-35.2.tar.gz /weldr-client-35.2.tar.gz.asc +/weldr-client-35.3.tar.gz +/weldr-client-35.3.tar.gz.asc diff --git a/0001-tests-Fix-integration-tests.patch b/0001-tests-Fix-integration-tests.patch deleted file mode 100644 index 7d838d2..0000000 --- a/0001-tests-Fix-integration-tests.patch +++ /dev/null @@ -1,74 +0,0 @@ -From edeafc1b677eb0f362fdb60fbb624ad8e1632c21 Mon Sep 17 00:00:00 2001 -From: "Brian C. Lane" -Date: Wed, 25 Aug 2021 09:00:48 -0700 -Subject: [PATCH] tests: Fix integration tests - -osbuild-composer v31 returns a more detailed error for -TestStartComposeBadType, so that has been changed. - -The number of image types returned depends on the distribution being -used, so change to looking for >= 6 of them. - -The source type depends on the first repo in the list, so it could be -any of the supported types. They all start with "yum-" so change the -test to look for that instead. ---- - weldr/compose_test.go | 6 +++--- - weldr/sources_test.go | 3 ++- - 2 files changed, 5 insertions(+), 4 deletions(-) - -diff --git a/weldr/compose_test.go b/weldr/compose_test.go -index 7479edf..fda6953 100644 ---- a/weldr/compose_test.go -+++ b/weldr/compose_test.go -@@ -30,7 +30,7 @@ func TestGetComposeTypes(t *testing.T) { - require.Nil(t, err) - require.Nil(t, r) - require.NotNil(t, types) -- assert.Equal(t, 6, len(types)) -+ assert.GreaterOrEqual(t, len(types), 6) - assert.Contains(t, types, "openstack") - } - -@@ -44,7 +44,7 @@ func TestGetComposeTypesDistro(t *testing.T) { - require.Nil(t, err) - require.Nil(t, r) - require.NotNil(t, types) -- assert.Equal(t, 6, len(types)) -+ assert.GreaterOrEqual(t, len(types), 6) - assert.Contains(t, types, "openstack") - } - -@@ -141,7 +141,7 @@ func TestStartComposeBadType(t *testing.T) { - require.Nil(t, err) - require.NotNil(t, r) - assert.False(t, r.Status) -- assert.Equal(t, APIErrorMsg{"UnknownComposeType", "Unknown compose type for architecture: punchcard"}, r.Errors[0]) -+ assert.Equal(t, APIErrorMsg{"ComposeError", "Failed to get compose type \"punchcard\": invalid image type: punchcard"}, r.Errors[0]) - } - - func TestStartComposeBadDepsolve(t *testing.T) { -diff --git a/weldr/sources_test.go b/weldr/sources_test.go -index 77eb357..18b00f1 100644 ---- a/weldr/sources_test.go -+++ b/weldr/sources_test.go -@@ -7,6 +7,7 @@ - package weldr - - import ( -+ "strings" - "testing" - - "github.com/stretchr/testify/assert" -@@ -40,7 +41,7 @@ func TestGetSourcesJSON(t *testing.T) { - assert.Equal(t, names[0], id) - sourceType, ok := sources[names[0]].(map[string]interface{})["type"].(string) - require.True(t, ok) -- assert.Equal(t, "yum-metalink", sourceType) -+ assert.True(t, strings.HasPrefix(sourceType, "yum-")) - } - - func TestGetSourcesJSONError(t *testing.T) { --- -2.31.1 - diff --git a/sources b/sources index 733d5d2..d76c351 100644 --- a/sources +++ b/sources @@ -1,3 +1,3 @@ -SHA512 (weldr-client-35.2.tar.gz) = 15be056982683b9b8d5485ff9aa48dff237a48c3ee9d104c0de16898653facb0a63371a8d31bdf3fb19034022411c8d77e2358b22de52d23768cc7363f4926de -SHA512 (weldr-client-35.2.tar.gz.asc) = 7aabc7faaedc8c1d87a7b182348aa11a52db8425c7327fe52c560d2a861643e27f6d53628d4261027b092198003f02f12ad3ccb98f8f4ce8ce9e1f39fd67b556 +SHA512 (weldr-client-35.3.tar.gz) = 1f2a79598dbd6d757a3c5ed26434f945659e0ee047a6f241f032325e19688f9722cbbb7e968e0858aa6d276b6d0013ef551b2957fda7b3f68c521a05e9e45ad7 +SHA512 (weldr-client-35.3.tar.gz.asc) = 257c806de93fe83e2bb305af97dd1e3676b83916b67cb5ce7d9ba7131084226bbfa0900ca6647464be6ad88ec2554561b86c4acab01f64b20e6ec61591b08747 SHA512 (gpg-117E8C168EFE3A7F.key) = 9c760460e3227848c99a1178828512056ac04f518f98bdab5ef36d2aa31c4e5dcda3800d7141cfaf7f2acd0f7f35d4b9971083b6f14f8a36231b74041d4ed88d diff --git a/weldr-client.spec b/weldr-client.spec index 733870d..df02df7 100644 --- a/weldr-client.spec +++ b/weldr-client.spec @@ -3,11 +3,11 @@ # Pass --without signed to skip gpg signed tar.gz (DO NOT DO THAT IN PRODUCTION) %bcond_without signed -%global goipath github.com/osbuild/weldr-client +%global goipath github.com/osbuild/weldr-client/v2 Name: weldr-client -Version: 35.2 -Release: 2%{?dist} +Version: 35.3 +Release: 1%{?dist} # Upstream license specification: Apache-2.0 License: ASL 2.0 Summary: Command line utility to control osbuild-composer @@ -18,8 +18,6 @@ Source1: https://github.com/osbuild/weldr-client/releases/download/v%{version} Source2: https://keys.openpgp.org/vks/v1/by-fingerprint/117E8C168EFE3A7F#/gpg-117E8C168EFE3A7F.key %endif -Patch0001: 0001-tests-Fix-integration-tests.patch - Obsoletes: composer-cli < 35.0 Provides: composer-cli = %{version}-%{release} @@ -53,6 +51,8 @@ Command line utility to control osbuild-composer %endif %build +export LDFLAGS="-X %{goipath}/cmd/composer-cli/root.Version=%{version} " + %if 0%{?rhel} GO_BUILD_PATH=$PWD/_build install -m 0755 -vd $(dirname $GO_BUILD_PATH/src/%{goipath}) @@ -62,33 +62,33 @@ install -m 0755 -vd _bin export PATH=$PWD/_bin${PATH:+:$PATH} export GOPATH=$GO_BUILD_PATH:%{gopath} export GOFLAGS=-mod=vendor +%gobuild -o composer-cli %{goipath}/cmd/composer-cli %else export GOPATH="%{gobuilddir}:${GOPATH:+${GOPATH}:}%{?gopath}" export GO111MODULE=off +make GOBUILDFLAGS="%{gobuildflags}" build %endif -export LDFLAGS="-X github.com/osbuild/weldr-client/cmd/composer-cli/root.Version=%{version} " -make GOBUILDFLAGS="%{gobuildflags}" build ## TODO ##make man %if %{with tests} || 0%{?rhel} +export BUILDTAGS="integration" + # Build test binaries with `go test -c`, so that they can take advantage of -# golang's testing package. The golang rpm macros don't support building them +# golang's testing package. The RHEL golang rpm macros don't support building them # directly. Thus, do it manually, taking care to also include a build id. # # On Fedora, also turn off go modules and set the path to the one into which # the golang-* packages install source code. -%if 0%{?fedora} -export GOPATH="%{gobuilddir}:${GOPATH:+${GOPATH}:}%{?gopath}" -export GO111MODULE=off -%endif - -export LDFLAGS="-X github.com/osbuild/weldr-client/cmd/composer-cli/root.Version=%{version} " -export BUILDTAGS="integration" +%if 0%{?rhel} +export LDFLAGS="${LDFLAGS:-} -B 0x$(od -N 20 -An -tx1 -w100 /dev/urandom | tr -d ' ')" +go test -c -tags=integration -ldflags="${LDFLAGS}" -o composer-cli-tests %{goipath}/weldr +%else make GOBUILDFLAGS="%{gobuildflags}" integration %endif +%endif %install make DESTDIR=%{buildroot} install @@ -103,8 +103,10 @@ export GOPATH="%{gobuilddir}:${GOPATH:+${GOPATH}:}%{?gopath}" export GO111MODULE=off %endif -export LDFLAGS="-X github.com/osbuild/weldr-client/cmd/composer-cli/root.Version=%{version} " -make GOBUILDFLAGS="%{gotestflags}" test +# Run the unit tests +export LDFLAGS="-X %{goipath}/cmd/composer-cli/root.Version=%{version} " +make test + %files %license LICENSE @@ -129,6 +131,49 @@ composer-cli package. %changelog +* Mon Oct 04 2021 Brian C. Lane - 35.3-1 +- New release: 35.3 (bcl) + Resolves: rhbz#2010519 +- spec: Adjust build methods for RHEL 8 (bcl) +- github: Run build-in-podman to test building package (bcl) +- spec: Use v2 module (bcl) +- Makefile: Use v2 module (bcl) +- Makefile: Add a build-in-podman target (bcl) +- tests: Add JSON and error result testing to status (bcl) +- tests: Add JSON and error result testing to sources (bcl) +- tests: Add JSON and error result testing to projects (bcl) +- tests: Add JSON and error result testing to modules (bcl) +- tests: Add JSON and error result testing to distros (bcl) +- tests: Add JSON and error result testing to compose (bcl) +- tests: Add JSON and error result testing to blueprints (bcl) +- test: Fix test client setup and output capture code (bcl) +- test: Close output capture in printwrap_test (bcl) +- test: reset the root flags on every ExecuteTest call (bcl) +- status: Use ExecutionErrors for API errors (bcl) +- sources: Use ExecutionErrors for API errors (bcl) +- projects: Use ExecutionErrors for API errors (bcl) +- modules: Use ExecutionErrors for API errors (bcl) +- distros: Use ExecutionErrors for API errors (bcl) +- compose: Use ExecutionErrors for API errors (bcl) +- blueprints: Use ExecutionErrors for API errors (bcl) +- composer-cli: Turn off normal command Stdout when --json is used (bcl) +- weldr: Fix Stringer interface on API messages (bcl) +- weldr: Clean up error message return code (bcl) +- weldr: Move Unmarshal error to error position (bcl) +- root: Add a helper function to print a list of errors (bcl) +- Use GetFilePath for ComposeImage (bcl) +- Use GetFilePath for ComposeResults (bcl) +- Use GetFilePath for ComposerMetadata (bcl) +- Use GetFilePath for ComposeLogs (bcl) +- weldr: Add GetFilePath to download a file to a path (bcl) +- Creating v2 module for breaking API changes (bcl) +- Makefile: Add update-mods target (bcl) +- vendor: Update the modules and vendor directory (bcl) +- Bump go version to 1.15 (bcl) +- Limit dependabot to 1 PR (bcl) +- Enable Dependabot service (atodorov) +- tests: Fix integration tests (bcl) + * Wed Aug 25 2021 Brian C. Lane - 35.2-2 - gating: Add gating tests Resolves: rhbz#1996788