moby-engine/moby-engine.spec
Bradley G Smith 368edbfc95
Update to release v29.1.4
- Resolves: rhbz#2428234
- Upstream fixes
2026-01-09 09:17:36 -08:00

391 lines
11 KiB
RPMSpec

# This specfile is licensed under:
# SPDX-FileCopyrightText: Fedora Project Authors
# SPDX-FileCopyrightText: 2024 Maxwell G <maxwell@gtmx.me>
# SPDX-License-Identifier: MIT
# License Text: https://spdx.org/licenses/MIT.html
# Generated by go2rpm 1.11.0
%bcond_without check
# https://github.com/moby/moby
%global goipath0 github.com/moby/moby
# For rc, beta, alpha releases substitute tilde (~) for dash (-)
# in version0. tag0 reverses the substitution
# e.g. global version0 27.4.0~rc.4
%global version0 29.1.4
%{lua:
local version0 = rpm.expand("%{version0}"):gsub("~", "-")
rpm.define("tag0 " .. "docker-v" .. version0)
rpm.define("distprefix0 %{nil}")
rpm.define("tag2 " .. "v" .. version0)
}
# https://github.com/docker/cli
%global goipath2 github.com/docker/cli
%global version2 %{version0}
%gometa -L -a -f
%global engine_dir ../%{topdir0}
%global cli_dir ../%{topdir2}
%global common_description %{expand:
Docker is an open source project to build, ship and run any application as a
lightweight container.
Docker containers are both hardware-agnostic and platform-agnostic. This means
they can run anywhere, from your laptop to the largest EC2 compute instance and
everything in between and they do not require you to use a particular
language, framework or packaging system. That makes them great building blocks
for deploying and scaling web apps, databases, and backend services without
depending on a particular stack or provider.
}
Name: moby-engine
Version: %{version0}
Release: %autorelease
Summary: The open-source application container engine
# Generated with go-vendor-tools
License: Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND ISC AND MIT AND MPL-2.0 AND (Apache-2.0 OR GPL-2.0-or-later)
URL: %{gourl}
# We create our own vendor tarballs instead of using the built-in directoies.
# This allows us to include the manpage build dependencies for docker-cli
# and make any of our own changes to the deps included as necessary.
Source0: %{gosource0}
Source1: %{archivename0}-vendor.tar.bz2
Source2: %{gosource2}
Source3: %{archivename2}-vendor.tar.bz2
Source100: moby-engine-systemd-sysusers.conf
Source101: macros.moby
Source102: LICENSE.macros
Source200: engine_go-vendor-tools.toml
Source201: cli_go-vendor-tools.toml
# Patches 0-999 are for moby/moby
Patch0: 0001-systemd-adjust-docker.service-for-downstream.patch
# Patches 1000+ are for docker/cli
# Patch1000:
BuildRequires: git-core
BuildRequires: go-vendor-tools
BuildRequires: make
BuildRequires: pkg-config
BuildRequires: systemd-devel
BuildRequires: /usr/bin/go-md2man
BuildRequires: nftables-devel
# docker.service depends on containerd
Requires: containerd
# The docker CLI is provided as a separate package
Requires: docker-cli = %{version}-%{release}
# moby-filesystem owns the libexecdir/docker directory
Requires: moby-filesystem = %{version}-%{release}
# tini-static is used as the docker-init binary
Requires: tini-static
# Other runtime packages (sorted)
Requires: container-selinux
Requires: iptables
Requires: libseccomp
Requires: nftables
Requires: pigz
Requires: systemd
Requires: tar
Requires: xz
# Provide docker name to help users who "dnf install docker"
Provides: docker = %{version}-%{release}
# Conflict with upstream packages
Conflicts: docker-ce
Conflicts: docker-ee
%description %{common_description}
%package nano
Summary: GNU nano syntax highlighting files for Moby
BuildArch: noarch
Requires: nano
Supplements: moby-engine
%description nano %{common_description}
This package installs %{summary}.
# We name this package docker-cli, as that's the name of the upstream project.
# moby-engine is github.com/moby/moby.
%package -n docker-cli
Version: %{forgeversion -z1}
Summary: The Docker CLI
# Generated with go-vendor-tools
%global cli_license Apache-2.0 AND BSD-2-Clause AND BSD-3-Clause AND MIT
License: %{cli_license}
Requires: moby-filesystem = %{version}-%{release}
# Recommend main moby-engine package with the docker daemon
# We don't use a strict dependency, as it's possible to use the docker CLI with
# a different host.
Recommends: moby-engine
# docker buildx is the new supported way to run builds; docker build is deprecated.
Recommends: docker-buildx
# Conflict with older moby-engine versions
Conflicts: moby-engine < %{version}-%{release}
Conflicts: moby-engine > %{version}-%{release}
# Conflict with upstream packages
Conflicts: docker-ce-cli
Conflicts: docker-ee-cli
# Conflict with podman-docker that also contains /usr/bin/docker
Conflicts: podman-docker
# Obsolete old separate shell completions packages
Obsoletes: moby-engine-fish-completion < 24.0.5-6
Obsoletes: moby-engine-zsh-completion < 24.0.5-6
%description -n docker-cli %{common_description}
This package provides the Docker CLI.
%package -n moby-filesystem
Summary: Filesystem package for the Moby/Docker stack
License: LicenseRef-Not-Copyrightable
BuildArch: noarch
%description -n moby-filesystem %{common_description}
This is the filesystem subpackage for the Moby/Docker stack.
%package -n moby-rpm-macros
Summary: RPM Macros for the Moby/Docker stack
License: MIT
BuildArch: noarch
%description -n moby-rpm-macros %{common_description}
This package provides RPM macros for the Moby/Docker stack.
%prep
%goprep -a -A
# moby-engine
cd %{_builddir}/%{extractdir0}
# Unpack vendor archive
tar -xf %{S:1}
# Apply patches 0-1000
# Leave this here despite warnings so we can easily add and remove patches.
%autopatch -M999 -p1
cp -p %{S:100} %{S:101} %{S:102} .
# docker-cli
cd %{cli_dir}
# Unpack vendor archive
tar -xf %{S:3}
# Apply patches 1000+.
# Leave this here despite warnings so we can easily add and remove patches.
%autopatch -m1000 -p1
# See comment in go-vendor-tools.toml
rm -f man/go.mod
%generate_buildrequires
# moby-engine
%go_vendor_license_buildrequires -c %{S:200}
# docker-cli
%go_vendor_license_buildrequires -c %{S:201}
%build
export GO_LDFLAGS="" GO_BUILDTAGS="" CGO_ENABLED=1
%global gomodulesmode GO111MODULE=on
# moby-engine
cd %{engine_dir}
# DOCKER_DEBUG: Ensure that all debuginfo is preserved
BUILDFLAGS="%{gocompilerflags} -a -v" \
CGO_CFLAGS="%{build_cflags}" \
CGO_LDFLAGS="%{build_ldflags}" \
DOCKER_BUILDTAGS="rpm_crashback journald" \
DOCKER_GITCOMMIT=%{release} \
DOCKER_DEBUG=1 \
DOCKER_LDFLAGS=%{gobuild_ldflags_shescaped} \
LDFLAGS=%{gobuild_ldflags_shescaped} \
VERSION=%{version} \
GOPATH=%{gobuilddir} \
bash -x ./hack/make.sh dynbinary
# build man pages using Makefile in man subdirectory
pushd man
GO_MD2MAN=go-md2man %make_build all
popd
# docker-cli
cd %{cli_dir}
%make_build dynbinary \
DISABLE_WARN_OUTSIDE_CONTAINER=1 \
GITCOMMIT=%{release} \
GO_BUILDTAGS="rpm_crashback" \
GO_LDFLAGS=%{gobuild_ldflags_shescaped} \
VERSION=%{version} \
dynbinary manpages
%install
# moby-engine
cd %{engine_dir}
# Install licenses
%go_vendor_license_install -c %{S:200}
# Install binaries
install -Dpm 0755 bundles/dynbinary*/* -t %{buildroot}%{_bindir}
# Install systemd configuration
install -Dpm 0644 contrib/init/systemd/* -t %{buildroot}%{_unitdir}
# Install sysusers config
install -Dpm 0644 moby-engine-systemd-sysusers.conf %{buildroot}%{_sysusersdir}/moby-engine.conf
install -Dpm 644 man/man8/*.8 -t %{buildroot}%{_mandir}/man8/
# docker-cli
cd %{cli_dir}
# Install licenses
%go_vendor_license_install -c %{S:201}
# Install docker-cli
install -Dpm 0755 build/docker -t %{buildroot}%{_bindir}
# Install shell completions
install -Dpm 644 contrib/completion/bash/docker -t %{buildroot}%{bash_completions_dir}
install -Dpm 644 contrib/completion/zsh/_docker -t %{buildroot}%{zsh_completions_dir}
install -Dpm 644 contrib/completion/fish/docker.fish -t %{buildroot}%{fish_completions_dir}
# Install manpages
install -Dpm 644 man/man1/*.1 -t %{buildroot}%{_mandir}/man1/
install -Dpm 644 man/man5/*.5 -t %{buildroot}%{_mandir}/man5/
cd -
# moby-filesystem
mkdir -p %{buildroot}%{_libexecdir}/docker
mkdir %{buildroot}%{_libexecdir}/docker/cli-plugins
# moby-rpm-macros
install -Dpm 0644 macros.moby -t %{buildroot}%{_rpmmacrodir}
%check
export PATH="%{buildroot}%{_bindir}:${PATH}" TZ=utc
# moby-engine
cd %{engine_dir}
%go_vendor_license_check -c %{S:200}
# docker-cli
cd %{cli_dir}
%go_vendor_license_check -c %{S:201} %{cli_license}
%if %{with check}
# moby-engine
cd %{engine_dir}
# Manually skip specific tests
%global engine_ignores %{shrink:
%dnl assertion failed
-s "TestC8dSnapshotterWithUsernsRemap"
-s "TestSCTP4Proxy"
%dnl flaky test will fail on x86_64 - sometimes
-s "TestSCTP6Proxy"
%dnl Failed to enter netns: operation not permitted
%dnl -s "TestSCTP4ProxyNoListener"
%dnl -s "TestSCTP6ProxyNoListener"
%dnl possibly flaky test failing on ppc64le
%[ "%{_arch}" == "ppc64le" ? "-s TestSCTP6ProxyNoListener" : "" ]
%dnl network_proxy_linux_test.go:73: protocol not supported; fails in COPR rawhide
-s "TestIfaceAddrs"
%dnl failed to mount resolved path: operation not permitted
-s "TestJoinGoodSymlink"
-s "TestJoinWithSymlinkReplace"
-s "TestJoinCloseInvalidates"
%dnl Test timeout
-s "TestImageLoad"
%dnl doesn't provide the requested platform
-s "TestContentStoreForPull"
-s "TestManifestStore"
%dnl all with error is not nil: create tmp file
%[ "%{_arch}" == "s390x" ? "-s TestCloseRunningCommand" : "" ]
%dnl graphdriver tests require extra permissions
-t daemon/graphdriver
%dnl integration tests require a running docker daemon
-t integration
%dnl libnetwork tests cannot create netns in mock
-t daemon/libnetwork
%dnl integration-cli: we don't want to run integration tests or benchmarks
-d integration-cli
}
%gocheck2 -F %{engine_ignores}
# docker-cli
cd %{cli_dir}
%global cli_ignores %{shrink:
-s "TestInitializeFromClientHangs"
%dnl Needs network
-s "TestRunBuildFromGitHubSpecialCase"
%dnl Test is flaky
-s "TestConnectAndWait"
%dnl Test panics
-s "TestRunAttachTermination"
-s "TestRunPullTermination"
-s "TestUpgradePromptTermination"
}
%gocheck2 -F -t e2e %{cli_ignores}
%endif
%post
%systemd_post docker.service docker.socket
%preun
%systemd_preun docker.service docker.socket
%postun
%systemd_postun_with_restart docker.service
%files -f %{engine_dir}/%{go_vendor_license_filelist}
%license %{engine_dir}/vendor/modules.txt
%doc %{engine_dir}/README.md
%{_bindir}/docker-proxy
%{_bindir}/dockerd
%{_sysusersdir}/moby-engine.conf
%{_unitdir}/docker.service
%{_unitdir}/docker.socket
%{_mandir}/man8/dockerd.8*
%files nano
%license %{engine_dir}/AUTHORS
%license %{engine_dir}/LICENSE
%license %{engine_dir}/NOTICE
%files -n docker-cli -f %{cli_dir}/%{go_vendor_license_filelist}
%license %{cli_dir}/vendor/modules.txt
%doc %{cli_dir}/README.md
%{_bindir}/docker
%{_mandir}/man1/docker*.1*
%{_mandir}/man5/{Dockerfile,docker-config-json}.5*
%{bash_completions_dir}/docker
%{fish_completions_dir}/docker.fish
%{zsh_completions_dir}/_docker
%files -n moby-filesystem
%dir %{_libexecdir}/docker
%dir %{_libexecdir}/docker/cli-plugins
%files -n moby-rpm-macros
%license %{engine_dir}/LICENSE.macros
%{_rpmmacrodir}/macros.moby
%changelog
%autochangelog