55281e9
%global with_debug 1
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
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
RH Container Bot edd7fe3
%global built_tag v1.26.1
b3aed0d
%global built_tag_strip %(b=%{built_tag}; echo ${b:1})
56f7ebb
%global gen_version %(b=%{built_tag_strip}; echo ${b/-/"~"})
e0e6327
c14385f
Name: %{repo}
56f7ebb
Version: %{gen_version}
56f7ebb
Release: %autorelease
c14385f
Summary: A command line tool used for creating OCI Images
640434a
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
ad0035d
BuildRequires: git-core
536540c
BuildRequires: golang >= 1.16.6
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
68c8edb
Requires: containers-common >= 4:1-46
4a27677
Suggests: containernetworking-plugins >= 0.9.1-1
4a27677
Requires: netavark
4a27677
Requires: iptables
4a27677
Requires: nftables
a8ccab0
BuildRequires: libseccomp-static
bcb892a
Requires: libseccomp >= 2.4.1-0
2371f5e
Suggests: cpp
ac57dc9
Suggests: qemu-user-static
c71080d
# 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'
c71080d
Provides: bundled(golang(github.com/containerd/containerd)) = v1.5.9
c71080d
Provides: bundled(golang(github.com/containernetworking/cni)) = v1.0.1
640434a
Provides: bundled(golang(github.com/containers/common)) = v0.47.4
fec2c8b
Provides: bundled(golang(github.com/containers/image/v5)) = v5.19.1
56f7ebb
Provides: bundled(golang(github.com/containers/ocicrypt)) = v1.1.2
fec2c8b
Provides: bundled(golang(github.com/containers/storage)) = v1.38.2
640434a
Provides: bundled(golang(github.com/docker/distribution)) = v2.8.0+incompatible
c71080d
Provides: bundled(golang(github.com/docker/docker)) = v20.10.12+incompatible
56f7ebb
Provides: bundled(golang(github.com/docker/go_units)) = v0.4.0
56f7ebb
Provides: bundled(golang(github.com/docker/libnetwork)) = v0.8.0_dev.2.0.20190625141545_5a177b73e316
640434a
Provides: bundled(golang(github.com/fsouza/go_dockerclient)) = v1.7.8
56f7ebb
Provides: bundled(golang(github.com/ghodss/yaml)) = v1.0.0
56f7ebb
Provides: bundled(golang(github.com/hashicorp/go_multierror)) = v1.1.1
56f7ebb
Provides: bundled(golang(github.com/ishidawataru/sctp)) = v0.0.0_20210226210310_f2269e66cdee
56f7ebb
Provides: bundled(golang(github.com/konsorten/go_windows_terminal_sequences)) = v1.0.3
56f7ebb
Provides: bundled(golang(github.com/mattn/go_shellwords)) = v1.0.12
c71080d
Provides: bundled(golang(github.com/onsi/ginkgo)) = v1.16.5
fec2c8b
Provides: bundled(golang(github.com/onsi/gomega)) = v1.18.1
56f7ebb
Provides: bundled(golang(github.com/opencontainers/go_digest)) = v1.0.0
c71080d
Provides: bundled(golang(github.com/opencontainers/image_spec)) = v1.0.3_0.20211202193544_a5463b7f9c84
c71080d
Provides: bundled(golang(github.com/opencontainers/runc)) = v1.1.0
56f7ebb
Provides: bundled(golang(github.com/opencontainers/runtime_spec)) = v1.0.3_0.20210326190908_1c3f411f0417
56f7ebb
Provides: bundled(golang(github.com/opencontainers/runtime_tools)) = v0.9.0
c71080d
Provides: bundled(golang(github.com/opencontainers/selinux)) = v1.10.0
fec2c8b
Provides: bundled(golang(github.com/openshift/imagebuilder)) = v1.2.2
56f7ebb
Provides: bundled(golang(github.com/pkg/errors)) = v0.9.1
c71080d
Provides: bundled(golang(github.com/seccomp/libseccomp_golang)) = v0.9.2_0.20210429002308_3879420cc921
56f7ebb
Provides: bundled(golang(github.com/sirupsen/logrus)) = v1.8.1
c71080d
Provides: bundled(golang(github.com/spf13/cobra)) = v1.3.0
56f7ebb
Provides: bundled(golang(github.com/spf13/pflag)) = v1.0.5
56f7ebb
Provides: bundled(golang(github.com/stretchr/testify)) = v1.7.0
56f7ebb
Provides: bundled(golang(github.com/syndtr/gocapability)) = v0.0.0_20200815063812_42c35b437635
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
0fcde3f
Requires: git-daemon
ca8c5ef
ca8c5ef
%description tests
ca8c5ef
%{summary}
ca8c5ef
ca8c5ef
This package contains system tests for %{name}
ca8c5ef
17d40d4
%prep
ad0035d
%autosetup -Sgit -n %{name}-%{built_tag_strip}
17d40d4
17d40d4
%build
56f7ebb
%set_build_flags
56f7ebb
export GOPATH=$(pwd)/_build:$(pwd)
56f7ebb
export CGO_CFLAGS=$CFLAGS
56f7ebb
# These extra flags present in $CFLAGS have been skipped for now as they break the build
56f7ebb
CGO_CFLAGS=$(echo $CGO_CFLAGS | sed 's/-flto=auto//g')
56f7ebb
CGO_CFLAGS=$(echo $CGO_CFLAGS | sed 's/-Wp,D_GLIBCXX_ASSERTIONS//g')
56f7ebb
CGO_CFLAGS=$(echo $CGO_CFLAGS | sed 's/-specs=\/usr\/lib\/rpm\/redhat\/redhat-annobin-cc1//g')
56f7ebb
56f7ebb
%ifarch x86_64
56f7ebb
export CGO_CFLAGS+=" -m64 -mtune=generic -fcf-protection=full"
56f7ebb
%endif
56f7ebb
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'
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
68c8edb
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
56f7ebb
%autochangelog