# This specfile is licensed under: # SPDX-FileCopyrightText: Fedora Project Authors # SPDX-FileCopyrightText: 2024 Maxwell G # 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 goipath github.com/docker/docker %global forgeurl https://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 28.3.0~rc.2 %global tag0 v%{gsub %{version0} ~ -} # https://github.com/docker/cli %global goipath2 github.com/docker/cli %global version2 %{version0} %global tag2 %{tag0} %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: %{forgeversion} 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 # 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: 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 %__rpmuncompress -x %{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} . # See comment in go-vendor-tools.toml cp go.mod vendor.mod cp go.sum vendor.sum # docker-cli cd %{cli_dir} # Unpack vendor archive %__rpmuncompress -x %{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 cp go.mod vendor.mod cp go.sum vendor.sum 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 GO_LDFLAGS="" GO_BUILDTAGS="" export CGO_ENABLED=1 # moby-engine cd %{engine_dir} # DOCKER_DEBUG: Ensure that all debuginfo is preserved BUILDFLAGS="%{gocompilerflags} -a -v -x" \ 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 udev rules install -Dpm 0644 contrib/udev/80-docker.rules -t %{buildroot}%{_udevrulesdir} # Install nano syntax install -Dpm 644 contrib/syntax/nano/Dockerfile.nanorc -t %{buildroot}%{_datadir}/nano/ 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 skiptest() { for test in "$@"; do awk -i inplace '/^func.*'"${test}"'\(/ { print; print "\tt.Skip(\"disabled failing test\")"; next}1' \ $(grep -rl "${test}") done } 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 skiptest \ "TestSCTP4Proxy" \ %dnl Failed to enter netns: operation not permitted %dnl "TestSCTP4ProxyNoListener" %dnl "TestSCTP6ProxyNoListener" %dnl network_proxy_linux_test.go:73: protocol not supported; fails in COPR rawhide "TestIfaceAddrs" \ %dnl failed to mount resolved path: operation not permitted "TestJoinGoodSymlink" \ "TestJoinWithSymlinkReplace" \ "TestJoinCloseInvalidates" \ %ifarch s390x %dnl Test timeout "TestCloseRunningCommand" \ %endif # graphdriver tests require extra permissions # integration tests require a running docker daemon # libnetwork tests cannot create netns in mock # pkg/archive do not work in mock, either # daemon/graphdriver/fuse-overlayfs tests fail with permission errors %gocheck -t daemon/graphdriver -t integration -t libnetwork -d pkg/archive # docker-cli cd %{cli_dir} skiptest \ "TestInitializeFromClientHangs" \ %dnl Needs network "TestRunBuildFromGitHubSpecialCase" \ %dnl Test is flaky "TestConnectAndWait" \ %dnl Test panics "TestRunAttachTermination" \ "TestRunPullTermination" \ "TestUpgradePromptTermination" %dnl Unknown test failure %gocheck -z2 -t e2e %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 %{_udevrulesdir}/80-docker.rules %{_unitdir}/docker.service %{_unitdir}/docker.socket %{_mandir}/man8/dockerd.8* %files nano %license %{engine_dir}/AUTHORS %license %{engine_dir}/LICENSE %license %{engine_dir}/NOTICE %{_datadir}/nano/Dockerfile.nanorc %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