Browse Source

Dpkg::Source::Archive/Patch: small tweaks

* scripts/Dpkg/Source/Archive.pm (create): Offer possibility to chdir
before calling tar. This is required to create tar achives that do not
encode the full path to the location of the directory that we want to
integrate.
* scripts/Dpkg/Source/Patch.pm (apply): Make sure to remove
POSIXLY_CORRECT while calling patch to avoid unexpected changes
in his behaviour.
Raphael Hertzog 18 years ago
parent
commit
0b9601ef29
2 changed files with 3 additions and 0 deletions
  1. 2 0
      scripts/Dpkg/Source/Archive.pm
  2. 1 0
      scripts/Dpkg/Source/Patch.pm

+ 2 - 0
scripts/Dpkg/Source/Archive.pm

@@ -37,6 +37,8 @@ sub create {
     my ($self, %opts) = @_;
     my ($self, %opts) = @_;
     $opts{"options"} ||= [];
     $opts{"options"} ||= [];
     my %fork_opts;
     my %fork_opts;
+    # Possibly run tar from another directory
+    $fork_opts{"chdir"} = $opts{"chdir"} if $opts{"chdir"};
     # Redirect input/output appropriately
     # Redirect input/output appropriately
     $fork_opts{"to_handle"} = $self->open_for_write();
     $fork_opts{"to_handle"} = $self->open_for_write();
     $fork_opts{"from_pipe"} = \$self->{'tar_input'};
     $fork_opts{"from_pipe"} = \$self->{'tar_input'};

+ 1 - 0
scripts/Dpkg/Source/Patch.pm

@@ -381,6 +381,7 @@ sub apply {
 	'exec' => [ 'patch', @{$opts{"options"}} ],
 	'exec' => [ 'patch', @{$opts{"options"}} ],
 	'chdir' => $destdir,
 	'chdir' => $destdir,
 	'env' => { LC_ALL => 'C', LANG => 'C' },
 	'env' => { LC_ALL => 'C', LANG => 'C' },
+	'delete_env' => [ 'POSIXLY_CORRECT' ], # ensure expected patch behaviour
 	'wait_child' => 1,
 	'wait_child' => 1,
 	'from_handle' => $diff_handle
 	'from_handle' => $diff_handle
     );
     );