diff --git a/.gitignore b/.gitignore index 82d76ec..97b1042 100644 --- a/.gitignore +++ b/.gitignore @@ -307,3 +307,4 @@ /v1.11.1.tar.gz /v1.11.2.tar.gz /v1.12.0.tar.gz +/v1.13.0.tar.gz diff --git a/skopeo.spec b/skopeo.spec index 2f69979..6bde97b 100644 --- a/skopeo.spec +++ b/skopeo.spec @@ -7,72 +7,111 @@ %global debug_package %{nil} %endif -%if 0%{?rhel} -%bcond_with btrfs -%else -%bcond_without btrfs +# RHEL 8's default %%gobuild macro doesn't account for the BUILDTAGS variable, so we +# set it separately here and do not depend on RHEL 8's go-srpm-macros package. +%if %{defined rhel} && 0%{?rhel} == 8 +%define gobuild(o:) go build -buildmode pie -compiler gc -tags="rpm_crashtraceback libtrust_openssl ${BUILDTAGS:-}" -ldflags "-linkmode=external -compressdwarf=false ${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '%__global_ldflags'" -a -v -x %{?**}; %endif -%if 0%{?fedora} && ! 0%{?rhel} +%global gomodulesmode GO111MODULE=on + +# No btrfs on RHEL +%if %{defined fedora} +%define build_with_btrfs 1 +%endif + +# Only used in official koji builds +# Copr builds set a separate epoch for all environments +%if %{defined fedora} %define conditional_epoch 1 %else %define conditional_epoch 2 %endif -%global provider github -%global provider_tld com -%global project containers -%global repo skopeo -# https://github.com/containers/skopeo -%global import_path %{provider}.%{provider_tld}/%{project}/%{repo} -%global git0 https://%{import_path} - -%global built_tag v1.12.0 -%global built_tag_strip %(b=%{built_tag}; echo ${b:1}) -%global gen_version %(b=%{built_tag_strip}; echo ${b/-/"~"}) - -Name: %{repo} +Name: skopeo +%if %{defined copr_username} +Epoch: 102 +%else Epoch: %{conditional_epoch} -Version: %{gen_version} +%endif +# DO NOT TOUCH the Version string! +# The TRUE source of this specfile is: +# https://github.com/containers/skopeo/blob/main/rpm/skopeo.spec +# If that's what you're reading, Version must be 0, and will be updated by Packit for +# copr and koji builds. +# If you're reading this on dist-git, the version is automatically filled in by Packit. +Version: 1.13.0 License: Apache-2.0 and BSD-2-Clause and BSD-3-Clause and ISC and MIT and MPL-2.0 Release: %autorelease +%if %{defined golang_arches_future} ExclusiveArch: %{golang_arches_future} +%else +ExclusiveArch: aarch64 ppc64le s390x x86_64 +%endif Summary: Inspect container images and repositories on registries -URL: %{git0} +URL: https://github.com/containers/%{name} # Tarball fetched from upstream -Source0: %{url}/archive/%{built_tag}.tar.gz -BuildRequires: go-md2man -%if %{with btrfs} +Source0: %{url}/archive/v%{version}.tar.gz +BuildRequires: %{_bindir}/go-md2man +%if %{defined build_with_btrfs} BuildRequires: btrfs-progs-devel %endif BuildRequires: git-core -BuildRequires: golang >= 1.16.6 +BuildRequires: golang +%if !%{defined gobuild} BuildRequires: go-rpm-macros +%endif BuildRequires: gpgme-devel BuildRequires: libassuan-devel BuildRequires: pkgconfig(devmapper) BuildRequires: ostree-devel BuildRequires: glib2-devel BuildRequires: make +BuildRequires: shadow-utils-subid-devel Requires: containers-common >= 4:1-21 -# awk '{print "Provides: bundled(golang("$1")) = "$2}' go.mod | sort | uniq | sed -e 's/-/_/g' -e '/bundled(golang())/d' -e '/bundled(golang(go\|module\|replace\|require))/d' -# vendored provides -Provides: bundled(golang(github.com/containers/common)) = v0.47.3 -Provides: bundled(golang(github.com/containers/image/v5)) = v5.19.1 -Provides: bundled(golang(github.com/containers/ocicrypt)) = v1.1.2 -Provides: bundled(golang(github.com/containers/storage)) = v1.38.2 -Provides: bundled(golang(github.com/docker/docker)) = v20.10.12+incompatible -Provides: bundled(golang(github.com/dsnet/compress)) = v0.0.2_0.20210315054119_f66993602bf5 -Provides: bundled(golang(github.com/opencontainers/go_digest)) = v1.0.0 -Provides: bundled(golang(github.com/opencontainers/image_spec)) = v1.0.3_0.20211202193544_a5463b7f9c84 -Provides: bundled(golang(github.com/opencontainers/image_tools)) = v1.0.0_rc3 -Provides: bundled(golang(github.com/pkg/errors)) = v0.9.1 -Provides: bundled(golang(github.com/russross/blackfriday)) = v2.0.0+incompatible -Provides: bundled(golang(github.com/sirupsen/logrus)) = v1.8.1 -Provides: bundled(golang(github.com/spf13/cobra)) = v1.3.0 -Provides: bundled(golang(github.com/spf13/pflag)) = v1.0.5 -Provides: bundled(golang(github.com/stretchr/testify)) = v1.7.0 -Provides: bundled(golang(github.com/syndtr/gocapability)) = v0.0.0_20200815063812_42c35b437635 +# DO NOT DELETE BELOW LINE - used for updating downstream goimports +# vendored libraries +Provides: bundled(golang(github.com/containers/common/pkg/auth)) +Provides: bundled(golang(github.com/containers/common/pkg/flag)) +Provides: bundled(golang(github.com/containers/common/pkg/report)) +Provides: bundled(golang(github.com/containers/common/pkg/retry)) +Provides: bundled(golang(github.com/containers/image/v5/copy)) +Provides: bundled(golang(github.com/containers/image/v5/directory)) +Provides: bundled(golang(github.com/containers/image/v5/docker)) +Provides: bundled(golang(github.com/containers/image/v5/docker/archive)) +Provides: bundled(golang(github.com/containers/image/v5/docker/reference)) +Provides: bundled(golang(github.com/containers/image/v5/image)) +Provides: bundled(golang(github.com/containers/image/v5/manifest)) +Provides: bundled(golang(github.com/containers/image/v5/oci/layout)) +Provides: bundled(golang(github.com/containers/image/v5/pkg/blobinfocache)) +Provides: bundled(golang(github.com/containers/image/v5/pkg/cli)) +Provides: bundled(golang(github.com/containers/image/v5/pkg/cli/sigstore)) +Provides: bundled(golang(github.com/containers/image/v5/pkg/compression)) +Provides: bundled(golang(github.com/containers/image/v5/signature)) +Provides: bundled(golang(github.com/containers/image/v5/signature/signer)) +Provides: bundled(golang(github.com/containers/image/v5/signature/sigstore)) +Provides: bundled(golang(github.com/containers/image/v5/transports)) +Provides: bundled(golang(github.com/containers/image/v5/transports/alltransports)) +Provides: bundled(golang(github.com/containers/image/v5/types)) +Provides: bundled(golang(github.com/containers/ocicrypt/config)) +Provides: bundled(golang(github.com/containers/ocicrypt/helpers)) +Provides: bundled(golang(github.com/containers/storage/pkg/homedir)) +Provides: bundled(golang(github.com/containers/storage/pkg/reexec)) +Provides: bundled(golang(github.com/containers/storage/pkg/unshare)) +Provides: bundled(golang(github.com/docker/distribution/registry/api/errcode)) +Provides: bundled(golang(github.com/docker/distribution/registry/api/v2)) +Provides: bundled(golang(github.com/opencontainers/go-digest)) +Provides: bundled(golang(github.com/opencontainers/image-spec/specs-go/v1)) +Provides: bundled(golang(github.com/sirupsen/logrus)) +Provides: bundled(golang(github.com/spf13/cobra)) +Provides: bundled(golang(github.com/spf13/pflag)) +Provides: bundled(golang(github.com/stretchr/testify/assert)) +Provides: bundled(golang(github.com/stretchr/testify/require)) +Provides: bundled(golang(github.com/syndtr/gocapability/capability)) +Provides: bundled(golang(golang.org/x/exp/maps)) +Provides: bundled(golang(golang.org/x/exp/slices)) +Provides: bundled(golang(golang.org/x/term)) +Provides: bundled(golang(gopkg.in/yaml.v3)) %description Command line utility to inspect images and repositories directly on Docker @@ -99,13 +138,17 @@ Requires: squashfs-tools This package contains system tests for %{name} %prep -%autosetup -Sgit %{name}-%{built_tag_strip} -sed -i 's/install-binary: bin\/%{name}/install-binary:/' Makefile -sed -i 's/completions: bin\/%{name}/completions:/' Makefile -sed -i 's/install-docs: docs/install-docs:/' Makefile +%autosetup -Sgit %{name}-%{version} +# The %%install stage should not rebuild anything but only install what's +# built in the %%build stage. So, remove any dependency on build targets. +sed -i 's/^install-binary: bin\/%{name}.*/install-binary:/' Makefile +sed -i 's/^completions: bin\/%{name}.*/completions:/' Makefile +sed -i 's/^install-docs: docs.*/install-docs:/' Makefile %build %set_build_flags +export CGO_CFLAGS=$CFLAGS + # These extra flags present in $CFLAGS have been skipped for now as they break the build CGO_CFLAGS=$(echo $CGO_CFLAGS | sed 's/-flto=auto//g') CGO_CFLAGS=$(echo $CGO_CFLAGS | sed 's/-Wp,D_GLIBCXX_ASSERTIONS//g') @@ -115,30 +158,23 @@ CGO_CFLAGS=$(echo $CGO_CFLAGS | sed 's/-specs=\/usr\/lib\/rpm\/redhat\/redhat-an export CGO_CFLAGS="$CGO_CFLAGS -m64 -mtune=generic -fcf-protection=full" %endif -export GOPATH=$(pwd)/_build:$(pwd) -export CGO_CFLAGS=$CFLAGS - -%if %{without btrfs} -export BUILDTAGS="exclude_graphdriver_btrfs btrfs_noversion" +BASEBUILDTAGS="$(hack/libdm_tag.sh) $(hack/libsubid_tag.sh)" +%if %{defined build_with_btrfs} +export BUILDTAGS="$BASEBUILDTAGS $(hack/btrfs_tag.sh) $(hack/btrfs_installed_tag.sh)" +%else +export BUILDTAGS="$BASEBUILDTAGS btrfs_noversion exclude_graphdriver_btrfs" %endif # unset LDFLAGS earlier set from set_build_flags LDFLAGS='' -mkdir _build -cd _build -mkdir -p src/%{provider}.%{provider_tld}/%{project} -ln -s ../../../../ src/%{import_path} -cd .. - -mv vendor src - -%gobuild -o bin/%{name} %{import_path}/cmd/%{name} +%gobuild -o bin/%{name} ./cmd/%{name} %{__make} docs %install make \ - PREFIX=%{buildroot}%{_prefix} \ + DESTDIR=%{buildroot} \ + PREFIX=%{_prefix} \ install-binary install-docs install-completions # system tests @@ -166,4 +202,12 @@ cp -pav systemtest/* %{buildroot}/%{_datadir}/%{name}/test/system/ %{_datadir}/%{name}/test %changelog +%if %{defined autochangelog} %autochangelog +%else +# NOTE: This changelog will be visible on CentOS 8 Stream builds +# Other envs are capable of handling autochangelog +* Tue Jun 13 2023 RH Container Bot +- Placeholder changelog for envs that are not autochangelog-ready. +- Contact upstream if you need to report an issue with the build. +%endif diff --git a/sources b/sources index 66eb487..a68a9fa 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (v1.12.0.tar.gz) = 33ae61179e16c2d9d44c746be4c0beb59f2b15ec94f493ecd0589f712e237e6bb4d53f8a7276e9598acb5009b39834a2338a405771f05d1f864c31ab10f4c5f9 +SHA512 (v1.13.0.tar.gz) = b5f6501f6b265b9034768a35d36ae726127099ec20d55b724f44d2506c481f2affe0527bf7e373ace36ad903a2e8246d81b8a3cae7e209a15224cda2dd215cfd