diff options
author | Norbert Preining <preining@logic.at> | 2013-03-21 22:56:08 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2013-03-21 22:56:08 +0000 |
commit | b226ec0fb06c14de1be0ebc54b316ef8a539eb11 (patch) | |
tree | cb55c4f0c977d2aad9c0db86ed5d0c75404d4482 | |
parent | e8cc56a59f892d97cd100d0c0b5099d66ab69e94 (diff) |
fix for tlmgr pinning action with no pinning file present
git-svn-id: svn://tug.org/texlive/trunk@29462 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-x | Master/texmf/scripts/texlive/tlmgr.pl | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/Master/texmf/scripts/texlive/tlmgr.pl b/Master/texmf/scripts/texlive/tlmgr.pl index 2b4131e3d7a..5480276ed5a 100755 --- a/Master/texmf/scripts/texlive/tlmgr.pl +++ b/Master/texmf/scripts/texlive/tlmgr.pl @@ -3522,12 +3522,17 @@ sub action_pinning { } my $pinref = $remotetlpdb->virtual_pindata(); my $pf = $remotetlpdb->virtual_pinning(); - my @pins = @$pinref; if ($what =~ m/^show$/i) { + my @pins = @$pinref; + if (!@pins) { + tlwarn("No pinning data present by now.\n"); + return 0; + } print "Defined pinning data:\n"; for my $p (@pins) { print " ", $p->{'repo'}, ":", $p->{'glob'}, "\n"; } + return 1; } elsif ($what =~ m/^check$/i) { tlwarn("Not implemented yet, sorry!\n"); return 0; @@ -3549,9 +3554,8 @@ sub action_pinning { my $repo = shift @ARGV; if (!defined($repo)) { tlwarn("missing arguments to pinning add\n"); - return; + return 0; } - my $pf = $remotetlpdb->virtual_pinning(); if ($opts{'all'}) { if ($#ARGV >= 0) { tlwarn("no additional argument allowed when --all is given\n"); @@ -3560,7 +3564,7 @@ sub action_pinning { $pf->delete_key($repo); $remotetlpdb->virtual_update_pins(); $pf->save; - return; + return 1; } # complicated case, we want to remove only one setting my @ov = $pf->value($repo); @@ -5255,20 +5259,16 @@ sub init_tlmedia } # now check/setup pinning - # TODO for now no default pinning file! if (!$opts{"pin-file"}) { # check for pinning file in TEXMFLOCAL/tlpkg/pinning.txt chomp (my $TEXMFLOCAL = `kpsewhich -var-value=TEXMFLOCAL`); debug("trying to load pinning file $TEXMFLOCAL/tlpkg/pinning.txt\n"); - if (-r "$TEXMFLOCAL/tlpkg/pinning.txt") { - $opts{"pin-file"} = "$TEXMFLOCAL/tlpkg/pinning.txt"; - } - } - if ($opts{"pin-file"} && -r $opts{"pin-file"}) { - # $pinfile is global var - $pinfile = TeXLive::TLConfFile->new($opts{"pin-file"}, "#", ":", 'multiple'); - $remotetlpdb->virtual_pinning($pinfile); + # since we use TLConfFile it does not matter if the file + # is not existing, it will be treated properly in TLConfFile + $opts{"pin-file"} = "$TEXMFLOCAL/tlpkg/pinning.txt"; } + $pinfile = TeXLive::TLConfFile->new($opts{"pin-file"}, "#", ":", 'multiple'); + $remotetlpdb->virtual_pinning($pinfile); # this "location-url" line should not be changed since GUI programs # depend on it: print "location-url\t$locstr\n" if $::machinereadable; |