|
@@ -47,6 +47,8 @@ sub init_options {
|
|
|
unless exists $self->{'options'}{'include_timestamp'};
|
|
unless exists $self->{'options'}{'include_timestamp'};
|
|
|
$self->{'options'}{'include_binaries'} = 0
|
|
$self->{'options'}{'include_binaries'} = 0
|
|
|
unless exists $self->{'options'}{'include_binaries'};
|
|
unless exists $self->{'options'}{'include_binaries'};
|
|
|
|
|
+ $self->{'options'}{'preparation'} = 1
|
|
|
|
|
+ unless exists $self->{'options'}{'preparation'};
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
sub parse_cmdline_option {
|
|
sub parse_cmdline_option {
|
|
@@ -60,6 +62,9 @@ sub parse_cmdline_option {
|
|
|
} elsif ($opt =~ /^--include-binaries$/) {
|
|
} elsif ($opt =~ /^--include-binaries$/) {
|
|
|
$self->{'options'}{'include_binaries'} = 1;
|
|
$self->{'options'}{'include_binaries'} = 1;
|
|
|
return 1;
|
|
return 1;
|
|
|
|
|
+ } elsif ($opt =~ /^--no-preparation$/) {
|
|
|
|
|
+ $self->{'options'}{'preparation'} = 0;
|
|
|
|
|
+ return 1;
|
|
|
}
|
|
}
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
@@ -163,6 +168,8 @@ sub get_patches {
|
|
|
sub apply_patches {
|
|
sub apply_patches {
|
|
|
my ($self, $dir, $skip_auto) = @_;
|
|
my ($self, $dir, $skip_auto) = @_;
|
|
|
my $timestamp = time();
|
|
my $timestamp = time();
|
|
|
|
|
+ my $applied = File::Spec->catfile($dir, "debian", "patches", ".dpkg-source-applied");
|
|
|
|
|
+ open(APPLIED, '>', $applied) || syserr(_g("cannot write %s"), $applied);
|
|
|
foreach my $patch ($self->get_patches($dir, $skip_auto)) {
|
|
foreach my $patch ($self->get_patches($dir, $skip_auto)) {
|
|
|
my $path = File::Spec->catfile($dir, "debian", "patches", $patch);
|
|
my $path = File::Spec->catfile($dir, "debian", "patches", $patch);
|
|
|
info(_g("applying %s"), $patch) unless $skip_auto;
|
|
info(_g("applying %s"), $patch) unless $skip_auto;
|
|
@@ -170,7 +177,9 @@ sub apply_patches {
|
|
|
$patch_obj->apply($dir, force_timestamp => 1,
|
|
$patch_obj->apply($dir, force_timestamp => 1,
|
|
|
timestamp => $timestamp,
|
|
timestamp => $timestamp,
|
|
|
add_options => [ '-E' ]);
|
|
add_options => [ '-E' ]);
|
|
|
|
|
+ print APPLIED "$patch\n";
|
|
|
}
|
|
}
|
|
|
|
|
+ close(APPLIED);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
sub can_build {
|
|
sub can_build {
|
|
@@ -188,21 +197,32 @@ sub prepare_build {
|
|
|
include_removal => $self->{'options'}{'include_removal'},
|
|
include_removal => $self->{'options'}{'include_removal'},
|
|
|
include_timestamp => $self->{'options'}{'include_timestamp'},
|
|
include_timestamp => $self->{'options'}{'include_timestamp'},
|
|
|
};
|
|
};
|
|
|
|
|
+ push @{$self->{'options'}{'tar_ignore'}}, "debian/patches/.dpkg-source-applied";
|
|
|
|
|
+ $self->check_patches_applied($dir) if $self->{'options'}{'preparation'};
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-sub do_build {
|
|
|
|
|
|
|
+sub check_patches_applied {
|
|
|
my ($self, $dir) = @_;
|
|
my ($self, $dir) = @_;
|
|
|
- my @argv = @{$self->{'options'}{'ARGV'}};
|
|
|
|
|
- my @tar_ignore = map { "--exclude=$_" } @{$self->{'options'}{'tar_ignore'}};
|
|
|
|
|
- my $include_binaries = $self->{'options'}{'include_binaries'};
|
|
|
|
|
|
|
+ my $applied = File::Spec->catfile($dir, "debian", "patches", ".dpkg-source-applied");
|
|
|
|
|
+ unless (-e $applied) {
|
|
|
|
|
+ warning(_g("patches have not been applied, applying them now (use --no-preparation to override)"));
|
|
|
|
|
+ $self->apply_patches($dir);
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
|
|
+sub do_build {
|
|
|
|
|
+ my ($self, $dir) = @_;
|
|
|
my ($dirname, $updir) = fileparse($dir);
|
|
my ($dirname, $updir) = fileparse($dir);
|
|
|
|
|
+ my @argv = @{$self->{'options'}{'ARGV'}};
|
|
|
if (scalar(@argv)) {
|
|
if (scalar(@argv)) {
|
|
|
usageerr(_g("-b takes only one parameter with format `%s'"),
|
|
usageerr(_g("-b takes only one parameter with format `%s'"),
|
|
|
$self->{'fields'}{'Format'});
|
|
$self->{'fields'}{'Format'});
|
|
|
}
|
|
}
|
|
|
$self->prepare_build($dir);
|
|
$self->prepare_build($dir);
|
|
|
|
|
|
|
|
|
|
+ my $include_binaries = $self->{'options'}{'include_binaries'};
|
|
|
|
|
+ my @tar_ignore = map { "--exclude=$_" } @{$self->{'options'}{'tar_ignore'}};
|
|
|
|
|
+
|
|
|
my $sourcepackage = $self->{'fields'}{'Source'};
|
|
my $sourcepackage = $self->{'fields'}{'Source'};
|
|
|
my $basenamerev = $self->get_basename(1);
|
|
my $basenamerev = $self->get_basename(1);
|
|
|
my $basename = $self->get_basename();
|
|
my $basename = $self->get_basename();
|