~ubuntu-branches/ubuntu/trusty/quilt/trusty

« back to all changes in this revision

Viewing changes to .pc/fail_on_missing/quilt/push.in

  • Committer: Package Import Robot
  • Author(s): Martin Quinson
  • Date: 2013-12-09 01:02:14 UTC
  • mfrom: (15.1.13 sid)
  • Revision ID: package-import@ubuntu.com-20131209010214-pv46el3hqhu2m0v2
Tags: 0.61-1
* New upstream release. 
  - Update our patches against this new release; drop accepted ones:
    doc_search_of_patches, default_pager_less-R,
    handling_of_patches_with_column_in_their_name
  - Rename d/p/fix-test-setup to d/p/setup-dont-read-pc: upstream
    setup don't work when our .pc directory changes QUILT_PATCHES to 
    debian/patches. We used to have a little hacky solution, but
    it's not enough anymore, so make it right.

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
        is not actually applied.
53
53
 
54
54
--color[=always|auto|never]
55
 
        Use syntax coloring.
 
55
        Use syntax coloring (auto activates it only if the output is a tty).
56
56
"
57
57
                exit 0
58
58
        else
62
62
 
63
63
interrupt()
64
64
{
65
 
        rollback_patch $1
 
65
        local patch=$1
 
66
 
 
67
        rollback_patch "$patch"
66
68
        printf $"Interrupted by user; patch %s was not applied.\n" \
67
 
               "$(print_patch $patch)" >&2
 
69
               "$(print_patch "$patch")" >&2
68
70
        exit 1
69
71
}
70
72
 
113
115
        local patch=$1 patch_file=$2
114
116
        local output
115
117
 
116
 
        [ -s $patch_file ] || return 0
 
118
        [ -s "$patch_file" ] || return 0
117
119
 
118
 
        set -- patch $QUILT_PATCH_OPTS $(push_patch_args $patch) \
 
120
        set -- patch $QUILT_PATCH_OPTS $(push_patch_args "$patch") \
119
121
                     --backup --prefix="$QUILT_PC/$patch/" \
120
122
                     $no_reject_files -E $more_patch_args
121
123
 
122
124
        if [ "${patch_file:(-3)}" = ".gz" ]
123
125
        then
124
 
                gzip -cd $patch_file | "$@" 2>&1
 
126
                gzip -cd "$patch_file" | "$@" 2>&1
125
127
        elif [ "${patch_file:(-4)}" = ".bz2" ]
126
128
        then
127
 
                bzip2 -cd $patch_file | "$@" 2>&1
 
129
                bzip2 -cd "$patch_file" | "$@" 2>&1
128
130
        elif [ "${patch_file:(-3)}" = ".xz" ]
129
131
        then
130
 
                xz -cd $patch_file | "$@" 2>&1
 
132
                xz -cd "$patch_file" | "$@" 2>&1
131
133
        elif [ "${patch_file:(-5)}" = ".lzma" ]
132
134
        then
133
 
                lzma -cd $patch_file | "$@" 2>&1
 
135
                lzma -cd "$patch_file" | "$@" 2>&1
134
136
        else
135
 
                "$@" -i $patch_file 2>&1
 
137
                "$@" -i "$patch_file" 2>&1
136
138
        fi
137
139
}
138
140
 
140
142
{
141
143
        local patch=$1
142
144
 
143
 
        $QUILT_DIR/scripts/backup-files $silent_unless_verbose -r -B $QUILT_PC/$patch/ -
 
145
        $QUILT_DIR/scripts/backup-files $silent_unless_verbose -r -B "$QUILT_PC/$patch/" -
144
146
}
145
147
 
