f7d02f2
%global with_bundled 1
f7d02f2
f7d02f2
%if 0%{?fedora}
55281e9
%global with_debug 1
f7d02f2
%else
f7d02f2
%global with_debug 0
f7d02f2
%endif
55281e9
17d40d4
%if 0%{?with_debug}
74c1fcd
%global _find_debuginfo_dwz_opts %{nil}
17d40d4
%global _dwz_low_mem_die_limit 0
17d40d4
%else
17d40d4
%global debug_package   %{nil}
17d40d4
%endif
17d40d4
f7d02f2
%if ! 0%{?gobuild:1}
f7d02f2
%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 %{?**};
f7d02f2
%endif
f7d02f2
48de7ee
%global provider github
48de7ee
%global provider_tld com
48de7ee
%global project containers
48de7ee
%global repo buildah
20dac33
# https://github.com/containers/buildah
48de7ee
%global import_path %{provider}.%{provider_tld}/%{project}/%{repo}
48de7ee
%global git0 https://%{import_path}
17d40d4
f7f99ea
%global built_tag v1.23.4
f4248c8
%global built_tag_strip %(b=%{built_tag}; echo ${b:1})
81b840a
%global gen_version %(b=%{built_tag_strip}; echo ${b/-/"~"})
e0e6327
c14385f
Name: %{repo}
81b840a
Version: %{gen_version}
81b840a
Release: %autorelease
c14385f
Summary: A command line tool used for creating OCI Images
d9aa5d0
License: ASL 2.0 and BSD and MIT and MPLv2.0
698aeda
URL: https://%{name}.io
86fe1dc
Source: %{git0}/archive/%{built_tag}.tar.gz
975a714
BuildRequires: device-mapper-devel
c350f27
BuildRequires: git-core
536540c
BuildRequires: golang >= 1.16.6
f7d02f2
BuildRequires: git
c14385f
BuildRequires: glib2-devel
c14385f
BuildRequires: glibc-static
153db9d
BuildRequires: go-md2man
342168a
BuildRequires: go-rpm-macros
c14385f
BuildRequires: gpgme-devel
c14385f
BuildRequires: libassuan-devel
057ff55
BuildRequires: make
382e5e6
BuildRequires: ostree-devel
153db9d
BuildRequires: btrfs-progs-devel
7185c82
Requires: containers-common >= 4:1-40
479831d
Suggests: containernetworking-plugins >= 0.9.1-1
479831d
Requires: netavark
479831d
Requires: iptables
479831d
Requires: nftables
a8ccab0
BuildRequires: libseccomp-static
bcb892a
Requires: libseccomp >= 2.4.1-0
2371f5e
Suggests: cpp
ac57dc9
Suggests: qemu-user-static
64504b2
# 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'
d9aa5d0
Provides: bundled(golang(github.com/containerd/containerd)) = v1.5.7
d9aa5d0
Provides: bundled(golang(github.com/containernetworking/cni)) = v0.8.1
d9aa5d0
Provides: bundled(golang(github.com/containers/common)) = v0.44.2
d9aa5d0
Provides: bundled(golang(github.com/containers/image/v5)) = v5.16.0
81b840a
Provides: bundled(golang(github.com/containers/ocicrypt)) = v1.1.2
d9aa5d0
Provides: bundled(golang(github.com/containers/storage)) = v1.36.0
81b840a
Provides: bundled(golang(github.com/docker/distribution)) = v2.7.1+incompatible
81b840a
Provides: bundled(golang(github.com/docker/go_units)) = v0.4.0
81b840a
Provides: bundled(golang(github.com/docker/libnetwork)) = v0.8.0_dev.2.0.20190625141545_5a177b73e316
d9aa5d0
Provides: bundled(golang(github.com/fsouza/go_dockerclient)) = v1.7.4
81b840a
Provides: bundled(golang(github.com/ghodss/yaml)) = v1.0.0
81b840a
Provides: bundled(golang(github.com/hashicorp/go_multierror)) = v1.1.1
81b840a
Provides: bundled(golang(github.com/ishidawataru/sctp)) = v0.0.0_20210226210310_f2269e66cdee
81b840a
Provides: bundled(golang(github.com/konsorten/go_windows_terminal_sequences)) = v1.0.3
81b840a
Provides: bundled(golang(github.com/mattn/go_shellwords)) = v1.0.12
d9aa5d0
Provides: bundled(golang(github.com/modern_go/reflect2)) = v1.0.2
d9aa5d0
Provides: bundled(golang(github.com/onsi/ginkgo)) = v1.16.4
d9aa5d0
Provides: bundled(golang(github.com/onsi/gomega)) = v1.16.0
81b840a
Provides: bundled(golang(github.com/opencontainers/go_digest)) = v1.0.0
d9aa5d0
Provides: bundled(golang(github.com/opencontainers/image_spec)) = v1.0.2_0.20210819154149_5ad6f50d6283
d9aa5d0
Provides: bundled(golang(github.com/opencontainers/runc)) = v1.0.2
81b840a
Provides: bundled(golang(github.com/opencontainers/runtime_spec)) = v1.0.3_0.20210326190908_1c3f411f0417
81b840a
Provides: bundled(golang(github.com/opencontainers/runtime_tools)) = v0.9.0
d9aa5d0
Provides: bundled(golang(github.com/opencontainers/selinux)) = v1.8.5
7386c3c
Provides: bundled(golang(github.com/openshift/imagebuilder)) = v1.2.2_0.20210415181909_87f3e48c2656
81b840a
Provides: bundled(golang(github.com/pkg/errors)) = v0.9.1
d9aa5d0
Provides: bundled(golang(github.com/seccomp/libseccomp_golang)) = v0.9.2_0.20200616122406_847368b35ebf
81b840a
Provides: bundled(golang(github.com/sirupsen/logrus)) = v1.8.1
d9aa5d0
Provides: bundled(golang(github.com/spf13/cobra)) = v1.2.1
81b840a
Provides: bundled(golang(github.com/spf13/pflag)) = v1.0.5
81b840a
Provides: bundled(golang(github.com/stretchr/testify)) = v1.7.0
81b840a
Provides: bundled(golang(github.com/syndtr/gocapability)) = v0.0.0_20200815063812_42c35b437635
7386c3c
Provides: bundled(golang(k8s.io/klog)) = v1.0.0
17d40d4
17d40d4
%description
6952568
The %{name} package provides a command line tool which can be used to
17d40d4
* create a working container from scratch
17d40d4
or
17d40d4
* create a working container from an image as a starting point
17d40d4
* mount/umount a working container's root file system for manipulation
17d40d4
* save container's root file system layer to create a new image
17d40d4
* delete a working container or an image
17d40d4
ca8c5ef
%package tests
ca8c5ef
Summary: Tests for %{name}
ca8c5ef
ca8c5ef
Requires: %{name} = %{version}-%{release}
ca8c5ef
Requires: bats
ca8c5ef
Requires: bzip2
ca8c5ef
Requires: podman
ca8c5ef
Requires: golang
572907d
Requires: jq
4c0f649
Requires: httpd-tools
6150164
Requires: openssl
4004b72
Requires: nmap-ncat
6a5111d
Requires: git-daemon
ca8c5ef
ca8c5ef
%description tests
ca8c5ef
%{summary}
ca8c5ef
ca8c5ef
This package contains system tests for %{name}
ca8c5ef
17d40d4
%prep
c350f27
%autosetup -Sgit -n %{name}-%{built_tag_strip}
17d40d4
17d40d4
%build
81b840a
%set_build_flags
81b840a
export GOPATH=$(pwd)/_build:$(pwd)
81b840a
export CGO_CFLAGS=$CFLAGS
81b840a
# These extra flags present in $CFLAGS have been skipped for now as they break the build
81b840a
CGO_CFLAGS=$(echo $CGO_CFLAGS | sed 's/-flto=auto//g')
81b840a
CGO_CFLAGS=$(echo $CGO_CFLAGS | sed 's/-Wp,D_GLIBCXX_ASSERTIONS//g')
81b840a
CGO_CFLAGS=$(echo $CGO_CFLAGS | sed 's/-specs=\/usr\/lib\/rpm\/redhat\/redhat-annobin-cc1//g')
81b840a
81b840a
%ifarch x86_64
81b840a
export CGO_CFLAGS+=" -m64 -mtune=generic -fcf-protection=full"
81b840a
%endif
81b840a
17d40d4
mkdir _build
17d40d4
pushd _build
17d40d4
mkdir -p src/%{provider}.%{provider_tld}/%{project}
17d40d4
ln -s $(dirs +1 -l) src/%{import_path}
17d40d4
popd
17d40d4
17d40d4
mv vendor src
17d40d4
6fedea2
export CNI_VERSION=`grep '^# github.com/containernetworking/cni ' src/modules.txt | sed 's,.* ,,'`
6fedea2
export LDFLAGS="-X main.buildInfo=`date +%s` -X main.cniVersion=${CNI_VERSION}"
6fedea2
b6bb0bb
export BUILDTAGS='seccomp selinux'
f7d02f2
%if 0%{?centos} >= 8
f7d02f2
export BUILDTAGS+=' exclude_graphdriver_btrfs'
f7d02f2
%endif
293c1c8
%gobuild -o bin/%{name} %{import_path}/cmd/%{name}
293c1c8
%gobuild -o bin/imgtype %{import_path}/tests/imgtype
a2a76a8
%gobuild -o bin/copy    %{import_path}/tests/copy
ccecb84
GOMD2MAN=go-md2man %{__make} -C docs
17d40d4
17d40d4
%install
17d40d4
export GOPATH=$(pwd)/_build:$(pwd):%{gopath}
17d40d4
make DESTDIR=%{buildroot} PREFIX=%{_prefix} install install.completions
ccecb84
make DESTDIR=%{buildroot} PREFIX=%{_prefix} -C docs install
17d40d4
ca8c5ef
install -d -p %{buildroot}/%{_datadir}/%{name}/test/system
ca8c5ef
cp -pav tests/. %{buildroot}/%{_datadir}/%{name}/test/system
293c1c8
cp bin/imgtype %{buildroot}/%{_bindir}/%{name}-imgtype
a2a76a8
cp bin/copy    %{buildroot}/%{_bindir}/%{name}-copy
ca8c5ef
17d40d4
#define license tag if not already defined
17d40d4
%{!?_licensedir:%global license %doc}
17d40d4
17d40d4
%files
17d40d4
%license LICENSE
17d40d4
%doc README.md
17d40d4
%{_bindir}/%{name}
6952568
%{_mandir}/man1/%{name}*
17d40d4
%dir %{_datadir}/bash-completion
17d40d4
%dir %{_datadir}/bash-completion/completions
6952568
%{_datadir}/bash-completion/completions/%{name}
17d40d4
ca8c5ef
%files tests
ca8c5ef
%license LICENSE
ca8c5ef
%{_bindir}/%{name}-imgtype
a2a76a8
%{_bindir}/%{name}-copy
ca8c5ef
%{_datadir}/%{name}/test
ca8c5ef
17d40d4
%changelog
81b840a
%autochangelog