diff options
author | Piotr Strzelczyk <piotr@eps.gda.pl> | 2010-05-31 22:50:28 +0000 |
---|---|---|
committer | Piotr Strzelczyk <piotr@eps.gda.pl> | 2010-05-31 22:50:28 +0000 |
commit | fc757807dad0bc59fdab26c52da20b1d27fb06bd (patch) | |
tree | cb79b02222b064d00ed53eea92bfffb4c8ab765f /Master | |
parent | 9d53ea527a51f9d0f434b60c80f6e91956b015e4 (diff) |
resolve relative paths from tlpdb wrt tlroot
git-svn-id: svn://tug.org/texlive/trunk@18657 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rwxr-xr-x | Master/texmf/scripts/texlive/tlmgr.pl | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/Master/texmf/scripts/texlive/tlmgr.pl b/Master/texmf/scripts/texlive/tlmgr.pl index 0055cd2ecdf..2243c925415 100755 --- a/Master/texmf/scripts/texlive/tlmgr.pl +++ b/Master/texmf/scripts/texlive/tlmgr.pl @@ -1212,7 +1212,7 @@ sub check_backupdir_selection { } else { # no argument, check for presence in TLPDB init_local_db(1); - $opts{"backupdir"} = $localtlpdb->option("backupdir"); + $opts{"backupdir"} = norm_tlpdb_path($localtlpdb->option("backupdir")); if (!$opts{"backupdir"}) { return (0, "Don't know from where to restore backups.\n"); } @@ -1378,7 +1378,7 @@ sub action_backup { } } else { # no argument, check for presence in TLPDB - $opts{"backupdir"} = $localtlpdb->option("backupdir"); + $opts{"backupdir"} = norm_tlpdb_path($localtlpdb->option("backupdir")); if (!$opts{"backupdir"}) { if ($clean_mode) { tlwarn ("Cannot clean an unknown directory, terminating.\n"); @@ -1882,7 +1882,7 @@ sub action_update { if ($opts{"backup"}) { my $diebackupdir = 0; if (!$opts{"backupdir"}) { - $opts{"backupdir"} = $localtlpdb->option("backupdir"); + $opts{"backupdir"} = norm_tlpdb_path($localtlpdb->option("backupdir")); if ($opts{"backupdir"}) { # check again: $opts{"backupdir"} = abs_path($opts{"backupdir"}); @@ -2904,18 +2904,10 @@ sub action_option { # set new value # here we have to care for some special cases if ($what eq $TLPDBOptions{"location"}->[2]) { - # support "ctan" on the cmd line, and don't abs_path it! + # support "ctan" on the cmd line if ($val =~ m/^ctan$/i) { $val = "$TeXLive::TLConfig::TeXLiveURL"; } - if ($val !~ m!^(http|ftp)://!i) { - # seems to be a local path, try to normalize it - my $testloc = abs_path($val); - # however, if we were given a url, that will get "normalized" - # to the empty string, it not being a path. - # Restore the original value if so. - $val = $testloc if $testloc; - } info("tlmgr: setting default package repository to $val\n"); $localtlpdb->option($opt, $val); } elsif ($what eq $TLPDBOptions{"backupdir"}->[2]) { @@ -4192,7 +4184,7 @@ sub init_local_db { } } # let cmd line options override the settings in localtlpdb - my $loc = $localtlpdb->option("location"); + my $loc = norm_tlpdb_path($localtlpdb->option("location")); if (defined($loc)) { $location = $loc; } @@ -4479,6 +4471,17 @@ sub logpackage } } +# resolve relative paths from tlpdb wrt tlroot +sub norm_tlpdb_path +{ + my ($path) = @_; + $path =~ s!\\!/!; + # just return if absolute path + return $path if ($path =~ m!^/|:!); + init_local_db() unless defined($localtlpdb); + return $localtlpdb->root . "/$path"; +} + # clear the backup dir for $pkg and keep only $autobackup packages # mind that with $autobackup == 0 all packages are cleared sub clear_old_backups |