diff options
author | Rafael Garcia-Suarez <rgarciasuarez@mandriva.org> | 2005-08-22 16:54:39 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@mandriva.org> | 2005-08-22 16:54:39 +0000 |
commit | acf8a5ba7f93804774c13f025fa8b4006e5a128a (patch) | |
tree | 41308ff2d91da7d55a5864a9aefb9ab577b62427 | |
parent | 313ec32f516ccce8e2950fc62ead939f7554186f (diff) | |
download | rpmtools-acf8a5ba7f93804774c13f025fa8b4006e5a128a.tar rpmtools-acf8a5ba7f93804774c13f025fa8b4006e5a128a.tar.gz rpmtools-acf8a5ba7f93804774c13f025fa8b4006e5a128a.tar.bz2 rpmtools-acf8a5ba7f93804774c13f025fa8b4006e5a128a.tar.xz rpmtools-acf8a5ba7f93804774c13f025fa8b4006e5a128a.zip |
Use destdir = "." if not specified.
Don't use warnings.
-rw-r--r-- | Packdrakeng.pm | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/Packdrakeng.pm b/Packdrakeng.pm index df5be1f..f3bd344 100644 --- a/Packdrakeng.pm +++ b/Packdrakeng.pm @@ -17,7 +17,6 @@ package Packdrakeng; use strict; -use warnings; use POSIX qw(O_WRONLY O_TRUNC O_CREAT O_RDONLY O_APPEND); (our $VERSION) = q($Id$) =~ /(\d+\.\d+)/; @@ -581,6 +580,7 @@ sub extract { foreach my $f ($pack->sort_files_by_packing(@files)) { my $dest = $destdir ? "$destdir/$f" : "$f"; my ($dir) = $dest =~ m!(.*)/.*!; + $dir ||= "."; if (exists($pack->{dir}{$f})) { -d $dest || mkpath($dest) or $pack->{log}("Unable to create dir $dest: $!"); @@ -593,23 +593,23 @@ sub extract { or $pack->{log}("Unable to extract symlink $f: $!"); next; } elsif (exists($pack->{files}{$f})) { - -d $dir || mkpath($dir) or do { - $pack->{log}("Unable to create dir $dir"); - }; - if (-l $dest) { - unlink($dest) or do { - $pack->{log}("Can't remove link $dest: $!"); - next; # Don't overwrite a file because where the symlink point to - }; - } - sysopen(my $destfh, $dest, O_CREAT | O_TRUNC | O_WRONLY) or do { - $pack->{log}("Unable to extract $dest"); - next; - }; - my $written = $pack->extract_virtual($destfh, $f); - $written == -1 and $pack->{log}("Unable to extract file $f"); - close($destfh); - next; + -d $dir || mkpath($dir) or do { + $pack->{log}("Unable to create dir $dir"); + }; + if (-l $dest) { + unlink($dest) or do { + $pack->{log}("Can't remove link $dest: $!"); + next; # Don't overwrite a file because where the symlink point to + }; + } + sysopen(my $destfh, $dest, O_CREAT | O_TRUNC | O_WRONLY) or do { + $pack->{log}("Unable to extract $dest"); + next; + }; + my $written = $pack->extract_virtual($destfh, $f); + $written == -1 and $pack->{log}("Unable to extract file $f"); + close($destfh); + next; } else { $pack->{log}("Can't find $f in archive"); } |