%global with_debug 1 %if 0%{?with_debug} %global _find_debuginfo_dwz_opts %{nil} %global _dwz_low_mem_die_limit 0 %else %global debug_package %{nil} %endif %if ! 0%{?gobuild:1} %define gobuild(o:) GO111MODULE=off go build -buildmode pie -compiler gc -tags="rpm_crashtraceback ${BUILDTAGS:-}" -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '-Wl,-z,relro -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld '" -a -v -x %{?**}; %endif %global provider github %global provider_tld com %global project containerd %global repo stargz-snapshotter # https://github.com/containerd/stargz-snapshotter %global import_path %{provider}.%{provider_tld}/%{project}/%{repo} %global git0 https://%{import_path} %global built_tag v0.10.1 %global built_tag_strip %(b=%{built_tag}; echo ${b:1}) Name: %{repo} Version: 0.10.1 Release: 2%{?dist} Summary: Fast container image distribution plugin with lazy pulling License: ASL 2.0 URL: %{git0} Source0: %{built_tag}-vendor.tar.gz BuildRequires: golang BuildRequires: go-rpm-macros BuildRequires: git BuildRequires: glib2-devel BuildRequires: glibc-static BuildRequires: make BuildRequires: systemd-rpm-macros # vendored go libs, commented ones make rpmbuild unhappy # awk '{print "Provides: bundled(golang("$1")) = "$2}' cmd/go.mod | sort # Provides: bundled(golang(github.com/containerd/containerd)) = v1.6.0-beta.1.0.20211101005050-f0d3ea96cf8c # Provides: bundled(golang(github.com/containerd/containerd/api)) = v1.6.0-beta.1.0.20211101005050-f0d3ea96cf8c Provides: bundled(golang(github.com/containerd/go-cni)) = v1.1.0 Provides: bundled(golang(github.com/containerd/stargz-snapshotter)) = v0.10.0 Provides: bundled(golang(github.com/containerd/stargz-snapshotter/estargz)) = v0.10.0 Provides: bundled(golang(github.com/containerd/stargz-snapshotter/ipfs)) = v0.10.0 Provides: bundled(golang(github.com/coreos/go-systemd/v22)) = v22.3.2 Provides: bundled(golang(github.com/docker/go-metrics)) = v0.0.1 Provides: bundled(golang(github.com/hashicorp/go-multierror)) = v1.1.1 Provides: bundled(golang(github.com/ipfs/go-ipfs-http-client)) = v0.1.0 Provides: bundled(golang(github.com/ipfs/interface-go-ipfs-core)) = v0.5.2 Provides: bundled(golang(github.com/opencontainers/go-digest)) = v1.0.0 # Provides: bundled(golang(github.com/opencontainers/image-spec)) = v1.0.2-0.20210819154149-5ad6f50d6283 # Provides: bundled(golang(github.com/opencontainers/runtime-spec)) = v1.0.3-0.20210326190908-1c3f411f0417 Provides: bundled(golang(github.com/pelletier/go-toml)) = v1.9.4 Provides: bundled(golang(github.com/pkg/errors)) = v0.9.1 Provides: bundled(golang(github.com/rs/xid)) = v1.3.0 Provides: bundled(golang(github.com/sirupsen/logrus)) = v1.8.1 Provides: bundled(golang(github.com/urfave/cli)) = v1.22.4 Provides: bundled(golang(go)) = 1.16 # Provides: bundled(golang(golang.org/x/sys)) = v0.0.0-20210915083310-ed5796bab164 Provides: bundled(golang(google.golang.org/grpc)) = v1.42.0 Provides: bundled(golang(k8s.io/cri-api)) = v0.22.3 %description %{summary} %prep %autosetup -Sgit -n %{name}-%{built_tag_strip}-vendor %build mkdir _build pushd _build mkdir -p src/%{provider}.%{provider_tld}/%{project} ln -s $(dirs +1 -l) src/%{import_path} popd mv cmd/vendor src export GOPATH=$(pwd)/_build:$(pwd) export CGO_CFLAGS="-O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -ffat-lto-objects -fexceptions -fasynchronous-unwind-tables -fstack-protector-strong -fstack-clash-protection -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64" %ifarch x86_64 export CGO_CFLAGS+=" -m64 -mtune=generic -fcf-protection=full" %endif # These extra flags present in %%{optflags} have been skipped for now as they break the build #export CGO_CFLAGS+=" -flto=auto -Wp,D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1" %gobuild -o out/%{project}-stargz-grpc %{import_path}/cmd/%{project}-stargz-grpc %gobuild -o out/ctr-remote %{import_path}/cmd/ctr-remote %gobuild -o out/stargz-store %{import_path}/cmd/stargz-store %install export GOPATH=$(pwd)/_build:$(pwd):%{gopath} make CMD_DESTDIR=%{buildroot}%{_prefix} install sed -i 's/\/local//' script/config-cri-o/etc/systemd/system/stargz-store.service install -D -m 644 script/config-cri-o/etc/systemd/system/stargz-store.service %{buildroot}%{_unitdir}/stargz-store.service #define license tag if not already defined %{!?_licensedir:%global license %doc} %post %systemd_post stargz-store.service %preun %systemd_preun stargz-store.service %postun %systemd_postun stargz-store.service %files %license LICENSE %doc NOTICE.md README.md docs/{ctr-remote,overview,stargz-estargz,verification}.md %{_bindir}/%{project}-stargz-grpc %{_bindir}/ctr-remote %{_bindir}/stargz-store %{_unitdir}/stargz-store.service %changelog * Sat Jan 22 2022 Fedora Release Engineering - 0.10.1-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild * Thu Nov 18 2021 RH Container Bot - 0.10.1-1 - autobuilt v0.10.1 * Fri Nov 12 2021 RH Container Bot - 0.10.0-1 - autobuilt v0.10.0 * Wed Oct 06 2021 Kohei Tokunaga - 0.9.0-2 - Add install of systemd config for Stargz Store * Wed Sep 29 2021 RH Container Bot - 0.9.0-1 - autobuilt v0.9.0 * Thu Sep 09 2021 Lokesh Mandvekar - 0.8.0-1 - Resolves: #2000732 - Initial package