diff options
author | Lokesh Mandvekar <lsm5@fedoraproject.org> | 2022-01-14 13:34:16 -0500 |
---|---|---|
committer | Lokesh Mandvekar <lsm5@fedoraproject.org> | 2022-01-14 15:36:34 -0500 |
commit | 350765e79069ec09b115a1bd50544063ade61bef (patch) | |
tree | 5a3ce38c864745e2d81eeae5a6ba937cad01a43b /podman.spec.rpkg | |
parent | ecf818a1cddd5e3e62b4a2a761d44b2be336317e (diff) | |
download | podman-350765e79069ec09b115a1bd50544063ade61bef.tar.gz podman-350765e79069ec09b115a1bd50544063ade61bef.tar.bz2 podman-350765e79069ec09b115a1bd50544063ade61bef.zip |
Add rpkg template for COPR autobuild
This commit removes .autocopr/podman.spec in favor of
podman.spec.rpkg to account for new recommendations for COPR builds.
The build process now enables debug packages and also uses
`%gobuild` instead of `make` or `go build` to
get the packages as close as possible to Fedora koji builds.
https://lists.fedoraproject.org/archives/list/copr-devel@lists.fedorahosted.org/message/3JORYRKDWFMJSR35Z4LIKDEXH2T5263H/
[NO NEW TESTS NEEDED]
Signed-off-by: Lokesh Mandvekar <lsm5@fedoraproject.org>
Diffstat (limited to 'podman.spec.rpkg')
-rw-r--r-- | podman.spec.rpkg | 223 |
1 files changed, 223 insertions, 0 deletions
diff --git a/podman.spec.rpkg b/podman.spec.rpkg new file mode 100644 index 000000000..cff5eb3d9 --- /dev/null +++ b/podman.spec.rpkg @@ -0,0 +1,223 @@ +# For automatic rebuilds in COPR + +# The following tag is to get correct syntax highlighting for this file in vim text editor +# vim: syntax=spec + +%global with_debug 1 + +%if 0%{?with_debug} +%global _find_debuginfo_dwz_opts %{nil} +%global _dwz_low_mem_die_limit 0 +%else +%global debug_package %{nil} +%endif + +%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 %{?**}; +%endif + +%global provider github +%global provider_tld com +%global project containers +%global repo %{name} +# https://github.com/containers/%%{name} +%global import_path %{provider}.%{provider_tld}/%{project}/%{repo} +%global git0 https://%{import_path} + +# git_dir_name returns repository name derived from remote Git repository URL +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 +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. +Source: {{{ git_dir_pack }}} + +# More detailed description of the package +%description +This is a hello world package. + +%package docker +Summary: Emulate Docker CLI using %{name} +BuildArch: noarch +Requires: %{name} = %{epoch}:%{version}-%{release} +Conflicts: docker +Conflicts: docker-latest +Conflicts: docker-ce +Conflicts: docker-ee +Conflicts: moby-engine + +%description docker +This package installs a script named docker that emulates the Docker CLI by +executes %{name} commands, it also creates links between all Docker CLI man +pages and %{name}. + +%package tests +Summary: Tests for %{name} +Requires: %{name} = %{epoch}:%{version}-%{release} +Requires: bats +Requires: jq +Requires: skopeo +Requires: nmap-ncat +Requires: httpd-tools +Requires: openssl +Requires: socat +Requires: buildah +Requires: gnupg + +%description tests +%{summary} + +This package contains system tests for %{name} + +%package remote +Summary: (Experimental) Remote client for managing %{name} containers + +%description remote +Remote client for managing %{name} containers. + +This experimental remote client is under heavy development. Please do not +run %{name}-remote in production. + +%{name}-remote uses the version 2 API to connect to a %{name} client to +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 +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') +CGO_CFLAGS=$(echo $CGO_CFLAGS | sed 's/-Wp,D_GLIBCXX_ASSERTIONS//g') +CGO_CFLAGS=$(echo $CGO_CFLAGS | sed 's/-specs=\/usr\/lib\/rpm\/redhat\/redhat-annobin-cc1//g') + +%ifarch x86_64 +export CGO_CFLAGS+=" -m64 -mtune=generic -fcf-protection=full" +%endif + +mkdir _build +pushd _build +mkdir -p src/%{provider}.%{provider_tld}/%{project} +ln -s ../../../../ src/%{import_path} +popd +ln -s vendor src + +# build date. FIXME: Makefile uses '/v2/libpod', that doesn't work here? +LDFLAGS="-X %{import_path}/libpod/define.buildInfo=$(date +%s)" + +# build rootlessport first +%gobuild -o bin/rootlessport %%{import_path}/cmd/rootlessport + +# build %%{name} +export BUILDTAGS="seccomp exclude_graphdriver_devicemapper $(hack/btrfs_installed_tag.sh) $(hack/btrfs_tag.sh) $(hack/libdm_tag.sh) $(hack/selinux_tag.sh) $(hack/systemd_tag.sh)" +%if 0%{?fedora} >= 35 +export BUILDTAGS+=" $(hack/libsubid_tag.sh)" +%endif + +%gobuild -o bin/%{name} %{import_path}/cmd/%{name} + +# build %%{name}-remote +export BUILDTAGS+=" exclude_graphdriver_btrfs btrfs_noversion remote" +%gobuild -o bin/%{name}-remote %{import_path}/cmd/%{name} + +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-nobuild \ + install.man-nobuild \ + install.systemd \ + install.completions \ + install.docker \ + install.docker-docs-nobuild \ + install.remote-nobuild \ + +install -d -p %{buildroot}/%{_datadir}/%{name}/test/system +cp -pav test/system %{buildroot}/%{_datadir}/%{name}/test/ + +mv pkg/hooks/README.md pkg/hooks/README-hooks.md + +# 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 + echo "$file*" >> podman.file-list +done + +# This lists all the files that are included in the rpm package and that +# are going to be installed into target system where the rpm is installed. +%files -f %{name}.file-list +%license LICENSE +%doc README.md CONTRIBUTING.md pkg/hooks/README-hooks.md install.md transfer.md +%{_bindir}/%{name} +%dir %{_libexecdir}/%{name} +%{_libexecdir}/%{name}/rootlessport +%{_datadir}/bash-completion/completions/%{name} +# By "owning" the site-functions dir, we don't need to Require zsh +%dir %{_datadir}/zsh/site-functions +%{_datadir}/zsh/site-functions/_%{name} +%dir %{_datadir}/fish/vendor_completions.d +%{_datadir}/fish/vendor_completions.d/%{name}.fish +%{_unitdir}/%{name}-auto-update.service +%{_unitdir}/%{name}-auto-update.timer +%{_unitdir}/%{name}.service +%{_unitdir}/%{name}.socket +%{_unitdir}/%{name}-restart.service +%{_userunitdir}/%{name}-auto-update.service +%{_userunitdir}/%{name}-auto-update.timer +%{_userunitdir}/%{name}.service +%{_userunitdir}/%{name}.socket +%{_userunitdir}/%{name}-restart.service +%{_usr}/lib/tmpfiles.d/%{name}.conf + +%files docker +%{_bindir}/docker +%{_mandir}/man1/docker*.1* +%{_mandir}/man5/docker*.5* +%{_usr}/lib/tmpfiles.d/%{name}-docker.conf + +%files remote +%license LICENSE +%{_bindir}/%{name}-remote +%{_mandir}/man1/%{name}-remote*.* +%{_datadir}/bash-completion/completions/%{name}-remote +%dir %{_datadir}/fish/vendor_completions.d +%{_datadir}/fish/vendor_completions.d/%{name}-remote.fish +%dir %{_datadir}/zsh/site-functions +%{_datadir}/zsh/site-functions/_%{name}-remote + +%files tests +%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 }}} |