cookutils rev 984
cook: patchit(): allow patch options (like '-p0', '-p2", etc.)
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Sun Oct 22 18:54:11 2017 +0300 (2017-10-22) |
parents | f468fc0fcdc3 |
children | 7a71926d4191 |
files | cook |
line diff
1.1 --- a/cook Sat Oct 21 11:45:40 2017 +0300 1.2 +++ b/cook Sun Oct 22 18:54:11 2017 +0300 1.3 @@ -549,11 +549,15 @@ 1.4 IFS=$'\n' 1.5 while read i; do 1.6 patchname=$(echo ${i%%#*} | cut -d' ' -f1) # allow comments (anything after the # or space) 1.7 + case $patchname in # allow patch options in form <options_no_spaces>|<file_name> 1.8 + *\|*) patchopts="${patchname%|*}"; patchname="${patchname#*|}";; 1.9 + *) patchopts='-Np1';; 1.10 + esac 1.11 [ -n "$patchname" ] || continue # allow empty lines 1.12 [ -f "$src/done.$patchname" ] && continue # already applied (useful with `cook --continue`) 1.13 newline 1.14 _ 'Applying patch %s' "$patchname" 1.15 - patch -Np1 -i $stuff/patches/$patchname | sed 's|^| |' 1.16 + patch $patchopts -i $stuff/patches/$patchname | sed 's|^| |' 1.17 touch $src/done.$patchname 1.18 done < $stuff/patches/series 1.19 newline