mirror of
https://abf.rosa.ru/djam/buildah.git
synced 2025-02-23 16:52:49 +00:00
144 lines
5 KiB
RPMSpec
144 lines
5 KiB
RPMSpec
%global debug_package %{nil}
|
|
|
|
%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 %{?**};
|
|
%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 '" -a -v -x %{?**};
|
|
%endif
|
|
|
|
%global provider github
|
|
%global provider_tld com
|
|
%global project containers
|
|
%global repo buildah
|
|
# https://github.com/containers/buildah
|
|
%global import_path %{provider}.%{provider_tld}/%{project}/%{repo}
|
|
|
|
# Disable tests package until we have all Requires
|
|
%bcond_with tests
|
|
|
|
Summary: A command line tool used for creating OCI Images
|
|
Name: buildah
|
|
Version: 1.39.0
|
|
Release: 1
|
|
License: ASL 2.0
|
|
Group: Development/Other
|
|
URL: https://%{name}.io
|
|
Source0: https://%{import_path}/archive/v%{version}.tar.gz?/%{name}-%{version}.tar.gz
|
|
Source10: buildah.rpmlintrc
|
|
#BuildRequires: device-mapper-devel
|
|
BuildRequires: go >= 1.16.6
|
|
BuildRequires: git-core
|
|
BuildRequires: glib2-devel
|
|
BuildRequires: glibc-static-devel
|
|
BuildRequires: go-md2man
|
|
#BuildRequires: go-rpm-macros
|
|
BuildRequires: pkgconfig(gpgme)
|
|
BuildRequires: pkgconfig(libassuan)
|
|
BuildRequires: pkgconfig(ostree-1)
|
|
BuildRequires: btrfs-devel
|
|
BuildRequires: pkgconfig(libseccomp)
|
|
Requires: %{_lib}seccomp2 >= 2.4.1
|
|
Requires: cni-plugins
|
|
Requires: crun >= 0.17.1-1
|
|
#Requires: container-selinux
|
|
Requires: slirp4netns >= 0.3
|
|
|
|
%description
|
|
The %{name} package provides a command line tool which can be used to
|
|
* create a working container from scratch
|
|
or
|
|
* create a working container from an image as a starting point
|
|
* mount/umount a working container's root file system for manipulation
|
|
* save container's root file system layer to create a new image
|
|
* delete a working container or an image
|
|
|
|
%files
|
|
%doc README.md LICENSE
|
|
%{_bindir}/%{name}
|
|
%{_mandir}/man1/%{name}*
|
|
%dir %{_datadir}/bash-completion
|
|
%dir %{_datadir}/bash-completion/completions
|
|
%{_datadir}/bash-completion/completions/%{name}
|
|
|
|
#---------------------------------------------------------------------
|
|
|
|
%if %{with tests}
|
|
%package tests
|
|
Summary: Tests for %{name}
|
|
Group: Development/Other
|
|
Requires: %{name} = %{EVRD}
|
|
Requires: bats
|
|
Requires: bzip2
|
|
Requires: podman
|
|
Requires: golang
|
|
Requires: jq
|
|
Requires: httpd-tools
|
|
Requires: openssl
|
|
Requires: nmap-ncat
|
|
|
|
%description tests
|
|
Tests for %{name}
|
|
|
|
This package contains system tests for %{name}
|
|
|
|
%files tests
|
|
%doc LICENSE
|
|
%{_bindir}/%{name}-imgtype
|
|
%{_bindir}/%{name}-copy
|
|
%{_datadir}/%{name}/test
|
|
%endif
|
|
|
|
#---------------------------------------------------------------------
|
|
|
|
%prep
|
|
%setup -q
|
|
|
|
%build
|
|
mkdir _build
|
|
pushd _build
|
|
mkdir -p src/%{provider}.%{provider_tld}/%{project}
|
|
ln -s $(dirs +1 -l) src/%{import_path}
|
|
popd
|
|
|
|
mv 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"
|
|
export CGO_CFLAGS="-O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -ffat-lto-objects -fexceptions -fasynchronous-unwind-tables -fstack-protector-strong -fstack-clash-protection -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE"
|
|
# FIXME: Investigate why this fails
|
|
%ifnarch s390x
|
|
export CGO_CFLAGS+=" -D_FILE_OFFSET_BITS=64"
|
|
%endif
|
|
%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"
|
|
|
|
export CNI_VERSION=`grep '^# github.com/containernetworking/cni ' src/modules.txt | sed 's,.* ,,'`
|
|
export LDFLAGS="-X main.buildInfo=`date +%s` -X main.cniVersion=${CNI_VERSION}"
|
|
|
|
export BUILDTAGS='seccomp selinux'
|
|
%gobuild -o bin/%{name} %{import_path}/cmd/%{name}
|
|
%gobuild -o bin/imgtype %{import_path}/tests/imgtype
|
|
%gobuild -o bin/copy %{import_path}/tests/copy
|
|
GOMD2MAN=go-md2man %{__make} -C docs
|
|
|
|
%install
|
|
export GOPATH=$(pwd)/_build:$(pwd):%{gopath}
|
|
make DESTDIR=%{buildroot} PREFIX=%{_prefix} install install.completions
|
|
make DESTDIR=%{buildroot} PREFIX=%{_prefix} -C docs install
|
|
|
|
install -d -p %{buildroot}%{_datadir}/%{name}/test/system
|
|
cp -pav tests/. %{buildroot}%{_datadir}/%{name}/test/system
|
|
cp bin/imgtype %{buildroot}%{_bindir}/%{name}-imgtype
|
|
cp bin/copy %{buildroot}%{_bindir}/%{name}-copy
|
|
|
|
# delete hidden files
|
|
find %{buildroot} -name .travis.yml -exec rm {} \;
|
|
find %{buildroot} -name .dockerignore -exec rm {} \;
|
|
|
|
%if %{without tests}
|
|
rm -f %{buildroot}%{_bindir}/%{name}-imgtype
|
|
rm -f %{buildroot}%{_bindir}/%{name}-copy
|
|
rm -rf %{buildroot}%{_datadir}/%{name}/test
|
|
%endif
|