~ubuntu-branches/ubuntu/karmic/quilt/karmic

« back to all changes in this revision

Viewing changes to quilt/refresh.in

  • Committer: Bazaar Package Importer
  • Author(s): Raphael Hertzog
  • Date: 2008-06-19 21:40:27 UTC
  • mfrom: (4.1.4 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080619214027-so7yis356zayzu1c
Tags: 0.46-6
Change back patchsys-quilt.mk to enter DEB_SRCDIR by default before
applying patches (8 packages FTBFS due to this change). But we can now
use DEB_QUILT_TOPDIR to override the default choice of DEB_SRCDIR.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
usage()
21
21
{
22
 
        printf $"Usage: quilt refresh [-p n] [-u|-U num|-c|-C num] [-f] [--no-timestamps] [--no-index] [--diffstat] [--sort] [--backup] [--strip-trailing-whitespace] [patch]\n"
 
22
        printf $"Usage: quilt refresh [-p n|-p ab] [-u|-U num|-c|-C num] [-f] [--no-timestamps] [--no-index] [--diffstat] [--sort] [--backup] [--strip-trailing-whitespace] [patch]\n"
23
23
 
24
24
        if [ x$1 = x-h ]
25
25
        then
38
38
 
39
39
-p n    Create a -p n style patch (-p0 or -p1 supported).
40
40
 
 
41
-p ab   Create a -p1 style patch, but use a/file and b/file as the
 
42
        original and new filenames instead of the default
 
43
        dir.orig/file and dir/file names.
 
44
 
41
45
-u, -U num, -c, -C num
42
46
        Create a unified diff (-u, -U) with num lines of context. Create
43
47
        a context diff (-c, -C) with num lines of context. The number of
144
148
then
145
149
        opt_strip_level=$(patch_strip_level $patch)
146
150
fi
147
 
if [ $opt_strip_level -gt 1 ]
148
 
then
 
151
case "$opt_strip_level" in
 
152
0 | 1)
 
153
        num_strip_level=$opt_strip_level
 
154
        ;;
 
155
ab)
 
156
        num_strip_level=1
 
157
        ;;
 
158
*)
149
159
        printf $"Cannot refresh patches with -p%s, please specify -p0 or -p1 instead\n" "$opt_strip_level\n" >&2
150
160
        exit 1
151
 
fi
 
161
        ;;
 
162
esac
152
163
 
153
164
trap "die 1" SIGTERM
154
165
 
199
210
# Check for trailing whitespace
200
211
if [ -z "$opt_strip_whitespace" ]
201
212
then
202
 
        $QUILT_DIR/scripts/remove-trailing-ws -n -p$opt_strip_level \
 
213
        $QUILT_DIR/scripts/remove-trailing-ws -n -p$num_strip_level \
203
214
        < $tmp_patch
204
215
else
205
216
        tmp_patch2=$(gen_tempfile)
206
 
        if $QUILT_DIR/scripts/remove-trailing-ws -p$opt_strip_level \
 
217
        if $QUILT_DIR/scripts/remove-trailing-ws -p$num_strip_level \
207
218
                                       < $tmp_patch > $tmp_patch2
208
219
        then
209
220
                rm -f $tmp_patch
232
243
 
233
244
if [ -n "$opt_diffstat" ]
234
245
then
235
 
        diffstat="$(diffstat $QUILT_DIFFSTAT_OPTS -p$opt_strip_level $tmp_patch)" || die 1
 
246
        diffstat="$(diffstat $QUILT_DIFFSTAT_OPTS \
 
247
                             -p$num_strip_level $tmp_patch)" || die 1
236
248
        awk '
237
249
            function print_diffstat(arr, i) {
238
250
              split(diffstat, arr, "\n")
274
286
       mv $patch_file $patch_file~ ) && \
275
287
     cat_to_new_file $patch_file < $tmp_result
276
288
then
 
289
        touch $QUILT_PC/$patch/.timestamp
277
290
        printf $"Refreshed patch %s\n" "$(print_patch $patch)"
278
291
else
279
292
        die 1
280
293
fi
281
294
 
282
 
touch $QUILT_PC/$patch/.timestamp
283
 
 
284
295
rm -f $QUILT_PC/$patch~refresh
285
 
if ! change_db_strip_level -p$opt_strip_level $patch
 
296
if ! change_db_strip_level -p$num_strip_level $patch
286
297
then
287
298
        die 1
288
299
fi