aboutsummaryrefslogtreecommitdiff
path: root/libs/common
diff options
context:
space:
mode:
authorLeah Rowe <info@minifree.org>2017-05-31 23:55:53 +0000
committerGogs <gogitservice@gmail.com>2017-05-31 23:55:53 +0000
commit2271147a9c5a80afa9fa81a4eacafcaa1d840258 (patch)
treed227d0fb53dc6cfcfb2260190294f5e474332d77 /libs/common
parenta36b0c7ccfad15941905185557cc4129f2f8a860 (diff)
parent1ea8d09af262ddeed87acf5916cec42d9a002da1 (diff)
downloadlibrebootfr-2271147a9c5a80afa9fa81a4eacafcaa1d840258.tar.gz
librebootfr-2271147a9c5a80afa9fa81a4eacafcaa1d840258.zip
Merge branch 'build-system-merge' of kragle/libreboot into master
Diffstat (limited to 'libs/common')
-rwxr-xr-xlibs/common17
1 files changed, 17 insertions, 0 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=$@