aboutsummaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
Diffstat (limited to 'libs')
-rwxr-xr-xlibs/common17
-rwxr-xr-xlibs/git36
-rwxr-xr-xlibs/project18
-rwxr-xr-xlibs/tool9
4 files changed, 46 insertions, 34 deletions
diff --git a/libs/common b/libs/common
index a64a7b9b..8f1379ee 100755
--- a/libs/common
+++ b/libs/common
@@ -63,6 +63,23 @@ arguments_list() {
done
}
+diff_patch_file() {
+ local repository_path="$1"
+ local patch_file_path="$2"
+
+ local filename_in_diff="$(sed -rne 's/^-{3} {1}(.*)$/\1/p' <"${patch_file_path}")"
+
+ local source_file_path
+
+ if ! ( grep -E '^-{3}.*/' <"${patch_file_path}" >/dev/null 2>&1 ); then
+ source_file_path="${repository_path}/${filename_in_diff##\ }"
+ else
+ source_file_path="${repository_path}/${filename_in_diff##*/}"
+ fi
+
+ patch "${source_file_path}" "${patch_file_path}"
+}
+
path_wildcard_expand() {
local path=$@
diff --git a/libs/git b/libs/git
index e64173d9..a750be32 100755
--- a/libs/git
+++ b/libs/git
@@ -226,29 +226,29 @@ git_project_check() {
}
git_project_patch_recursive() {
- local project=$1
- local repository=$2
- local branch=$3
- local path=$4
+ local project="$1"
+ local repository="$2"
+ local branch="$3"
+ local path="${4:-.}"
- local repository_path=$( git_project_repository_path "$repository" )
- local project_path=$( project_path "$project" )
- local patches_path="$project_path/$PATCHES/$path/$WILDDOTPATCH"
- local patch_path
+ local repository_path="$(git_project_repository_path "${repository}")"
+ local project_path="$(project_path "${project}")"
+ local patches_path="${project_path}/${PATCHES}/${path}"
- if ! [ -z "$path" ] && [ "$path" != "." ]
- then
- git_project_patch_recursive "$project" "$repository" "$branch" "$( dirname "$path" )"
+ if ! [[ -d "${patches_path}" ]]; then
+ return
fi
- path_wildcard_expand "$patches_path" | while read patch_path
- do
- if ! [ -f "$patch_path" ]
- then
- continue
- fi
+ if [[ "${path}" != "." ]]; then
+ git_project_patch_recursive "${project}" "${repository}" "${branch}" "$(dirname "${path}")"
+ fi
- git_patch "$repository_path" "$branch" "$patch_path"
+ for patch in "${patches_path}"/[!.]*.{patch,diff}; do
+ if [[ "${patch##*.}" == "patch" ]]; then
+ git_patch "${repository_path}" "${branch}" "${patch}"
+ else
+ diff_patch_file "${repository_path}" "${patch}"
+ fi
done
}
diff --git a/libs/project b/libs/project
index 00ad76c6..20a6fe77 100755
--- a/libs/project
+++ b/libs/project
@@ -46,16 +46,13 @@ project_helper_include() {
}
project_check() {
- local project=$1
+ local project="${1##*/}"
- local project_path=$( project_path "$project" )
+ local project_path="$(project_path "${project}")"
- if ! [ -f "$project_path/$project" ]
- then
+ if ! [[ -f "${project_path}/${project}" ]]; then
return 1
fi
-
- return 0
}
project_function_check() {
@@ -90,10 +87,11 @@ project_action() {
project_action_check "$action" "$project" "$@"
- if [ $? -eq 0 ]
- then
- return 0
- fi
+ # Why is this here? Commented out for now.
+ # if [ $? -eq 0 ]
+ # then
+ # return 0
+ # fi
project_include "$project"
diff --git a/libs/tool b/libs/tool
index 6bf57be1..3a9c4a1b 100755
--- a/libs/tool
+++ b/libs/tool
@@ -44,16 +44,13 @@ tool_helper_include() {
}
tool_check() {
- local tool=$1
+ local tool="${1##*/}"
- local tool_path=$( tool_path "$tool" )
+ local tool_path="$(tool_path "${tool}")"
- if ! [ -f "$tool_path/$tool" ]
- then
+ if ! [[ -f "${tool_path}/${tool}" ]]; then
return 1
fi
-
- return 0
}
tool_function_check() {