tdawson / rpms / buildah

Forked from rpms/buildah 2 years ago
Clone
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
6dd08db
%global built_tag v1.28.0
66dfaf0
%global built_tag_strip %(b=%{built_tag}; echo ${b:1})
6dd08db
%global gen_version %(b=%{built_tag_strip}; echo ${b/-/"~"})
e0e6327
c14385f
Name: %{repo}
66dfaf0
Version: %{gen_version}
842aa41
License: ASL 2.0 and BSD and MIT and MPLv2.0
56f7ebb
Release: %autorelease
c14385f
Summary: A command line tool used for creating OCI Images
698aeda
URL: https://%{name}.io
6dd08db
# Tarball fetched from upstream
6dd08db
Source: %{git0}/archive/%{built_tag}.tar.gz
8497206
ExclusiveArch: %{golang_arches}
842aa41
BuildRequires: go-md2man
975a714
BuildRequires: device-mapper-devel
ad0035d
BuildRequires: git-core
536540c
BuildRequires: golang >= 1.16.6
c14385f
BuildRequires: glib2-devel
c14385f
BuildRequires: glibc-static
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
Martin Jackson 2efac3a
BuildRequires: shadow-utils-subid-devel
64a5677
%if 0%{?fedora} > 37
64a5677
Requires: containers-common-extra >= 4:1-78
64a5677
%else
64a5677
%if 0%{?fedora} == 37
64a5677
Requires: containers-common-extra >= 4:1-73
64a5677
%else
64a5677
Requires: containers-common-extra >= 4:1-62
64a5677
%endif
64a5677
%endif
a8ccab0
BuildRequires: libseccomp-static
bcb892a
Requires: libseccomp >= 2.4.1-0
2371f5e
Suggests: cpp
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
6dd08db
%autosetup -Sgit -n %{name}-%{built_tag_strip}
17d40d4
17d40d4
%build
56f7ebb
%set_build_flags
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
842aa41
842aa41
export GOPATH=$(pwd)/_build:$(pwd)
842aa41
export CGO_CFLAGS=$CFLAGS
56f7ebb
17d40d4
mkdir _build
842aa41
cd _build
17d40d4
mkdir -p src/%{provider}.%{provider_tld}/%{project}
842aa41
ln -s ../../../../ src/%{import_path}
842aa41
cd ..
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
842aa41
export BUILDTAGS='seccomp exclude_graphdriver_devicemapper'
Martin Jackson 2efac3a
export BUILDTAGS+=' libsubid selinux'
293c1c8
%gobuild -o bin/%{name} %{import_path}/cmd/%{name}
293c1c8
%gobuild -o bin/imgtype %{import_path}/tests/imgtype
842aa41
%gobuild -o bin/copy %{import_path}/tests/copy
62002a5
%gobuild -o bin/tutorial %{import_path}/tests/tutorial
ccecb84
GOMD2MAN=go-md2man %{__make} -C docs
17d40d4
17d40d4
%install
842aa41
export GOPATH=$(pwd)/_build:$(pwd)
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
62002a5
cp bin/tutorial %{buildroot}/%{_bindir}/%{name}-tutorial
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
62002a5
%{_bindir}/%{name}-tutorial
ca8c5ef
%{_datadir}/%{name}/test
ca8c5ef
17d40d4
%changelog
56f7ebb
%autochangelog