Use perl realpath support and drop dependency.

git-svn-id: http://emdebian.org/svn/current@7887 563faec7-e20c-0410-992a-a66f704d0ccd
This commit is contained in:
codehelp 2011-03-10 09:50:32 +00:00
parent aaa99546e3
commit c9df51e62d
4 changed files with 17 additions and 27 deletions

6
debian/changelog vendored
View file

@ -1,3 +1,9 @@
multistrap (2.1.14) unstable; urgency=low
* Use perl realpath support and drop dependency.
-- Neil Williams <codehelp@debian.org> Thu, 10 Mar 2011 09:49:07 +0000
multistrap (2.1.13) unstable; urgency=low
* [INTL:da] Danish translation of multistrap (Closes: #614306)

2
debian/control vendored
View file

@ -13,7 +13,7 @@ Vcs-Svn: http://buildd.emdebian.org/repos/current/
Package: multistrap
Section: admin
Architecture: all
Depends: ${perl:Depends}, ${misc:Depends}, apt, realpath,
Depends: ${perl:Depends}, ${misc:Depends}, apt,
libconfig-auto-perl, libparse-debian-packages-perl
Recommends: emdebian-archive-keyring
Suggests: fakeroot

View file

@ -17,6 +17,7 @@
use strict;
use warnings;
use Cwd qw (realpath);
use File::Basename;
use POSIX qw(locale_h);
use Locale::gettext;
@ -41,13 +42,7 @@ if ($e !~ /\nFAKEROOTKEY=[0-9]+\n/) {
} else {
$fakeroot="";
}
# cope with people getting things wrong from local SVN (not a translated string).
if (dirname($0) ne "/usr/sbin/") {
print "checking realpath\n";
my $realpath = `which realpath`;
chomp ($realpath);
die ("ERR: Please install realpath.\n") if (not -x ($realpath));
}
while( @ARGV ) {
$_= shift( @ARGV );
last if m/^--$/;
@ -61,8 +56,7 @@ while( @ARGV ) {
$file = shift(@ARGV);
} elsif (/^(-d|--dir)$/) {
$dir = shift(@ARGV);
$dir = `realpath $dir`;
chomp($dir);
$dir = realpath ($dir);
} elsif (/^(-n|--dry-run)$/) {
$dry++;
} elsif (/^(--no-fakeroot)$/) {
@ -83,7 +77,7 @@ close (TABLE);
my $ret = 0;
if (not defined $dry) {
$ret = mkdir ("$dir") if (not -d "$dir");
$dir = `realpath $dir`;
$dir = realpath ($dir);
chomp ($dir);
$dir .= ($dir =~ m:/$:) ? '' : "/";
chdir ($dir);

View file

@ -19,6 +19,7 @@ use strict;
use warnings;
use IO::File;
use Config::Auto;
use Cwd qw (realpath);
use File::Basename;
use Parse::Debian::Packages;
use POSIX qw(locale_h);
@ -78,13 +79,6 @@ die ($msg)
if (not defined $file);
undef ($msg);
# cope with people getting things wrong from local SVN (not a translated string).
if (dirname($0) ne "/usr/sbin/") {
print "checking realpath\n";
my $realpath = `which realpath`;
chomp ($realpath);
die ("ERR: Please install realpath.\n") if (not -x ($realpath));
}
$cachedir = "var/cache/apt/"; # archives
$libdir = "var/lib/apt/"; # lists
$etcdir = "etc/apt/"; # sources
@ -164,8 +158,7 @@ if (not -d "$dir") {
my $msg = sprintf (_g("Unable to create directory '%s'"),$dir);
die "$progname: $msg\n" if ($ret != 0);
}
$dir = `realpath $dir 2>/dev/null`;
chomp ($dir);
$dir = realpath ($dir);
$dir .= ($dir =~ m:/$:) ? '' : "/";
system ("mkdir -p ${dir}${cachedir}") if (not -d "${dir}${cachedir}");
system ("mkdir -p ${dir}${libdir}") if (not -d "${dir}${libdir}");
@ -443,8 +436,7 @@ if (defined $tgzname) {
printf (_g("\nRemoving build directory: '%s'\n"), $dir);
system ("rm -rf $dir/*");
}
my $final_path=`realpath $dir/../$tgzname`;
chomp ($final_path);
my $final_path=realpath ("$dir/../$tgzname");
if (not defined $warn_count) {
printf (_g("\nMultistrap system packaged successfully as '%s'.\n"), $final_path);
} else {
@ -1013,8 +1005,7 @@ sub cascade {
my @p = split(' ', lc($keys{$section}{'debconfseed'}))
if (defined $keys{$section}{'debconfseed'});
foreach my $f (@p) {
my $fl = `realpath $f 2>/dev/null`;
chomp($fl);
my $fl = realpath ($f);
next if ($fl eq "");
next if (not -f $fl);
chomp ($fl);
@ -1027,8 +1018,7 @@ sub cascade {
my @hookfiles=grep(!m:\.\.?$:, readdir HOOKS);
closedir(HOOKS);
foreach my $hf (@hookfiles) {
my $fl = `realpath $f/$hf 2>/dev/null`;
chomp ($fl);
my $fl = realpath ("$f/$hf");
next if (($fl eq "") or (not -f $fl) or (not -x $fl));
push (@{$hooks{'A'}}, $fl) if ($hf =~ /^completion/);
push (@{$hooks{'D'}}, $fl) if ($hf =~ /^download/);
@ -1046,7 +1036,7 @@ sub cascade {
foreach my $inc (@i) {
# look for the full filepath or try same directory as current conf.
if (not -f $inc) {
$chk = `realpath $cfgdir/$inc 2>/dev/null`;
$chk = realpath ("$cfgdir/$inc");
chomp ($chk) if (defined $chk);
$inc = $chk if (-f $chk);
}