mirror of
https://abf.rosa.ru/djam/buildah.git
synced 2025-02-25 01:32:49 +00:00
139 lines
4.9 KiB
RPMSpec
139 lines
4.9 KiB
RPMSpec
%global with_bundled 1
|
|
|
|
%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}
|
|
%global git0 https://%{import_path}
|
|
|
|
%define built_tag v1.22.3
|
|
%define built_tag_strip %(b=%{built_tag}; echo ${b:1})
|
|
|
|
Name: buildah
|
|
Version: 1.22.3
|
|
Release: 1
|
|
Summary: A command line tool used for creating OCI Images
|
|
Group: Development/Other
|
|
License: ASL 2.0
|
|
URL: https://%{name}.io
|
|
Source0: %{git0}/archive/%{built_tag}.tar.gz
|
|
Source10: buildah.rpmlintrc
|
|
BuildRequires: device-mapper-devel
|
|
BuildRequires: golang >= 1.16.6
|
|
BuildRequires: git
|
|
BuildRequires: glib2-devel
|
|
BuildRequires: glibc-static-devel
|
|
BuildRequires: go-md2man
|
|
BuildRequires: go-rpm-macros
|
|
BuildRequires: gpgme-devel
|
|
BuildRequires: libassuan-devel
|
|
BuildRequires: pkgconfig(ostree-1)
|
|
BuildRequires: btrfs-devel
|
|
BuildRequires: seccomp-devel
|
|
Requires: %{_lib}seccomp >= 2.4.1-0
|
|
#Requires: containers-common
|
|
Requires: crun >= 0.17.1-1
|
|
#Requires: container-selinux
|
|
Requires: slirp4netns >= 0.3-0
|
|
|
|
%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
|
|
%license LICENSE
|
|
%doc README.md
|
|
%{_bindir}/%{name}
|
|
%{_mandir}/man1/%{name}*
|
|
%dir %{_datadir}/bash-completion
|
|
%dir %{_datadir}/bash-completion/completions
|
|
%{_datadir}/bash-completion/completions/%{name}
|
|
|
|
#---------------------------------------------------------------------
|
|
%package tests
|
|
Summary: Tests for %{name}
|
|
Group: Development/Other
|
|
Requires: %{name} = %{version}-%{release}
|
|
Requires: bats
|
|
Requires: bzip2
|
|
Requires: podman
|
|
Requires: golang
|
|
Requires: jq
|
|
Requires: httpd-tools
|
|
Requires: openssl
|
|
Requires: nmap-ncat
|
|
|
|
%description tests
|
|
%{summary}
|
|
|
|
This package contains system tests for %{name}
|
|
|
|
%files tests
|
|
%license LICENSE
|
|
%{_bindir}/%{name}-imgtype
|
|
%{_bindir}/%{name}-copy
|
|
%{_datadir}/%{name}/test
|
|
|
|
#---------------------------------------------------------------------
|
|
|
|
%prep
|
|
%autosetup -Sgit -n %{name}-%{built_tag_strip}
|
|
|
|
%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 {} \;
|