Mercurial > mxe-octave
annotate tools/patch-tool-mxe @ 3700:76745b5dfd81
bump version to 0.0.31
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 28 Aug 2014 16:58:58 -0400 |
parents | a681265e116f |
children |
rev | line source |
---|---|
2358
14b3f5ea78ae
Cleanup coding style via "make cleanup-style"
Volker Grabsch <vog@notjusthosting.com>
parents:
2353
diff
changeset
|
1 #!/usr/bin/env bash |
2333
f653602a0500
Rebrand to new project name MXE
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
2 |
f653602a0500
Rebrand to new project name MXE
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
3 # Tool for converting between MXE patch files and git repos |
f653602a0500
Rebrand to new project name MXE
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
4 # Imports and exports patch files in "git format-patch" format. |
f653602a0500
Rebrand to new project name MXE
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
5 |
f653602a0500
Rebrand to new project name MXE
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
6 cmd=$1 |
f653602a0500
Rebrand to new project name MXE
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
7 pkg=$2 |
f653602a0500
Rebrand to new project name MXE
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
8 |
2489
2f3353b7a313
Patch tool: Move environment variable setup to a function.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2488
diff
changeset
|
9 setupEnv() { |
2f3353b7a313
Patch tool: Move environment variable setup to a function.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2488
diff
changeset
|
10 # MXE directory |
2f3353b7a313
Patch tool: Move environment variable setup to a function.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2488
diff
changeset
|
11 export mxedir=$(cd $(dirname $0) && cd .. && pwd) |
2333
f653602a0500
Rebrand to new project name MXE
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
12 |
2489
2f3353b7a313
Patch tool: Move environment variable setup to a function.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2488
diff
changeset
|
13 # directory for unpacked tarballs/git repos |
2f3353b7a313
Patch tool: Move environment variable setup to a function.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2488
diff
changeset
|
14 export gitsdir=${mxedir}/gits |
2486
a866a8b8beab
patch-tool: use relative directories
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2485
diff
changeset
|
15 |
2489
2f3353b7a313
Patch tool: Move environment variable setup to a function.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2488
diff
changeset
|
16 mkdir -p ${gitsdir} |
2333
f653602a0500
Rebrand to new project name MXE
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
17 |
f653602a0500
Rebrand to new project name MXE
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
18 |
2489
2f3353b7a313
Patch tool: Move environment variable setup to a function.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2488
diff
changeset
|
19 # John Doe <John Doe@acme.org> |
2f3353b7a313
Patch tool: Move environment variable setup to a function.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2488
diff
changeset
|
20 export author=`git var GIT_AUTHOR_IDENT | sed 's/^\(.* [<].*[>]\).*$/\1/'` |
2333
f653602a0500
Rebrand to new project name MXE
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
21 |
2489
2f3353b7a313
Patch tool: Move environment variable setup to a function.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2488
diff
changeset
|
22 export pkg_version=$(sed -n "s/^.* id=\"${pkg}-version\">\([^<]*\)<.*$/\1/p" "${mxedir}/index.html") |
2333
f653602a0500
Rebrand to new project name MXE
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
23 |
2489
2f3353b7a313
Patch tool: Move environment variable setup to a function.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2488
diff
changeset
|
24 export pkg_short_version=`echo $pkg_version | sed s/'\(.*\)\.[^.]*$'/'\1'/` |
2333
f653602a0500
Rebrand to new project name MXE
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
25 |
2489
2f3353b7a313
Patch tool: Move environment variable setup to a function.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2488
diff
changeset
|
26 export pkg_subdir=`grep '^$(PKG)_SUBDIR' $mxedir/src/$pkg.mk | \ |
2f3353b7a313
Patch tool: Move environment variable setup to a function.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2488
diff
changeset
|
27 sed 's/.*:= \(.*\)/\1/' | \ |
2f3353b7a313
Patch tool: Move environment variable setup to a function.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2488
diff
changeset
|
28 sed s/'$($(PKG)_VERSION)'/$pkg_version/ | \ |
2f3353b7a313
Patch tool: Move environment variable setup to a function.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2488
diff
changeset
|
29 sed s/'$(call SHORT_PKG_VERSION,$(PKG))'/$pkg_short_version/ | \ |
2f3353b7a313
Patch tool: Move environment variable setup to a function.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2488
diff
changeset
|
30 sed s/'$(PKG)'/$pkg/;` |
2333
f653602a0500
Rebrand to new project name MXE
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
31 |
2489
2f3353b7a313
Patch tool: Move environment variable setup to a function.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2488
diff
changeset
|
32 export pkg_file=`grep '^$(PKG)_FILE' $mxedir/src/$pkg.mk | \ |
2f3353b7a313
Patch tool: Move environment variable setup to a function.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2488
diff
changeset
|
33 sed 's/.*:= \(.*\)/\1/' | \ |
2f3353b7a313
Patch tool: Move environment variable setup to a function.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2488
diff
changeset
|
34 sed s/'$($(PKG)_VERSION)'/$pkg_version/ | \ |
2f3353b7a313
Patch tool: Move environment variable setup to a function.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2488
diff
changeset
|
35 sed s/'$(call SHORT_PKG_VERSION,$(PKG))'/$pkg_short_version/ | \ |
2f3353b7a313
Patch tool: Move environment variable setup to a function.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2488
diff
changeset
|
36 sed s/'$($(PKG)_SUBDIR)'/$pkg_subdir/ | \ |
2f3353b7a313
Patch tool: Move environment variable setup to a function.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2488
diff
changeset
|
37 sed s/'$(PKG)'/$pkg/;` |
2333
f653602a0500
Rebrand to new project name MXE
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
38 |
2489
2f3353b7a313
Patch tool: Move environment variable setup to a function.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2488
diff
changeset
|
39 #echo $pkg |
2f3353b7a313
Patch tool: Move environment variable setup to a function.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2488
diff
changeset
|
40 #echo $pkg_version |
2f3353b7a313
Patch tool: Move environment variable setup to a function.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2488
diff
changeset
|
41 #echo $pkg_subdir |
2f3353b7a313
Patch tool: Move environment variable setup to a function.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2488
diff
changeset
|
42 #echo $pkg_file |
2333
f653602a0500
Rebrand to new project name MXE
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
43 |
2489
2f3353b7a313
Patch tool: Move environment variable setup to a function.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2488
diff
changeset
|
44 } |
2333
f653602a0500
Rebrand to new project name MXE
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
45 # init |
f653602a0500
Rebrand to new project name MXE
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
46 function init_git { |
2489
2f3353b7a313
Patch tool: Move environment variable setup to a function.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2488
diff
changeset
|
47 setupEnv |
2333
f653602a0500
Rebrand to new project name MXE
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
48 cd $gitsdir |
2491
14be80e4c69f
Patch tool: Adding some progress messages to long processes.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2490
diff
changeset
|
49 |
2494
fa084483fc19
patch tool: check preconditions for init
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2493
diff
changeset
|
50 if [ -d $gitsdir/$pkg_subdir ]; then |
fa084483fc19
patch tool: check preconditions for init
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2493
diff
changeset
|
51 echo "Error: $gitsdir/$pkg_subdir already exists. Cancelling init." >&2 |
fa084483fc19
patch tool: check preconditions for init
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2493
diff
changeset
|
52 exit 1 |
fa084483fc19
patch tool: check preconditions for init
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2493
diff
changeset
|
53 fi |
fa084483fc19
patch tool: check preconditions for init
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2493
diff
changeset
|
54 |
2491
14be80e4c69f
Patch tool: Adding some progress messages to long processes.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2490
diff
changeset
|
55 echo "Checking for cached $pkg_file" |
2490
0db1b21402e9
patch tool: Check for package file, and if it's not there, use makefile to grab it.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2489
diff
changeset
|
56 if [ ! -f $mxedir/pkg/$pkg_file ]; then |
0db1b21402e9
patch tool: Check for package file, and if it's not there, use makefile to grab it.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2489
diff
changeset
|
57 make -C "$mxedir" download-$pkg |
2491
14be80e4c69f
Patch tool: Adding some progress messages to long processes.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2490
diff
changeset
|
58 echo "Building the mxe Makefile target 'download-$pkg' to get missing file" |
2490
0db1b21402e9
patch tool: Check for package file, and if it's not there, use makefile to grab it.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2489
diff
changeset
|
59 if [ ! $? -eq 0 ]; then |
0db1b21402e9
patch tool: Check for package file, and if it's not there, use makefile to grab it.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2489
diff
changeset
|
60 echo "Could not build target download-$pkg - cancelling init." >&2 |
0db1b21402e9
patch tool: Check for package file, and if it's not there, use makefile to grab it.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2489
diff
changeset
|
61 exit 1 |
0db1b21402e9
patch tool: Check for package file, and if it's not there, use makefile to grab it.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2489
diff
changeset
|
62 fi |
0db1b21402e9
patch tool: Check for package file, and if it's not there, use makefile to grab it.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2489
diff
changeset
|
63 fi |
2491
14be80e4c69f
Patch tool: Adding some progress messages to long processes.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2490
diff
changeset
|
64 |
14be80e4c69f
Patch tool: Adding some progress messages to long processes.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2490
diff
changeset
|
65 echo "Unpacking archive..." |
2334
0ac3f45e790f
Improve indentation
Volker Grabsch <vog@notjusthosting.com>
parents:
2333
diff
changeset
|
66 echo $pkg_file | grep "\.tar\.gz" >> /dev/null && tar xf $mxedir/pkg/$pkg_file |
2333
f653602a0500
Rebrand to new project name MXE
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
67 echo $pkg_file | grep "\.tar\.bz2" >> /dev/null && tar xf $mxedir/pkg/$pkg_file |
f653602a0500
Rebrand to new project name MXE
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
68 echo $pkg_file | grep "\.tar\.xz" >> /dev/null && xz -dc $mxedir/pkg/$pkg_file | tar xf - |
2334
0ac3f45e790f
Improve indentation
Volker Grabsch <vog@notjusthosting.com>
parents:
2333
diff
changeset
|
69 echo $pkg_file | grep "\.zip" >> /dev/null && unzip $mxedir/pkg/$pkg_file >> /dev/null |
2491
14be80e4c69f
Patch tool: Adding some progress messages to long processes.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2490
diff
changeset
|
70 |
14be80e4c69f
Patch tool: Adding some progress messages to long processes.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2490
diff
changeset
|
71 echo "Initializing repo and adding all as first commit" |
2333
f653602a0500
Rebrand to new project name MXE
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
72 cd $gitsdir/$pkg_subdir && \ |
f653602a0500
Rebrand to new project name MXE
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
73 (git init; git add -A; git commit -m "init") > /dev/null |
2491
14be80e4c69f
Patch tool: Adding some progress messages to long processes.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2490
diff
changeset
|
74 |
2495
a681265e116f
patch tool: Add useful status messages
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2494
diff
changeset
|
75 echo "Creating 'dist' tag for distribution tarball state" |
2333
f653602a0500
Rebrand to new project name MXE
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
76 git tag dist |
2495
a681265e116f
patch tool: Add useful status messages
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2494
diff
changeset
|
77 |
a681265e116f
patch tool: Add useful status messages
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2494
diff
changeset
|
78 echo "Repository ready in $gitsdir/$pkg_subdir" |
2333
f653602a0500
Rebrand to new project name MXE
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
79 } |
f653602a0500
Rebrand to new project name MXE
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
80 |
f653602a0500
Rebrand to new project name MXE
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
81 function export_patch { |
2489
2f3353b7a313
Patch tool: Move environment variable setup to a function.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2488
diff
changeset
|
82 setupEnv |
2493
f8ba2ad7cd81
patch tool: check preconditions for export
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2492
diff
changeset
|
83 if [ ! -d $gitsdir/$pkg_subdir ]; then |
f8ba2ad7cd81
patch tool: check preconditions for export
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2492
diff
changeset
|
84 echo "Error: $gitsdir/$pkg_subdir does not exist, so cannot export patches. Cancelling export." >&2 |
f8ba2ad7cd81
patch tool: check preconditions for export
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2492
diff
changeset
|
85 exit 1 |
f8ba2ad7cd81
patch tool: check preconditions for export
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2492
diff
changeset
|
86 fi |
f8ba2ad7cd81
patch tool: check preconditions for export
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2492
diff
changeset
|
87 |
2333
f653602a0500
Rebrand to new project name MXE
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
88 cd $gitsdir/$pkg_subdir && \ |
f653602a0500
Rebrand to new project name MXE
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
89 ( |
f653602a0500
Rebrand to new project name MXE
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
90 echo 'This file is part of MXE.' |
2353
99516e73b368
Move doc/index.html -> index.html
Volker Grabsch <vog@notjusthosting.com>
parents:
2334
diff
changeset
|
91 echo 'See index.html for further information.' |
2333
f653602a0500
Rebrand to new project name MXE
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
92 echo '' |
f653602a0500
Rebrand to new project name MXE
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
93 echo 'Contains ad hoc patches for cross building.' |
f653602a0500
Rebrand to new project name MXE
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
94 echo '' |
f653602a0500
Rebrand to new project name MXE
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
95 git format-patch -p --stdout dist..HEAD | \ |
f653602a0500
Rebrand to new project name MXE
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
96 sed 's/^From: .*/From: MXE/g;' |
2495
a681265e116f
patch tool: Add useful status messages
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2494
diff
changeset
|
97 ) > $mxedir/src/$pkg-1-fixes.patch && \ |
a681265e116f
patch tool: Add useful status messages
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2494
diff
changeset
|
98 echo "Generated $mxedir/src/$pkg-1-fixes.patch" |
2333
f653602a0500
Rebrand to new project name MXE
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
99 } |
f653602a0500
Rebrand to new project name MXE
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
100 |
f653602a0500
Rebrand to new project name MXE
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
101 function import_patch { |
2489
2f3353b7a313
Patch tool: Move environment variable setup to a function.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2488
diff
changeset
|
102 setupEnv |
2492
b48e499007b7
patch tool: check preconditions for import.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2491
diff
changeset
|
103 if [ ! -d $gitsdir/$pkg_subdir ]; then |
b48e499007b7
patch tool: check preconditions for import.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2491
diff
changeset
|
104 echo "Error: $gitsdir/$pkg_subdir does not exist, so cannot import patches. Cancelling import - try 'init' first." >&2 |
b48e499007b7
patch tool: check preconditions for import.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2491
diff
changeset
|
105 exit 1 |
b48e499007b7
patch tool: check preconditions for import.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2491
diff
changeset
|
106 fi |
b48e499007b7
patch tool: check preconditions for import.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2491
diff
changeset
|
107 |
b48e499007b7
patch tool: check preconditions for import.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2491
diff
changeset
|
108 if [ -f $mxedir/src/$pkg-1-fixes.patch ]; then |
b48e499007b7
patch tool: check preconditions for import.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2491
diff
changeset
|
109 cd $gitsdir/$pkg_subdir && \ |
b48e499007b7
patch tool: check preconditions for import.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2491
diff
changeset
|
110 cat $mxedir/src/$pkg-1-fixes.patch | \ |
b48e499007b7
patch tool: check preconditions for import.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2491
diff
changeset
|
111 sed '/^From/,$ !d' | \ |
b48e499007b7
patch tool: check preconditions for import.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2491
diff
changeset
|
112 sed s/'^From: .*'/"From: $author"/'g;' | \ |
b48e499007b7
patch tool: check preconditions for import.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2491
diff
changeset
|
113 git am --keep-cr && \ |
b48e499007b7
patch tool: check preconditions for import.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2491
diff
changeset
|
114 echo "Imported $mxedir/src/$pkg-1-fixes.patch" |
b48e499007b7
patch tool: check preconditions for import.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2491
diff
changeset
|
115 else |
b48e499007b7
patch tool: check preconditions for import.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2491
diff
changeset
|
116 echo "patch-tool managed file $mxedir/src/$pkg-1-fixes.patch not found. Cancelling import." >&2 |
b48e499007b7
patch tool: check preconditions for import.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2491
diff
changeset
|
117 exit 1 |
b48e499007b7
patch tool: check preconditions for import.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2491
diff
changeset
|
118 fi |
2333
f653602a0500
Rebrand to new project name MXE
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
119 } |
f653602a0500
Rebrand to new project name MXE
Volker Grabsch <vog@notjusthosting.com>
parents:
diff
changeset
|
120 |
2488
d9f6c4ade221
Patch tool: replace elifs with case. Also handles errors.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2487
diff
changeset
|
121 case "$cmd" in |
d9f6c4ade221
Patch tool: replace elifs with case. Also handles errors.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2487
diff
changeset
|
122 init) |
d9f6c4ade221
Patch tool: replace elifs with case. Also handles errors.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2487
diff
changeset
|
123 init_git $pkg |
d9f6c4ade221
Patch tool: replace elifs with case. Also handles errors.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2487
diff
changeset
|
124 ;; |
d9f6c4ade221
Patch tool: replace elifs with case. Also handles errors.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2487
diff
changeset
|
125 import) |
d9f6c4ade221
Patch tool: replace elifs with case. Also handles errors.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2487
diff
changeset
|
126 import_patch $pkg |
d9f6c4ade221
Patch tool: replace elifs with case. Also handles errors.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2487
diff
changeset
|
127 ;; |
d9f6c4ade221
Patch tool: replace elifs with case. Also handles errors.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2487
diff
changeset
|
128 export) |
d9f6c4ade221
Patch tool: replace elifs with case. Also handles errors.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2487
diff
changeset
|
129 export_patch $pkg |
d9f6c4ade221
Patch tool: replace elifs with case. Also handles errors.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2487
diff
changeset
|
130 ;; |
d9f6c4ade221
Patch tool: replace elifs with case. Also handles errors.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2487
diff
changeset
|
131 *) |
d9f6c4ade221
Patch tool: replace elifs with case. Also handles errors.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2487
diff
changeset
|
132 echo "Unrecognized command '${cmd}'" >&2 |
d9f6c4ade221
Patch tool: replace elifs with case. Also handles errors.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2487
diff
changeset
|
133 cat <<EOS |
d9f6c4ade221
Patch tool: replace elifs with case. Also handles errors.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2487
diff
changeset
|
134 Usage: $0 COMMAND PACKAGENAME |
d9f6c4ade221
Patch tool: replace elifs with case. Also handles errors.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2487
diff
changeset
|
135 where COMMAND is one of: |
d9f6c4ade221
Patch tool: replace elifs with case. Also handles errors.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2487
diff
changeset
|
136 init - create a git directory for the package with the raw source |
d9f6c4ade221
Patch tool: replace elifs with case. Also handles errors.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2487
diff
changeset
|
137 import - apply the "pkgname-1-fixes.patch" patch commits |
d9f6c4ade221
Patch tool: replace elifs with case. Also handles errors.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2487
diff
changeset
|
138 export - create/replace the "pkgname-1-fixes.patch" patch with a patch of all commits since init. |
d9f6c4ade221
Patch tool: replace elifs with case. Also handles errors.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2487
diff
changeset
|
139 EOS |
d9f6c4ade221
Patch tool: replace elifs with case. Also handles errors.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2487
diff
changeset
|
140 exit 1 |
d9f6c4ade221
Patch tool: replace elifs with case. Also handles errors.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2487
diff
changeset
|
141 ;; |
d9f6c4ade221
Patch tool: replace elifs with case. Also handles errors.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2487
diff
changeset
|
142 esac |
d9f6c4ade221
Patch tool: replace elifs with case. Also handles errors.
Ryan Pavlik <rpavlik@iastate.edu>
parents:
2487
diff
changeset
|
143 |