remove debbuild macros to comply with Fedora guidelines

Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>
This commit is contained in:
Lokesh Mandvekar 2022-10-06 09:53:48 -04:00
parent 0748b12435
commit 6dd08dba8a

View File

@ -1,7 +1,3 @@
%if "%{_vendor}" == "debbuild"
%define gobuild(o:) GO111MODULE=off go build -buildmode pie -tags=" ${BUILDTAGS:-}" -a -v -x %{?**};
%endif
%global with_debug 1 %global with_debug 1
%if 0%{?with_debug} %if 0%{?with_debug}
@ -19,36 +15,19 @@
%global import_path %{provider}.%{provider_tld}/%{project}/%{repo} %global import_path %{provider}.%{provider_tld}/%{project}/%{repo}
%global git0 https://%{import_path} %global git0 https://%{import_path}
%global built_tag_strip 1.28.0 %global built_tag v1.28.0
%global built_tag_strip %(b=%{built_tag}; echo ${b:1})
%global gen_version %(b=%{built_tag_strip}; echo ${b/-/"~"})
Name: %{repo} Name: %{repo}
Version: 1.28.0 Version: %{gen_version}
%if "%{_vendor}" == "debbuild"
Packager: Podman Debbuild Maintainers <https://github.com/orgs/containers/teams/podman-debbuild-maintainers>
License: ASL-2.0+
Release: 0%{?dist}
%else
License: ASL 2.0 and BSD and MIT and MPLv2.0 License: ASL 2.0 and BSD and MIT and MPLv2.0
Release: %autorelease Release: %autorelease
%endif
Summary: A command line tool used for creating OCI Images Summary: A command line tool used for creating OCI Images
URL: https://%{name}.io URL: https://%{name}.io
Source: %{git0}/archive/v%{built_tag_strip}.tar.gz # Tarball fetched from upstream
Source: %{git0}/archive/%{built_tag}.tar.gz
BuildRequires: go-md2man BuildRequires: go-md2man
%if "%{_vendor}" == "debbuild"
BuildRequires: git
BuildRequires: golang
BuildRequires: libassuan-dev
BuildRequires: libbtrfs-dev
BuildRequires: libdevmapper-dev
BuildRequires: libglib2.0-dev
BuildRequires: libgpg-error-dev
BuildRequires: libgpgme-dev
BuildRequires: libseccomp-dev
BuildRequires: libsystemd-dev
BuildRequires: pkg-config
Requires: containers-common >= 4:1
%else
BuildRequires: device-mapper-devel BuildRequires: device-mapper-devel
BuildRequires: git-core BuildRequires: git-core
BuildRequires: golang >= 1.16.6 BuildRequires: golang >= 1.16.6
@ -103,7 +82,6 @@ Provides: bundled(golang(github.com/spf13/cobra)) = v1.3.0
Provides: bundled(golang(github.com/spf13/pflag)) = v1.0.5 Provides: bundled(golang(github.com/spf13/pflag)) = v1.0.5
Provides: bundled(golang(github.com/stretchr/testify)) = v1.7.0 Provides: bundled(golang(github.com/stretchr/testify)) = v1.7.0
Provides: bundled(golang(github.com/syndtr/gocapability)) = v0.0.0_20200815063812_42c35b437635 Provides: bundled(golang(github.com/syndtr/gocapability)) = v0.0.0_20200815063812_42c35b437635
%endif
%description %description
The %{name} package provides a command line tool which can be used to The %{name} package provides a command line tool which can be used to
@ -134,10 +112,9 @@ Requires: git-daemon
This package contains system tests for %{name} This package contains system tests for %{name}
%prep %prep
%autosetup -Sgit %autosetup -Sgit -n %{name}-%{built_tag_strip}
%build %build
%if "%{_vendor}" != "debbuild"
%set_build_flags %set_build_flags
# These extra flags present in $CFLAGS have been skipped for now as they break the build # 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') CGO_CFLAGS=$(echo $CGO_CFLAGS | sed 's/-flto=auto//g')
@ -147,7 +124,6 @@ CGO_CFLAGS=$(echo $CGO_CFLAGS | sed 's/-specs=\/usr\/lib\/rpm\/redhat\/redhat-an
%ifarch x86_64 %ifarch x86_64
export CGO_CFLAGS+=" -m64 -mtune=generic -fcf-protection=full" export CGO_CFLAGS+=" -m64 -mtune=generic -fcf-protection=full"
%endif %endif
%endif
export GOPATH=$(pwd)/_build:$(pwd) export GOPATH=$(pwd)/_build:$(pwd)
export CGO_CFLAGS=$CFLAGS export CGO_CFLAGS=$CFLAGS
@ -164,9 +140,7 @@ export CNI_VERSION=`grep '^# github.com/containernetworking/cni ' src/modules.tx
export LDFLAGS="-X main.buildInfo=`date +%s` -X main.cniVersion=${CNI_VERSION}" export LDFLAGS="-X main.buildInfo=`date +%s` -X main.cniVersion=${CNI_VERSION}"
export BUILDTAGS='seccomp exclude_graphdriver_devicemapper' export BUILDTAGS='seccomp exclude_graphdriver_devicemapper'
%if "%{_vendor}" != "debbuild"
export BUILDTAGS+=' libsubid selinux' export BUILDTAGS+=' libsubid selinux'
%endif
%gobuild -o bin/%{name} %{import_path}/cmd/%{name} %gobuild -o bin/%{name} %{import_path}/cmd/%{name}
%gobuild -o bin/imgtype %{import_path}/tests/imgtype %gobuild -o bin/imgtype %{import_path}/tests/imgtype
%gobuild -o bin/copy %{import_path}/tests/copy %gobuild -o bin/copy %{import_path}/tests/copy
@ -175,16 +149,8 @@ GOMD2MAN=go-md2man %{__make} -C docs
%install %install
export GOPATH=$(pwd)/_build:$(pwd) export GOPATH=$(pwd)/_build:$(pwd)
%if "%{_vendor}" != "debbuild"
make DESTDIR=%{buildroot} PREFIX=%{_prefix} install install.completions make DESTDIR=%{buildroot} PREFIX=%{_prefix} install install.completions
make DESTDIR=%{buildroot} PREFIX=%{_prefix} -C docs install make DESTDIR=%{buildroot} PREFIX=%{_prefix} -C docs install
%else
install -D -m0755 bin/%{name} %{buildroot}%{_bindir}/%{name}
install -m 644 -D contrib/completions/bash/%{name} %{buildroot}%{_datadir}/bash-completion/completions/%{name}
install -d %{buildroot}/%{_mandir}/man1
install -m 0644 docs/%{name}*.1 %{buildroot}%{_mandir}/man1
install -m 0644 docs/links/%{name}*.1 %{buildroot}%{_mandir}/man1
%endif
install -d -p %{buildroot}/%{_datadir}/%{name}/test/system install -d -p %{buildroot}/%{_datadir}/%{name}/test/system
cp -pav tests/. %{buildroot}/%{_datadir}/%{name}/test/system cp -pav tests/. %{buildroot}/%{_datadir}/%{name}/test/system
@ -212,6 +178,4 @@ cp bin/tutorial %{buildroot}/%{_bindir}/%{name}-tutorial
%{_datadir}/%{name}/test %{_datadir}/%{name}/test
%changelog %changelog
%if "%{_vendor}" != "debbuild"
%autochangelog %autochangelog
%endif