Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI:BUILD] copr: podman.spec.rpkg cleanups #17527

Merged
merged 1 commit into from
Feb 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 13 additions & 48 deletions podman.spec.rpkg
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
%global with_debug 1

# _user_tmpfiles.d currently undefined on rhel
%if 0%{?fedora} <= 35 || 0%{?rhel}
%if 0%{?rhel}
%global _user_tmpfilesdir %{_datadir}/user-tmpfiles.d
%endif

Expand All @@ -17,38 +17,21 @@
%global debug_package %{nil}
%endif

%if ! 0%{?gobuild:1}
%define gobuild(o:) 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 %{?**};
# RHEL 8's default %%gobuild macro doesn't account for the BUILDTAGS variable, so we
# set it separately here and do not depend on RHEL 8's go-srpm-macros package.
%if !0%{?fedora} && 0%{?rhel} <= 8
%define gobuild(o:) go build -buildmode pie -compiler gc -tags="rpm_crashtraceback libtrust_openssl ${BUILDTAGS:-}" -ldflags "-linkmode=external -compressdwarf=false ${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '%__global_ldflags'" -a -v -x %{?**};
%endif

# git_dir_name returns repository name derived from remote Git repository URL
Name: {{{ git_dir_name }}}

Name: {{{ git_dir_name }}}
Epoch: 101

# git_dir_version returns version based on commit and tag history of the Git project
Version: {{{ git_dir_version }}}

# This can be useful later for adding downstream patches
Release: 1%{?dist}

# Basic description of the package
Version: {{{ git_dir_version }}}
Release: 1%{?dist}
Summary: Manage Pods, Containers and Container Images

# License. We assume GPLv2+ here.
License: ASL 2.0

# Home page of the project. Can also point to the public Git repository page.
URL: https://github.com/containers/podman

# Detailed information about the source Git repository and the source commit
# for the created rpm package
VCS: {{{ git_dir_vcs }}}

# git_dir_pack macro places the repository content (the source files) into a tarball
# and returns its filename. The tarball will be used to build the rpm.
License: Apache-2.0
URL: https://github.com/containers/podman
VCS: {{{ git_dir_vcs }}}
Source: {{{ git_dir_pack }}}

%if 0%{?fedora} && ! 0%{?rhel}
BuildRequires: btrfs-progs-devel
%endif
Expand Down Expand Up @@ -89,7 +72,6 @@ Provides: %{name}-quadlet
Obsoletes: %{name}-quadlet <= 101:0.0.git.17877.f247b4d4-1
Provides: %{name}-quadlet = %{epoch}:%{version}-%{release}

# More detailed description of the package
%description
%{name} (Pod Manager) is a fully featured container engine that is a simple
daemonless tool. %{name} provides a Docker-CLI comparable command line that
Expand Down Expand Up @@ -145,12 +127,9 @@ Remote client for managing %{name} containers.
manage pods, containers and container images. %{name}-remote supports ssh
connections as well.

# The following four sections already describe the rpm build process itself.
# prep will extract the tarball defined as Source above and descend into it.
%prep
{{{ git_dir_setup_macro }}}

# This will invoke `make` command in the directory with the extracted sources.
%build
%set_build_flags
%global gomodulesmode GO111MODULE=on
Expand All @@ -164,10 +143,6 @@ CGO_CFLAGS=$(echo $CGO_CFLAGS | sed 's/-specs=\/usr\/lib\/rpm\/redhat\/redhat-an
export CGO_CFLAGS+=" -m64 -mtune=generic -fcf-protection=full"
%endif

%if 0%{?rhel}
rm -rf vendor/github.com/containers/storage/drivers/register/register_btrfs.go
%endif

# build date. FIXME: Makefile uses '/v2/libpod', that doesn't work here?
LDFLAGS="-X ./libpod/define.buildInfo=$(date +%s)"

Expand All @@ -191,8 +166,6 @@ export BUILDTAGS="$BASEBUILDTAGS $(hack/btrfs_installed_tag.sh) $(hack/btrfs_tag

make docs docker-docs

# This will copy the files generated by the `make` command above into
# the installable rpm package.
%install
PODMAN_VERSION=%{version} %{__make} DESTDIR=%{buildroot} PREFIX=%{_prefix} ETCDIR=%{buildroot}%{_sysconfdir} \
install.bin \
Expand All @@ -202,16 +175,14 @@ PODMAN_VERSION=%{version} %{__make} DESTDIR=%{buildroot} PREFIX=%{_prefix} ETCDI
install.docker \
install.docker-docs \
install.remote \
%if 0%{?fedora} >= 36
install.modules-load
%endif

install -d -p %{buildroot}/%{_datadir}/%{name}/test/system
cp -pav test/system %{buildroot}/%{_datadir}/%{name}/test/

# do not include docker and podman-remote man pages in main package
# do not include docker and %%{name}-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
echo "$file*" >> podman.file-list
echo "$file*" >> %{name}.file-list
done

%post
Expand Down Expand Up @@ -257,11 +228,7 @@ fi
%{_userunitdir}/%{name}[email protected]
%{_tmpfilesdir}/%{name}.conf
%{_user_tmpfilesdir}/%{name}-docker.conf
%{_mandir}/man5/quadlet*.5*
%{_mandir}/man5/podman-systemd.unit*.5*
%if 0%{?fedora} >= 36
%{_modulesloaddir}/%{name}-iptables.conf
%endif

%files docker
%{_bindir}/docker
Expand All @@ -283,7 +250,5 @@ fi
%license LICENSE
%{_datadir}/%{name}/test

# Finally, changes from the latest release of your application are generated from
# your project's Git history. It will be empty until you make first annotated Git tag.
%changelog
{{{ git_dir_changelog }}}