From ab5af3192288837ab35bc66f74b6f89de4efb056 Mon Sep 17 00:00:00 2001 From: xiadanni1 Date: Tue, 9 Jun 2020 02:18:21 +0800 Subject: [PATCH] runc: use git-commit to store commit ID Change-Id: Ib43bafb0ec680082520d85530ef783b68bc08671 Signed-off-by: xiadanni1 --- apply-patch | 3 ++ gen-commit.sh | 12 ++++++++ git-commit | 1 + ...nc-use-git-commit-to-store-commit-ID.patch | 28 +++++++++++++++++++ runc-openeuler.spec | 17 ++++++++--- series.conf | 1 + 6 files changed, 58 insertions(+), 4 deletions(-) create mode 100755 gen-commit.sh create mode 100644 git-commit create mode 100644 patch/0119-runc-use-git-commit-to-store-commit-ID.patch diff --git a/apply-patch b/apply-patch index 6e900dc..bb73c5a 100755 --- a/apply-patch +++ b/apply-patch @@ -10,6 +10,9 @@ cwd=$PWD src=$cwd/$pkg unzip $pkg.zip +if [ ! -d patch ];then + tar -xzf patch.tar.gz +fi series=$cwd/series.conf while IPF= read -r line 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..1fcc075 --- /dev/null +++ b/git-commit @@ -0,0 +1 @@ +Ib43bafb0ec680082520d85530ef783b68bc08671 diff --git a/patch/0119-runc-use-git-commit-to-store-commit-ID.patch b/patch/0119-runc-use-git-commit-to-store-commit-ID.patch new file mode 100644 index 0000000..8ee8ac3 --- /dev/null +++ b/patch/0119-runc-use-git-commit-to-store-commit-ID.patch @@ -0,0 +1,28 @@ +From 0eb0fdb40b1f1a80d07c95c59e391e44ea646b01 Mon Sep 17 00:00:00 2001 +From: xiadanni1 +Date: Tue, 9 Jun 2020 01:52:46 +0800 +Subject: [PATCH] runc: use git-commit to store commit ID + +Change-Id: I9b2e44691dafc2ced0523ed8423f3cb29bebd502 +Signed-off-by: xiadanni1 +--- + Makefile | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/Makefile b/Makefile +index b24c22b..60d1d57 100644 +--- a/Makefile ++++ b/Makefile +@@ -10,8 +10,7 @@ GIT_BRANCH_CLEAN := $(shell echo $(GIT_BRANCH) | sed -e "s/[^[:alnum:]]/-/g") + RUNC_IMAGE := runc_dev$(if $(GIT_BRANCH_CLEAN),:$(GIT_BRANCH_CLEAN)) + PROJECT := github.com/opencontainers/runc + BUILDTAGS := seccomp +-COMMIT_NO := $(shell git rev-parse HEAD 2> /dev/null || true) +-COMMIT := $(if $(shell git status --porcelain --untracked-files=no),"${COMMIT_NO}-dirty","${COMMIT_NO}") ++COMMIT := $(shell cat ./git-commit | head -c 40) + + MAN_DIR := $(CURDIR)/man/man8 + MAN_PAGES = $(shell ls $(MAN_DIR)/*.8) +-- +1.8.3.1 + diff --git a/runc-openeuler.spec b/runc-openeuler.spec index c0a742d..3efd664 100644 --- a/runc-openeuler.spec +++ b/runc-openeuler.spec @@ -2,11 +2,16 @@ Name: docker-runc Version: 1.0.0.rc3 -Release: 104 +Release: 105 Summary: runc is a CLI tool for spawning and running containers according to the OCI specification. License: ASL 2.0 -Source: %{name}.tar.gz +Source0: runc-1.0.0-rc3.zip +Source1: patch.tar.gz +Source2: apply-patch +Source3: series.conf +Source4: git-commit +Source5: gen-commit.sh URL: https://www.opencontainers.org/ Vendor: OCI @@ -18,10 +23,14 @@ BuildRequires: golang >= 1.8.3 glibc-static make libseccomp-devel libseccomp-sta runc is a CLI tool for spawning and running containers according to the OCI specification. %prep -%setup -c -n runc +cp %{SOURCE0} . +cp %{SOURCE1} . +cp %{SOURCE2} . +cp %{SOURCE3} . +cp %{SOURCE4} . %install -./apply-patch +sh ./apply-patch mkdir -p .gopath/src/github.com/opencontainers export GOPATH=`pwd`/.gopath diff --git a/series.conf b/series.conf index c7b6362..02dc07d 100644 --- a/series.conf +++ b/series.conf @@ -115,3 +115,4 @@ 0116-runc-check-nil-pointers-in-cgroup-manager.patch 0117-runc-Pass-back-the-pid-of-runc-1-CHILD-so-w.patch 0118-runc-rootfs-do-not-permit-proc-mounts-to-no.patch +0119-runc-use-git-commit-to-store-commit-ID.patch -- Gitee