146
148
cleanup_patch_output() {
172
174
add_patch()
173
175
{
174
176
        local patch=$1
175
 
        local patch_file=$(patch_file_name $patch)
 
177
        local patch_file=$(patch_file_name "$patch")
176
178
        local file status tmp
177
179
 
178
 
        printf $"Applying patch %s\n" "$(print_patch $patch)"
 
180
        printf $"Applying patch %s\n" "$(print_patch "$patch")"
179
181
        trap "interrupt $patch" SIGINT
180
182
 
181
183
        no_reject_files=
182
184
        if [ -z "$opt_leave_rejects" ]; then
183
 
                tmp="$(gen_tempfile)"
 
185
                tmp=$(gen_tempfile)
184
186
                no_reject_files="-r $tmp"
185
187
        fi
186
188
 
187
 
        apply_patch $patch "$patch_file"
 
189
        apply_patch "$patch" "$patch_file"
188
190
        status=$?
189
191
        trap "" SIGINT
190
192
 
191
193
        [ -n "$tmp" ] && rm -f $tmp
192
194
 
193
 
        if [ $status -eq 0 -o \
194
 
             \( $status -eq 1 -a -n "$opt_force" \) ]
 
195
        if [ $status -eq 0 -o -n "$opt_force" ]
195
196
        then
196
 
                add_to_db $patch
 
197
                add_to_db "$patch"
197
198
                if [ $status -eq 0 ]
198
199
                then
199
 
                        rm -f $QUILT_PC/$patch~refresh
 
200
                        rm -f "$QUILT_PC/$patch~refresh"
200
201
                else
201
 
                        touch $QUILT_PC/$patch~refresh
 
202
                        touch "$QUILT_PC/$patch~refresh"
202
203
                fi
203
204
 
204
205
                if [ -e "$QUILT_PC/$patch" ]
205
206
                then
206
 
                        touch $QUILT_PC/$patch/.timestamp
 
207
                        touch "$QUILT_PC/$patch/.timestamp"
207
208
                else
208
209
                        mkdir "$QUILT_PC/$patch"
209
210
                fi
210
211
 
211
 
                if ! [ -e $patch_file ]
 
212
                if ! [ -e "$patch_file" ]
212
213
                then
213
214
                        printf $"Patch %s does not exist; applied empty patch\n" \
214
 
                               "$(print_patch $patch)"
 
215
                               "$(print_patch "$patch")"
215
216
                elif [ -z "$(shopt -s nullglob ; echo "$QUILT_PC/$patch/"*)" ]
216
217
                then
217
218
                        printf $"Patch %s appears to be empty; applied\n" \
218
 
                               "$(print_patch $patch)"
 
219
                               "$(print_patch "$patch")"
219
220
                elif [ $status -ne 0 ]
220
221
                then
221
222
                        printf $"Applied patch %s (forced; needs refresh)\n" \
222
 
                               "$(print_patch $patch)"
 
223
                               "$(print_patch "$patch")"
223
224
                fi
224
225
        else
225
 
                rollback_patch $patch
226
 
                tmp="$(gen_tempfile)"
 
226
                rollback_patch "$patch"
 
227
                tmp=$(gen_tempfile)
227
228
                no_reject_files="-r $tmp"
228
229
                opt_reverse=1
229
 
                if apply_patch $patch "$patch_file" > /dev/null 2> /dev/null
 
230
                if apply_patch "$patch" "$patch_file" > /dev/null 2> /dev/null
230
231
                then
231
232
                        printf $"Patch %s can be reverse-applied\n" \
232
233
                               "$(print_patch "$patch")"
233
234
                else
234
235
                        printf $"Patch %s does not apply (enforce with -f)\n" \
235
 
                               "$(print_patch $patch)"
 
236
                               "$(print_patch "$patch")"
236
237
                fi
237
 
                rollback_patch $patch
 
238
                rollback_patch "$patch"
238
239
                rm -f $tmp
239
240
                status=1
240
241
        fi
247
248
        local top=$(top_patch) n=0 patch
248
249
        if [ -n "$top" ]
249
250
        then
250
 
                patches_after $top
 
251
                patches_after "$top"
251
252
        else
252
253
                cat_series
253
254
        fi \
345
346
 
346
347
if [ $# -eq 1 ]
347
348
then
348
 
        if is_numeric $1
 
349
        if is_numeric "$1"
349
350
        then
350
351
                number=$1
351
352
        else
352
 
                stop_at_patch="$1"
 
353
                stop_at_patch=$1
353
354
        fi
354
355
else
355
356
        [ -z "$opt_all" ] && number=1
371
372
[ -n "$opt_fuzz" ] && more_patch_args="$more_patch_args -F$opt_fuzz"
372
373
 
373
374
top=$(top_patch)
374
 
if [ -n "$top" -a -e $QUILT_PC/$top~refresh ]
 
375
if [ -n "$top" -a -e "$QUILT_PC/$top~refresh" ]
375
376
then
376
377
        printf $"The topmost patch %s needs to be refreshed first.\n" \
377
 
               "$(print_patch $top)"
 
378
               "$(print_patch "$top")"
378
379
        exit 1
379
380
fi
380
381
 
382
383
create_db
383
384
for patch in $patches
384
385
do
385
 
        if ! add_patch $patch
 
386
        if ! add_patch "$patch"
386
387
        then
387
388
                exit 1
388
389
        fi