diff --git a/apply-patches b/apply-patches index d398bf2..b03cd22 100755 --- a/apply-patches +++ b/apply-patches @@ -12,6 +12,9 @@ cwd=$PWD src=$cwd/$pkg tar -xzvf $pkg.tar.gz +if [ ! -d patch ];then + tar -xzf patch.tar.gz +fi cd $src git init @@ -38,6 +41,8 @@ else cp -rf $src/* . cp -rf VERSION-openeuler $cwd/components/cli/ cp -rf VERSION-openeuler $cwd/components/engine/ + cp -rf git-commit $cwd/components/cli/ + cp -rf git-commit $cwd/components/engine/ fi mv $src/.git $src/git diff --git a/docker-engine-openeuler.spec b/docker-engine-openeuler.spec index 5a700de..032357d 100644 --- a/docker-engine-openeuler.spec +++ b/docker-engine-openeuler.spec @@ -1,11 +1,17 @@ Name: docker-engine Version: 18.09.0 -Release: 104 +Release: 105 Summary: The open-source application container engine Group: Tools/Docker License: ASL 2.0 -Source: %{name}.tar.gz +Source0: docker-ce-18.09.0.tar.gz +Source1: patch.tar.gz +Source2: apply-patches +Source3: git-commit +Source4: series.conf +Source5: VERSION-openeuler +Source6: gen-commit.sh URL: https://mobyproject.org @@ -38,17 +44,21 @@ for deploying and scaling web apps, databases, and backend services without depending on a particular stack or provider. %prep -%autosetup -c -n %{name} +cp %{SOURCE0} . +cp %{SOURCE1} . +cp %{SOURCE2} . +cp %{SOURCE3} . +cp %{SOURCE4} . +cp %{SOURCE5} . %build -./apply-patches +sh ./apply-patches # build docker engine WORKDIR=$(pwd) -GITCOMMIT=$(git rev-parse --short HEAD) export VERSION=$(cat VERSION) -export DOCKER_GITCOMMIT=${GITCOMMIT} +export DOCKER_GITCOMMIT=$(cat git-commit | head -c 7) export AUTO_GOPATH=1 export DOCKER_BUILDTAGS="pkcs11 seccomp selinux" cd ${WORKDIR}/components/engine diff --git a/gen-commit.sh b/gen-commit.sh new file mode 100755 index 0000000..b4c4c80 --- /dev/null +++ b/gen-commit.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +# Copyright (c) Huawei Technologies Co., Ltd. 2020. All rights reserved. +# Description: This shell script is used to generate commitID store file. +# Author: xiadanni1@huawei.com +# Create: 2020-06-09 + +changeID=`git log -1 | grep Change-Id | awk '{print $2}'` +if [ "${changeID}" = "" ];then + changeID=`date | sha256sum | head -c 40` +fi +echo "${changeID}" > git-commit diff --git a/git-commit b/git-commit new file mode 100644 index 0000000..e4dde58 --- /dev/null +++ b/git-commit @@ -0,0 +1 @@ +Id13ecdba61708f62595d6db593c670c304abf0bb diff --git a/patch/0164-docker-use-git-commit-to-store-commit-ID.patch b/patch/0164-docker-use-git-commit-to-store-commit-ID.patch new file mode 100644 index 0000000..b96c4ae --- /dev/null +++ b/patch/0164-docker-use-git-commit-to-store-commit-ID.patch @@ -0,0 +1,39 @@ +From edfe32735e5eaf614107710c8a187eddf0ccac89 Mon Sep 17 00:00:00 2001 +From: xiadanni1 +Date: Wed, 10 Jun 2020 01:44:18 +0800 +Subject: [PATCH] docker: use git-commit to store commit ID + +Signed-off-by: xiadanni1 +--- + components/cli/scripts/build/.variables | 2 +- + components/engine/hack/make.sh | 1 + + 2 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/components/cli/scripts/build/.variables b/components/cli/scripts/build/.variables +index 86d0e3a..a23e379 100755 +--- a/components/cli/scripts/build/.variables ++++ b/components/cli/scripts/build/.variables +@@ -4,7 +4,7 @@ set -eu + PLATFORM=${PLATFORM:-} + VERSION=${VERSION:-"unknown-version"} + EULERVERSION=${EULERVERSION:-$(cat VERSION-openeuler)} +-GITCOMMIT=${GITCOMMIT:-$(git rev-parse --short HEAD 2> /dev/null || true)} ++GITCOMMIT=${GITCOMMIT:-$(cat git-commit | head -c 7)} + BUILDTIME=${BUILDTIME:-$(date --utc --rfc-3339 ns 2> /dev/null | sed -e 's/ /T/')} + + PLATFORM_LDFLAGS= +diff --git a/components/engine/hack/make.sh b/components/engine/hack/make.sh +index 686e688..f4a51e7 100755 +--- a/components/engine/hack/make.sh ++++ b/components/engine/hack/make.sh +@@ -68,6 +68,7 @@ DEFAULT_BUNDLES=( + VERSION_EULER=$(< ./VERSION-openeuler) + VERSION=${VERSION:-dev} + ! BUILDTIME=$(date -u -d "@${SOURCE_DATE_EPOCH:-$(date +%s)}" --rfc-3339 ns 2> /dev/null | sed -e 's/ /T/') ++DOCKER_GITCOMMIT=$(cat git-commit | head -c 7) + if [ "$DOCKER_GITCOMMIT" ]; then + GITCOMMIT="$DOCKER_GITCOMMIT" + elif command -v git &> /dev/null && [ -e .git ] && git rev-parse &> /dev/null; then +-- +1.8.3.1 + diff --git a/series.conf b/series.conf index 4fe3e7e..0c94a47 100644 --- a/series.conf +++ b/series.conf @@ -159,3 +159,4 @@ patch/0160-docker-create-a-soft-link-from-runtime-default-to-ru.patch patch/0161-docker-Delete-stale-containerd-object-on-start-f.patch patch/0162-docker-delete-event-is-not-need-to-process.patch patch/0163-docker-stat-process-exit-file-when-kill-process-dire.patch +patch/0164-docker-use-git-commit-to-store-commit-ID.patch