From b98b56cfd405ced9a3f12360a5436755f0864b0f Mon Sep 17 00:00:00 2001 From: Lokesh Mandvekar Date: Wed, 18 May 2022 15:16:30 -0400 Subject: [PATCH] build deb packages using debbuild Signed-off-by: Lokesh Mandvekar --- podman.spec | 91 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 57 insertions(+), 34 deletions(-) diff --git a/podman.spec b/podman.spec index aa27b72..6334d8a 100644 --- a/podman.spec +++ b/podman.spec @@ -1,3 +1,7 @@ +%if "%{_vendor}" == "debbuild" +%define gobuild(o:) GO111MODULE=off go build -buildmode pie -tags=" ${BUILDTAGS:-}" -a -v -x %{?**}; +%endif + %global with_debug 1 %if 0%{?with_debug} @@ -21,7 +25,6 @@ %global import_path_plugins %{provider}.%{provider_tld}/%{project}/%{repo_plugins} %global git_plugins https://%{import_path_plugins} %global commit_plugins 18822f9a4fb35d1349eb256f4cd2bfd372474d84 -%global shortcommit_plugins %(c=%{commit_plugins}; echo ${c:0:7}) # gvproxy %global repo_gvproxy gvisor-tap-vsock @@ -29,34 +32,53 @@ %global import_path_gvproxy %%{provider}.%{provider_tld}/%{project}/%{repo_gvproxy} %global git_gvproxy https://%{import_path_gvproxy} %global commit_gvproxy 4ee84d66bd86668f011733d8873989b5862bcd07 -%global shortcommit_gvproxy %(c=%{commit_gvproxy}; echo ${c:0:7}) %global built_tag v4.1.0 -%global built_tag_strip %(b=%{built_tag}; echo ${b:1}) -%global gen_version %(b=%{built_tag_strip}; echo ${b/-/"~"}) Name: podman Epoch: 3 -Version: %{gen_version} -Release: %autorelease -Summary: Manage Pods, Containers and Container Images +Version: 4.1.0 +%if "%{_vendor}" == "debbuild" +Maintainer: Lokesh Mandvekar +License: ASL-2.0+ +Release: 0%{?dist} +%else License: ASL 2.0 and BSD and ISC and MIT and MPLv2.0 -URL: https://%{name}.io/ +Release: %autorelease ExclusiveArch: %{golang_arches} +%endif +Summary: Manage Pods, Containers and Container Images +URL: https://%{name}.io/ Source0: %{git0}/archive/%{built_tag}.tar.gz -Source1: %{git_plugins}/archive/%{commit_plugins}/%{repo_plugins}-%{shortcommit_plugins}.tar.gz -Source2: %{git_gvproxy}/archive/%{commit_gvproxy}/%{repo_gvproxy}-%{shortcommit_gvproxy}.tar.gz +Source1: %{git_plugins}/archive/%{commit_plugins}/%{repo_plugins}-%{commit_plugins}.tar.gz +Source2: %{git_gvproxy}/archive/%{commit_gvproxy}/%{repo_gvproxy}-%{commit_gvproxy}.tar.gz Provides: %{name}-manpages = %{epoch}:%{version}-%{release} +BuildRequires: go-md2man +BuildRequires: golang +Requires: iptables +Requires: nftables +Recommends: catatonit +%if "%{_vendor}" == "debbuild" +BuildRequires: git +BuildRequires: libassuan-dev +BuildRequires: libglib2.0-dev +BuildRequires: libgpg-error-dev +BuildRequires: libgpgme-dev +BuildRequires: libseccomp-dev +BuildRequires: libsystemd-dev +BuildRequires: pkg-config +Requires: conmon >= 2:2.0.30 +Requires: containers-common >= 4:1 +Requires: uidmap +%else %if ! 0%{?centos} BuildRequires: btrfs-progs-devel %endif BuildRequires: gcc -BuildRequires: golang >= 1.16.6 BuildRequires: glib2-devel BuildRequires: glibc-devel BuildRequires: glibc-static BuildRequires: git-core -BuildRequires: go-md2man %if 0%{?fedora} || 0%{?rhel} >= 9 BuildRequires: go-rpm-macros %endif @@ -73,11 +95,8 @@ BuildRequires: systemd BuildRequires: systemd-devel Requires: conmon >= 2:2.0.30-2 Requires: containers-common >= 4:1-46 -Suggests: containernetworking-plugins >= 0.9.1-1 Requires: netavark >= 1.0.3-1 -Requires: iptables -Requires: nftables -Recommends: catatonit +Suggests: containernetworking-plugins >= 0.9.1-1 Suggests: qemu-user-static # vendored libraries # 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' @@ -141,6 +160,7 @@ Provides: bundled(golang(github.com/uber/jaeger_client_go)) = v2.30.0+incompatib Provides: bundled(golang(github.com/ulikunitz/xz)) = v0.5.10 Provides: bundled(golang(github.com/vbauerster/mpb/v7)) = v7.4.1 Provides: bundled(golang(github.com/vishvananda/netlink)) = v1.1.1_0.20220115184804_dd687eb2f2d4 +%endif %description %{name} (Pod Manager) is a fully featured container engine that is a simple @@ -227,7 +247,7 @@ gvisor-tap-vsock brings a configurable DNS server and dynamic port forwarding. %prep -%autosetup -Sgit -n %{name}-%{built_tag_strip} +%autosetup -Sgit sed -i 's;@@PODMAN@@\;$(BINDIR);@@PODMAN@@\;%{_bindir};' Makefile # untar dnsname @@ -237,9 +257,8 @@ tar zxf %{SOURCE1} tar zxf %{SOURCE2} %build +%if "%{_vendor}" != "debbuild" %set_build_flags -export GO111MODULE=off -export GOPATH=$(pwd)/_build:$(pwd) export CGO_CFLAGS=$CFLAGS # These extra flags present in $CFLAGS have been skipped for now as they break the build CGO_CFLAGS=$(echo $CGO_CFLAGS | sed 's/-flto=auto//g') @@ -249,12 +268,16 @@ CGO_CFLAGS=$(echo $CGO_CFLAGS | sed 's/-specs=\/usr\/lib\/rpm\/redhat\/redhat-an %ifarch x86_64 export CGO_CFLAGS+=" -m64 -mtune=generic -fcf-protection=full" %endif +%endif + +export GO111MODULE=off +export GOPATH=$(pwd)/_build:$(pwd) mkdir _build -pushd _build +cd _build mkdir -p src/%{provider}.%{provider_tld}/%{project} ln -s ../../../../ src/%{import_path} -popd +cd .. ln -s vendor src # build date. FIXME: Makefile uses '/v2/libpod', that doesn't work here? @@ -269,30 +292,30 @@ export BUILDTAGS="seccomp exclude_graphdriver_devicemapper $(hack/btrfs_installe %gobuild -o bin/%{name} %{import_path}/cmd/%{name} # build %%{name}-remote -export BUILDTAGS+=" exclude_graphdriver_btrfs btrfs_noversion remote" +export BUILDTAGS="seccomp exclude_graphdriver_devicemapper exclude_graphdriver_btrfs btrfs_noversion $(hack/selinux_tag.sh) $(hack/systemd_tag.sh) $(hack/libsubid_tag.sh) remote" %gobuild -o bin/%{name}-remote %{import_path}/cmd/%{name} -pushd %{repo_plugins}-%{commit_plugins} +cd %{repo_plugins}-%{commit_plugins} mkdir _build -pushd _build +cd _build mkdir -p src/%{provider}.%{provider_tld}/%{project} ln -s ../../../../ src/%{import_path_plugins} -popd +cd .. ln -s vendor src export GOPATH=$(pwd)/_build:$(pwd) %gobuild -o bin/dnsname %{import_path_plugins}/plugins/meta/dnsname -popd +cd .. -pushd %{repo_gvproxy}-%{commit_gvproxy} +cd %{repo_gvproxy}-%{commit_gvproxy} mkdir _build -pushd _build +cd _build mkdir -p src/%{provider}.%{provider_tld}/%{project} ln -s ../../../../ src/%{import_path_gvproxy} -popd +cd .. ln -s vendor src export GOPATH=$(pwd)/_build:$(pwd) %gobuild -o bin/gvproxy %{import_path_gvproxy}/cmd/gvproxy -popd +cd .. %{__make} docs docker-docs @@ -313,15 +336,15 @@ PODMAN_VERSION=%{version} %{__make} PREFIX=%{buildroot}%{_prefix} ETCDIR=%{build mv pkg/hooks/README.md pkg/hooks/README-hooks.md # install dnsname plugin -pushd %{repo_plugins}-%{commit_plugins} +cd %{repo_plugins}-%{commit_plugins} %{__make} PREFIX=%{_prefix} DESTDIR=%{buildroot} install -popd +cd .. # install gvproxy -pushd %{repo_gvproxy}-%{commit_gvproxy} +cd %{repo_gvproxy}-%{commit_gvproxy} install -dp %{buildroot}%{_libexecdir}/%{name} install -p -m0755 bin/gvproxy %{buildroot}%{_libexecdir}/%{name} -popd +cd .. # do not include docker and podman-remote man pages in main package for file in `find %{buildroot}%{_mandir}/man[15] -type f | sed "s,%{buildroot},," | grep -v -e remote -e docker`; do