summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQiaowei Ren <qiaowei.ren@intel.com>2018-05-24 14:54:29 +0800
committerQiaowei Ren <qiaowei.ren@intel.com>2018-05-24 15:04:47 +0800
commit1b82fb75641e8350f0218c086a85e5bfec8a1977 (patch)
tree97fdff67d9a83866ef54017d403edae79be9317d
parent3b387984b55e9f84f5a7ca1421d722964e088ba1 (diff)
manage local patches
We could not put the source code of ceph or other projects due to different license, and so we have to only manage those changes locally. This patch provides one way to apply local patches into source code from public repo. We can use the '.rc' file in every project to configure the branch, repo and list all local patches which need to be applies into original branch. And then use 'do_patch.sh' script to apply them one by one, e.g. $ src/do_patch.sh src/ceph/ceph.rc Change-Id: I07573a0ab6985c2aca2558ac2183cdfc8187bf04 Signed-off-by: Qiaowei Ren <qiaowei.ren@intel.com>
-rw-r--r--src/ceph/.gitkeep3
-rw-r--r--src/ceph/ceph.rc13
-rwxr-xr-xsrc/do_patch.sh52
3 files changed, 65 insertions, 3 deletions
diff --git a/src/ceph/.gitkeep b/src/ceph/.gitkeep
deleted file mode 100644
index 617c45f..0000000
--- a/src/ceph/.gitkeep
+++ /dev/null
@@ -1,3 +0,0 @@
-# Ignore everything in this directory
-*
-# Except this file !.gitkeep
diff --git a/src/ceph/ceph.rc b/src/ceph/ceph.rc
new file mode 100644
index 0000000..6c5f95e
--- /dev/null
+++ b/src/ceph/ceph.rc
@@ -0,0 +1,13 @@
+PROJECT="ceph"
+SUMMARY="a scalable distributed storage system"
+BRANCH="mimic"
+REPO="https://github.com/ceph/ceph.git"
+OPTION=""
+
+# array including all local patches, e.g.
+#
+# SOURCES=(
+# "0001-crypto-add-openssl-support-for-RGW-encryption.patch" \
+# "0001-add-QAT-support.patch" \
+# )
+SOURCES=()
diff --git a/src/do_patch.sh b/src/do_patch.sh
new file mode 100755
index 0000000..899ec9b
--- /dev/null
+++ b/src/do_patch.sh
@@ -0,0 +1,52 @@
+#!/bin/bash
+
+recipe=$1
+ceph_dir=$PWD/src/ceph
+
+if [ -n "$1" ]; then
+ echo "recipe file: $1"
+else
+ echo "must supply one recipe file"
+ exit
+fi
+
+if [ ! -f "$recipe" ]; then
+ echo "recipe file $recipe doesn't exist"
+ exit
+fi
+
+source $recipe
+
+echo $PROJECT
+echo $SUMMARY
+echo $BRANCH
+echo $REPO
+echo $OPTION
+
+do_patch() {
+ echo ""
+ echo "$PROJECT do_patch"
+ cd $ceph_dir
+ if [ -d "$PROJECT" ]; then
+ rm -rf $PROJECT
+ fi
+ git clone -b $BRANCH $REPO $PROJECT
+ cd $PROJECT
+ for patch in ${SOURCES[@]}
+ do
+ echo ""
+ echo $patch
+ if [ ! -f "$ceph_dir/$patch" ]; then
+ echo "$patch doesn't exit"
+ fi
+ check_results=`patch -p1 < $ceph_dir/$patch | grep FAILED`
+ echo "command (patch -p1 < $ceph_dir/$patch) results are:"
+ echo "$check_results"
+ if [[ $check_results =~ "FAILED" ]]; then
+ echo "$patch could not be applied successfully"
+ exit
+ fi
+ done
+}
+
+do_patch