1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
|
#!/usr/bin/perl -w
=head1 NAME
dh_quilt_unpatch - unapply patches listed in debian/patches/series
=cut
use strict;
use Debian::Debhelper::Dh_Lib;
=head1 SYNOPSIS
B<dh_quilt_unpatch> [S<I<debhelper options>>]
=head1 DESCRIPTION
dh_quilt_unpatch simply calls B<quilt pop -a> after having set
the environment variable B<QUILT_PATCHES> to B<debian/patches>.
All patches listed in B<debian/patches/series> are then unapplied in the
current directory. The command does not fail if the patches have
already been unapplied.
If the file B<debian/patches/series> does not exist or is empty,
dh_quilt_unpatch returns without doing anything.
You can use another directory instead of B<debian/patches> by setting
(and exporting) the environment variable B<QUILT_PATCH_DIR>.
=head1 EXAMPLES
dh_quilt_unpatch is usually called indirectly in a rules file via the
dh command.
%:
dh $@ --with quilt
It can also be direcly called in the clean rule.
clean:
dh_testdir
dh_testroot
[ ! -f Makefile ] || $(MAKE) clean
dh_quilt_unpatch
dh_clean
=cut
init();
$ENV{"QUILT_PATCHES"} = $ENV{"QUILT_PATCH_DIR"} ?
$ENV{"QUILT_PATCH_DIR"} : "debian/patches";
# Since v0.67, quilt returns the error code 1 instead of 2,
# if the series file does not exist or is empty.
# So check if the series file contains data before
# running quilt to avoid returning an error.
# See Debian bug reports #1030781, #1053444, #1053500 for details.
if ( -s $ENV{"QUILT_PATCHES"} . "/series" ) {
complex_doit('quilt --quiltrc /dev/null pop -a || test $? = 2');
complex_doit('rm -rf .pc');
}
=head1 NOTES
This tool is useless if you use the source package format B<3.0 (quilt)>.
Consider switching to this source format if you haven't done it yet.
=head1 SEE ALSO
L<debhelper(7)>, L<dh(1)>.
This program is meant to be used together with debhelper.
=head1 AUTHOR
Raphael Hertzog <hertzog@debian.org>
=cut
|