diff options
author | Timothy Gu <timothygu99@gmail.com> | 2014-09-18 00:12:32 (GMT) |
---|---|---|
committer | Timothy Gu <timothygu99@gmail.com> | 2014-09-18 00:12:32 (GMT) |
commit | 1bdd5cbe34c177df6ed9e79911b69c0974411ee3 (patch) | |
tree | 7b7cdb277ee20715a74dd56b968595108802795f /tools | |
parent | 7fcf5ae9c55badccb801130097f67a69775545d9 (diff) | |
download | mxe-1bdd5cbe34c177df6ed9e79911b69c0974411ee3.zip mxe-1bdd5cbe34c177df6ed9e79911b69c0974411ee3.tar.gz mxe-1bdd5cbe34c177df6ed9e79911b69c0974411ee3.tar.bz2 |
patch-tool-mxe: Add support for changing patch file
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/patch-tool-mxe | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/tools/patch-tool-mxe b/tools/patch-tool-mxe index 12a8b84..1ba10c9 100755 --- a/tools/patch-tool-mxe +++ b/tools/patch-tool-mxe @@ -5,6 +5,10 @@ cmd=$1 pkg=$2 +patch_name=$3 +if [ -z "$patch_name" ]; then + patch_name=1-fixes +fi setupEnv() { # MXE directory @@ -98,8 +102,8 @@ function export_patch { echo '' git format-patch -p --stdout dist..HEAD | \ sed 's/^From: .*/From: MXE/g;' - ) > $mxedir/src/$pkg-1-fixes.patch && \ - echo "Generated $mxedir/src/$pkg-1-fixes.patch" + ) > $mxedir/src/${pkg}-${patch_name}.patch && \ + echo "Generated ${mxedir}/src/${pkg}-${patch_name}.patch" } function import_patch { @@ -109,15 +113,16 @@ function import_patch { exit 1 fi - if [ -f $mxedir/src/$pkg-1-fixes.patch ]; then + if [ -f ${mxedir}/src/${pkg}-${patch_name}.patch ]; then cd $gitsdir/$pkg_subdir && \ - cat $mxedir/src/$pkg-1-fixes.patch | \ + cat ${mxedir}/src/${pkg}-${patch_name}.patch | \ sed '/^From/,$ !d' | \ sed s/'^From: .*'/"From: $author"/'g;' | \ git am --keep-cr && \ - echo "Imported $mxedir/src/$pkg-1-fixes.patch" + echo "Imported ${mxedir}/src/${pkg}-${patch_name}.patch" else - echo "patch-tool managed file $mxedir/src/$pkg-1-fixes.patch not found. Cancelling import." >&2 + echo "patch file ${mxedir}/src/${pkg}-${patch_name}.patch not found." + echo "Cancelling import." >&2 exit 1 fi } @@ -135,11 +140,13 @@ case "$cmd" in *) echo "Unrecognized command '${cmd}'" >&2 cat <<EOS - Usage: $0 COMMAND PACKAGENAME + Usage: $0 COMMAND PACKAGENAME [PATCHNAME] where COMMAND is one of: init - create a git directory for the package with the raw source - import - apply the "pkgname-1-fixes.patch" patch commits - export - create/replace the "pkgname-1-fixes.patch" patch with a patch of all commits since init. + import - apply the "pkgname-PATCHNAME.patch" patch commits + export - create/replace the "pkgname-PATCHNAME.patch" patch with a patch of all commits since init. + + If PATCHNAME is not set, it is default to "1-fixes". EOS exit 1 ;; |