!3 containerd: use git-commit to store commit ID

Merge pull request !3 from zvier/master
This commit is contained in:
openeuler-ci-bot 2020-06-15 16:24:33 +08:00 committed by Gitee
commit e9b83b9cef
6 changed files with 56 additions and 4 deletions

View File

@ -12,6 +12,9 @@ cwd=$PWD
src=$cwd/$pkg
unzip $pkg.zip
if [[ ! -d patch ]]; then
tar zxf patch.tar.gz
fi
cd $src
git init

View File

@ -2,11 +2,16 @@
%global debug_package %{nil}
Version: 1.2.0
Name: containerd
Release: 101
Release: 102
Summary: An industry-standard container runtime
License: ASL 2.0
URL: https://containerd.io
Source0: %{name}-%{version}.tar.gz
Source0: containerd-1.2.0.zip
Source1: patch.tar.gz
Source2: apply-patch
Source3: series.conf
Source4: git-commit
Source5: gen-commit.sh
BuildRequires: golang glibc-static make btrfs-progs-devel
@ -18,10 +23,14 @@ system: image transfer and storage, container execution and supervision,
low-level storage and network attachments, etc.
%prep
%setup -c -n containerd
cp %{SOURCE0} .
cp %{SOURCE1} .
cp %{SOURCE2} .
cp %{SOURCE3} .
cp %{SOURCE4} .
%build
./apply-patch
bash ./apply-patch
GO_BUILD_PATH=$PWD/_build
install -m 0755 -vd $(dirname $GO_BUILD_PATH/src/%{goipath})

12
gen-commit.sh Normal file
View File

@ -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: liuzekun@huawei.com
# Create: 2020-06-10
change_id=$(git log -1 | grep Change-Id | awk '{print $2}')
if [[ "${change_id}" = "" ]]; then
change_id=$(date | sha256sum | head -c 40)
fi
echo "${change_id}" > git-commit

1
git-commit Normal file
View File

@ -0,0 +1 @@
3f69708bd238c592ce917876ee841524a51cb781

View File

@ -0,0 +1,26 @@
From fe8ce77e756f7f468ed65c8c42a9f91becabbf4e Mon Sep 17 00:00:00 2001
From: liuzekun <liuzekun@huawei.com>
Date: Wed, 10 Jun 2020 00:37:01 -0400
Subject: [PATCH] containerd: use git-commit to store commit ID
Signed-off-by: liuzekun <liuzekun@huawei.com>
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 9e7f3ae..6011aa1 100644
--- a/Makefile
+++ b/Makefile
@@ -21,7 +21,7 @@ DESTDIR=/usr/local
# Used to populate variables in version package.
VERSION=$(shell echo version:)$(shell grep '^Version' ${ROOTDIR}/containerd.spec | sed 's/[^0-9.]*\([0-9.]*\).*/\1/').$(shell grep '^Release:' ${ROOTDIR}/containerd.spec | sed 's/[^0-9.]*\([0-9.]*\).*/\1/')
-REVISION=$(shell echo commit:)$(shell git rev-parse HEAD)$(shell if ! git diff --no-ext-diff --quiet --exit-code; then echo .m; fi)
+REVISION=$(shell cat ./git-commit | head -c 40)
ifneq "$(strip $(shell command -v go 2>/dev/null))" ""
GOOS ?= $(shell go env GOOS)
--
2.19.1

View File

@ -60,3 +60,4 @@ patch/0054-containerd-clean-up-residual-container.patch
patch/0055-containerd-add-LLT-for-containerd-shim-timeou.patch
patch/0056-containerd-save-dumpstack-to-file.patch
patch/0057-containerd-add-timeout-for-delete-command.patch
patch/0058-containerd-use-git-commit-to-store-commit-ID.patch