From 96df90671279e89ca2e48ef0fa92863f6f05c86d Mon Sep 17 00:00:00 2001 From: Sergey Abramchuk Date: Sat, 15 May 2021 12:21:00 +0300 Subject: [PATCH] chore: pull out functions from the separate file to the apply_patches.sh --- Scripts/apply_patches.sh | 40 +++++++++++++++++++++++++++++++++++++++- Scripts/functions.sh | 39 --------------------------------------- 2 files changed, 39 insertions(+), 40 deletions(-) delete mode 100644 Scripts/functions.sh diff --git a/Scripts/apply_patches.sh b/Scripts/apply_patches.sh index eb296e5..d055ebb 100755 --- a/Scripts/apply_patches.sh +++ b/Scripts/apply_patches.sh @@ -2,7 +2,45 @@ set -e -. Scripts/functions.sh +function apply_patches() +{ + DEP_SRC_DIR=$1 + DEP_PATCH_DIR=$2 + + CURRENT_DIR=$(pwd) + + pushd ${CURRENT_DIR} + + cd /tmp + + for FILE in ${CURRENT_DIR}/${DEP_PATCH_DIR}/*.patch; do + echo Applying patch: $FILE + git apply --directory ${CURRENT_DIR}/${DEP_SRC_DIR} --unsafe-path $FILE + done + + popd +} + +function reverse_patches() +{ + DEP_SRC_DIR=$1 + DEP_PATCH_DIR=$2 + + CURRENT_DIR=$(pwd) + + pushd ${CURRENT_DIR} + + cd /tmp + + REVERSED_PATCHES=$(ls -1 ${CURRENT_DIR}/${DEP_PATCH_DIR}/*.patch | sort -r) + + for FILE in $REVERSED_PATCHES; do + echo Reverse patch: $FILE + git apply --reverse --directory ${CURRENT_DIR}/${DEP_SRC_DIR} --unsafe-path $FILE + done + + popd +} ASIO_SRC_DIR="Sources/ASIO" ASIO_PATCH_DIR="Sources/OpenVPN3/deps/asio/patches" diff --git a/Scripts/functions.sh b/Scripts/functions.sh deleted file mode 100644 index ba8de50..0000000 --- a/Scripts/functions.sh +++ /dev/null @@ -1,39 +0,0 @@ -function apply_patches() -{ - DEP_SRC_DIR=$1 - DEP_PATCH_DIR=$2 - - CURRENT_DIR=$(pwd) - - pushd ${CURRENT_DIR} - - cd /tmp - - for FILE in ${CURRENT_DIR}/${DEP_PATCH_DIR}/*.patch; do - echo Applying patch: $FILE - git apply --directory ${CURRENT_DIR}/${DEP_SRC_DIR} --unsafe-path $FILE - done - - popd -} - -function reverse_patches() -{ - DEP_SRC_DIR=$1 - DEP_PATCH_DIR=$2 - - CURRENT_DIR=$(pwd) - - pushd ${CURRENT_DIR} - - cd /tmp - - REVERSED_PATCHES=$(ls -1 ${CURRENT_DIR}/${DEP_PATCH_DIR}/*.patch | sort -r) - - for FILE in $REVERSED_PATCHES; do - echo Reverse patch: $FILE - git apply --reverse --directory ${CURRENT_DIR}/${DEP_SRC_DIR} --unsafe-path $FILE - done - - popd -}