From 5d9ac472453df9a8b5855e0c444441c450685a58 Mon Sep 17 00:00:00 2001 From: eabdullin Date: Wed, 15 Jun 2022 11:29:49 +0300 Subject: [PATCH 1/2] - Added requires to golang - Add fedora define Signed-off-by: eabdullin --- rpm/SPECS/docker-ce-cli.spec | 16 +++++++++++---- rpm/SPECS/docker-ce-rootless-extras.spec | 17 ++++++++++------ rpm/SPECS/docker-ce.spec | 25 +++++++++++++++--------- rpm/SPECS/docker-compose-plugin.spec | 3 +++ rpm/SPECS/docker-scan-plugin.spec | 3 +++ rpm/fedora-34/Dockerfile | 6 +++--- rpm/fedora-35/Dockerfile | 6 +++--- rpm/fedora-36/Dockerfile | 6 +++--- 8 files changed, 54 insertions(+), 28 deletions(-) diff --git a/rpm/SPECS/docker-ce-cli.spec b/rpm/SPECS/docker-ce-cli.spec index a6c989e609..458f4f85ea 100644 --- a/rpm/SPECS/docker-ce-cli.spec +++ b/rpm/SPECS/docker-ce-cli.spec @@ -44,6 +44,9 @@ Recommends: docker-scan-plugin(x86-64) BuildRequires: make BuildRequires: libtool-ltdl-devel BuildRequires: git +%if 0%{?fedora} > 35 || 0%{?rhel} > 7 +BuildRequires: golang +%endif # conflicting packages Conflicts: docker @@ -67,10 +70,15 @@ depending on a particular stack or provider. %setup -q -c -n src -a 0 %build -mkdir -p /go/src/github.com/docker -rm -f /go/src/github.com/docker/cli -ln -snf ${RPM_BUILD_DIR}/src/cli /go/src/github.com/docker/cli -pushd /go/src/github.com/docker/cli +go env -w GO111MODULE=off +export PREFIX=${RPM_BUILD_DIR} +export TMP_GOPATH="${RPM_BUILD_DIR}/go" +export GOPATH="${RPM_BUILD_DIR}/go" + +mkdir -p ${RPM_BUILD_DIR}/go/src/github.com/docker +rm -f ${RPM_BUILD_DIR}/go/src/github.com/docker/cli +ln -snf ${RPM_BUILD_DIR}/src/cli ${RPM_BUILD_DIR}/go/src/github.com/docker/cli +pushd ${RPM_BUILD_DIR}/go/src/github.com/docker/cli VERSION=%{_origversion} GITCOMMIT=%{_gitcommit_cli} GO_LINKMODE=dynamic ./scripts/build/binary && DISABLE_WARN_OUTSIDE_CONTAINER=1 make manpages # cli popd diff --git a/rpm/SPECS/docker-ce-rootless-extras.spec b/rpm/SPECS/docker-ce-rootless-extras.spec index b29c66745a..0fc4d10b0f 100644 --- a/rpm/SPECS/docker-ce-rootless-extras.spec +++ b/rpm/SPECS/docker-ce-rootless-extras.spec @@ -20,6 +20,9 @@ Requires: slirp4netns >= 0.4 Requires: fuse-overlayfs >= 0.7 BuildRequires: bash +%if 0%{?fedora} > 35 || 0%{?rhel} > 7 +BuildRequires: golang +%endi # conflicting packages Conflicts: rootlesskit @@ -35,20 +38,22 @@ Either VPNKit or slirp4netns (>= 0.4.0) needs to be installed separately. %setup -q -c -n src -a 0 %build +export TMP_GOPATH="${RPM_BUILD_DIR}/go" +export PREFIX="${RPM_BUILD_DIR}/go" export DOCKER_GITCOMMIT=%{_gitcommit_engine} -mkdir -p /go/src/github.com/docker -ln -snf ${RPM_BUILD_DIR}/src/engine /go/src/github.com/docker/docker -TMP_GOPATH="/go" ${RPM_BUILD_DIR}/src/engine/hack/dockerfile/install/install.sh rootlesskit dynamic +mkdir -p ${RPM_BUILD_DIR}/go/src/github.com/docker +ln -snf ${RPM_BUILD_DIR}/src/engine ${RPM_BUILD_DIR}/go/src/github.com/docker/docker +TMP_GOPATH="${RPM_BUILD_DIR}/go" ${RPM_BUILD_DIR}/src/engine/hack/dockerfile/install/install.sh rootlesskit dynamic %check -/usr/local/bin/rootlesskit -v +${RPM_BUILD_ROOT}%{_bindir}/rootlesskit -v %install install -D -p -m 0755 engine/contrib/dockerd-rootless.sh ${RPM_BUILD_ROOT}%{_bindir}/dockerd-rootless.sh install -D -p -m 0755 engine/contrib/dockerd-rootless-setuptool.sh ${RPM_BUILD_ROOT}%{_bindir}/dockerd-rootless-setuptool.sh -install -D -p -m 0755 /usr/local/bin/rootlesskit ${RPM_BUILD_ROOT}%{_bindir}/rootlesskit -install -D -p -m 0755 /usr/local/bin/rootlesskit-docker-proxy ${RPM_BUILD_ROOT}%{_bindir}/rootlesskit-docker-proxy +install -D -p -m 0755 ${RPM_BUILD_DIR}/go/rootlesskit ${RPM_BUILD_ROOT}%{_bindir}/rootlesskit +install -D -p -m 0755 ${RPM_BUILD_DIR}/go/rootlesskit-docker-proxy ${RPM_BUILD_ROOT}%{_bindir}/rootlesskit-docker-proxy %files %{_bindir}/dockerd-rootless.sh diff --git a/rpm/SPECS/docker-ce.spec b/rpm/SPECS/docker-ce.spec index 6352f7b1bb..7aeb611d69 100644 --- a/rpm/SPECS/docker-ce.spec +++ b/rpm/SPECS/docker-ce.spec @@ -52,6 +52,9 @@ BuildRequires: selinux-policy-devel BuildRequires: systemd-devel BuildRequires: tar BuildRequires: which +%if 0%{?fedora} > 35 || 0%{?rhel} > 7 +BuildRequires: golang +%endi # conflicting packages Conflicts: docker @@ -81,26 +84,30 @@ depending on a particular stack or provider. %build export DOCKER_GITCOMMIT=%{_gitcommit_engine} -mkdir -p /go/src/github.com/docker -ln -snf ${RPM_BUILD_DIR}/src/engine /go/src/github.com/docker/docker +go env -w GO111MODULE=off +export PREFIX=${RPM_BUILD_DIR} +export AUTO_GOPATH=1 + +mkdir -p ${RPM_BUILD_DIR}/go/src/github.com/docker +ln -snf ${RPM_BUILD_DIR}/src/engine ${RPM_BUILD_DIR}/go/src/github.com/docker/docker pushd ${RPM_BUILD_DIR}/src/engine -TMP_GOPATH="/go" hack/dockerfile/install/install.sh tini +TMP_GOPATH="${RPM_BUILD_DIR}/go" hack/dockerfile/install/install.sh tini VERSION=%{_origversion} PRODUCT=docker hack/make.sh dynbinary popd %check -ver="$(engine/bundles/dynbinary-daemon/dockerd --version)"; \ +ver="$(${RPM_BUILD_DIR}/bundles/dynbinary-daemon/dockerd --version)"; \ test "$ver" = "Docker version %{_origversion}, build %{_gitcommit_engine}" && echo "PASS: daemon version OK" || (echo "FAIL: daemon version ($ver) did not match" && exit 1) %install -install -D -p -m 0755 $(readlink -f engine/bundles/dynbinary-daemon/dockerd) ${RPM_BUILD_ROOT}%{_bindir}/dockerd -install -D -p -m 0755 $(readlink -f engine/bundles/dynbinary-daemon/docker-proxy) ${RPM_BUILD_ROOT}%{_bindir}/docker-proxy -install -D -p -m 0755 /usr/local/bin/docker-init ${RPM_BUILD_ROOT}%{_bindir}/docker-init +install -D -p -m 0755 $(readlink -f ${RPM_BUILD_DIR}/bundles/dynbinary-daemon/dockerd) ${RPM_BUILD_ROOT}%{_bindir}/dockerd +install -D -p -m 0755 $(readlink -f ${RPM_BUILD_DIR}/bundles/dynbinary-daemon/docker-proxy) ${RPM_BUILD_ROOT}%{_bindir}/docker-proxy +install -D -p -m 0755 ${RPM_BUILD_DIR}/docker-init ${RPM_BUILD_ROOT}%{_bindir}/docker-init # install systemd scripts -install -D -m 0644 engine/contrib/init/systemd/docker.service ${RPM_BUILD_ROOT}%{_unitdir}/docker.service -install -D -m 0644 engine/contrib/init/systemd/docker.socket ${RPM_BUILD_ROOT}%{_unitdir}/docker.socket +install -D -m 0644 ${RPM_BUILD_DIR}/src/engine/contrib/init/systemd/docker.service ${RPM_BUILD_ROOT}%{_unitdir}/docker.service +install -D -m 0644 ${RPM_BUILD_DIR}/src/engine/contrib/init/systemd/docker.socket ${RPM_BUILD_ROOT}%{_unitdir}/docker.socket %files %{_bindir}/dockerd diff --git a/rpm/SPECS/docker-compose-plugin.spec b/rpm/SPECS/docker-compose-plugin.spec index 017c3fb6d5..c8ca6764eb 100644 --- a/rpm/SPECS/docker-compose-plugin.spec +++ b/rpm/SPECS/docker-compose-plugin.spec @@ -21,6 +21,9 @@ Enhances: docker-ce-cli %endif BuildRequires: bash +%if 0%{?fedora} > 35 || 0%{?rhel} > 7 +BuildRequires: golang +%endi %description Docker Compose (V2) plugin for the Docker CLI. diff --git a/rpm/SPECS/docker-scan-plugin.spec b/rpm/SPECS/docker-scan-plugin.spec index 6cf24a8681..57755a23f1 100644 --- a/rpm/SPECS/docker-scan-plugin.spec +++ b/rpm/SPECS/docker-scan-plugin.spec @@ -23,6 +23,9 @@ Enhances: docker-ce-cli # TODO change once we support scan-plugin on other architectures BuildArch: x86_64 BuildRequires: bash +%if 0%{?fedora} > 35 || 0%{?rhel} > 7 +BuildRequires: golang +%endi %description Docker Scan plugin for the Docker CLI. diff --git a/rpm/fedora-34/Dockerfile b/rpm/fedora-34/Dockerfile index 688cc0a370..9078437ef9 100644 --- a/rpm/fedora-34/Dockerfile +++ b/rpm/fedora-34/Dockerfile @@ -21,10 +21,10 @@ COPY SPECS /root/rpmbuild/SPECS # TODO change once we support scan-plugin on other architectures RUN \ if [ "$(uname -m)" = "x86_64" ]; then \ - dnf builddep -y /root/rpmbuild/SPECS/*.spec; \ + dnf builddep -y --define 'fedora 34' /root/rpmbuild/SPECS/*.spec; \ else \ - dnf builddep -y /root/rpmbuild/SPECS/docker-c*.spec; \ - dnf builddep -y /root/rpmbuild/SPECS/docker-b*.spec; \ + dnf builddep -y --define 'fedora 34' /root/rpmbuild/SPECS/docker-c*.spec; \ + dnf builddep -y --define 'fedora 34' /root/rpmbuild/SPECS/docker-b*.spec; \ fi COPY --from=golang /usr/local/go /usr/local/go diff --git a/rpm/fedora-35/Dockerfile b/rpm/fedora-35/Dockerfile index d1b3f7f055..6c330875a0 100644 --- a/rpm/fedora-35/Dockerfile +++ b/rpm/fedora-35/Dockerfile @@ -21,10 +21,10 @@ COPY SPECS /root/rpmbuild/SPECS # TODO change once we support scan-plugin on other architectures RUN \ if [ "$(uname -m)" = "x86_64" ]; then \ - dnf builddep -y /root/rpmbuild/SPECS/*.spec; \ + dnf builddep -y --define 'fedora 35' /root/rpmbuild/SPECS/*.spec; \ else \ - dnf builddep -y /root/rpmbuild/SPECS/docker-c*.spec; \ - dnf builddep -y /root/rpmbuild/SPECS/docker-b*.spec; \ + dnf builddep -y --define 'fedora 35' /root/rpmbuild/SPECS/docker-c*.spec; \ + dnf builddep -y --define 'fedora 35' /root/rpmbuild/SPECS/docker-b*.spec; \ fi COPY --from=golang /usr/local/go /usr/local/go diff --git a/rpm/fedora-36/Dockerfile b/rpm/fedora-36/Dockerfile index 023c3a8ecb..e86556e302 100644 --- a/rpm/fedora-36/Dockerfile +++ b/rpm/fedora-36/Dockerfile @@ -21,10 +21,10 @@ COPY SPECS /root/rpmbuild/SPECS # TODO change once we support scan-plugin on other architectures RUN \ if [ "$(uname -m)" = "x86_64" ]; then \ - dnf builddep -y /root/rpmbuild/SPECS/*.spec; \ + dnf builddep -y --define 'fedora 36' /root/rpmbuild/SPECS/*.spec; \ else \ - dnf builddep -y /root/rpmbuild/SPECS/docker-c*.spec; \ - dnf builddep -y /root/rpmbuild/SPECS/docker-b*.spec; \ + dnf builddep -y --define 'fedora 36' /root/rpmbuild/SPECS/docker-c*.spec; \ + dnf builddep -y --define 'fedora 36' /root/rpmbuild/SPECS/docker-b*.spec; \ fi COPY --from=golang /usr/local/go /usr/local/go From f6f1e91e89e96032fc32976dd332ef6179313946 Mon Sep 17 00:00:00 2001 From: eabdullin Date: Wed, 15 Jun 2022 11:45:39 +0300 Subject: [PATCH 2/2] Fix unclosed if Signed-off-by: eabdullin --- rpm/SPECS/docker-ce-rootless-extras.spec | 2 +- rpm/SPECS/docker-ce.spec | 2 +- rpm/SPECS/docker-compose-plugin.spec | 2 +- rpm/SPECS/docker-scan-plugin.spec | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rpm/SPECS/docker-ce-rootless-extras.spec b/rpm/SPECS/docker-ce-rootless-extras.spec index 0fc4d10b0f..9f3f101a9a 100644 --- a/rpm/SPECS/docker-ce-rootless-extras.spec +++ b/rpm/SPECS/docker-ce-rootless-extras.spec @@ -22,7 +22,7 @@ Requires: fuse-overlayfs >= 0.7 BuildRequires: bash %if 0%{?fedora} > 35 || 0%{?rhel} > 7 BuildRequires: golang -%endi +%endif # conflicting packages Conflicts: rootlesskit diff --git a/rpm/SPECS/docker-ce.spec b/rpm/SPECS/docker-ce.spec index 7aeb611d69..ff570410b3 100644 --- a/rpm/SPECS/docker-ce.spec +++ b/rpm/SPECS/docker-ce.spec @@ -54,7 +54,7 @@ BuildRequires: tar BuildRequires: which %if 0%{?fedora} > 35 || 0%{?rhel} > 7 BuildRequires: golang -%endi +%endif # conflicting packages Conflicts: docker diff --git a/rpm/SPECS/docker-compose-plugin.spec b/rpm/SPECS/docker-compose-plugin.spec index c8ca6764eb..d5b9e72d42 100644 --- a/rpm/SPECS/docker-compose-plugin.spec +++ b/rpm/SPECS/docker-compose-plugin.spec @@ -23,7 +23,7 @@ Enhances: docker-ce-cli BuildRequires: bash %if 0%{?fedora} > 35 || 0%{?rhel} > 7 BuildRequires: golang -%endi +%endif %description Docker Compose (V2) plugin for the Docker CLI. diff --git a/rpm/SPECS/docker-scan-plugin.spec b/rpm/SPECS/docker-scan-plugin.spec index 57755a23f1..d9537b67ed 100644 --- a/rpm/SPECS/docker-scan-plugin.spec +++ b/rpm/SPECS/docker-scan-plugin.spec @@ -25,7 +25,7 @@ BuildArch: x86_64 BuildRequires: bash %if 0%{?fedora} > 35 || 0%{?rhel} > 7 BuildRequires: golang -%endi +%endif %description Docker Scan plugin for the Docker CLI.