Merge "manage local patches"
authorHui Wang <wanghui71@huawei.com>
Fri, 25 May 2018 09:09:30 +0000 (09:09 +0000)
committerGerrit Code Review <gerrit@opnfv.org>
Fri, 25 May 2018 09:09:30 +0000 (09:09 +0000)
src/ceph/.gitkeep [deleted file]
src/ceph/ceph.rc [new file with mode: 0644]
src/do_patch.sh [new file with mode: 0755]

diff --git a/src/ceph/.gitkeep b/src/ceph/.gitkeep
deleted file mode 100644 (file)
index 617c45f..0000000
+++ /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 (file)
index 0000000..6c5f95e
--- /dev/null
@@ -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 (executable)
index 0000000..899ec9b
--- /dev/null
@@ -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