From ed215096682ca77236f3c7f0cc7ef08f9a3c285c Mon Sep 17 00:00:00 2001 From: Siep Kroonenberg Date: Sat, 26 Apr 2008 09:26:22 +0000 Subject: tl-package-manager.pl: import TLUtils:kpsewhich git-svn-id: svn://tug.org/texlive/trunk@7664 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf/scripts/texlive/tl-package-manager.pl | 41 +++++++++++----------- 1 file changed, 21 insertions(+), 20 deletions(-) (limited to 'Master/texmf') diff --git a/Master/texmf/scripts/texlive/tl-package-manager.pl b/Master/texmf/scripts/texlive/tl-package-manager.pl index c20d35e5b7a..486a608bc21 100755 --- a/Master/texmf/scripts/texlive/tl-package-manager.pl +++ b/Master/texmf/scripts/texlive/tl-package-manager.pl @@ -11,7 +11,7 @@ # - (?) removal does not remove created format files from TEXMFSYSVAR # - other features: dependency check?, ...? # - improve search function -# - cmd +# - cmd # default # sets the options in texlive.tlpdb # done for location @@ -46,6 +46,7 @@ use TeXLive::TLPDB; use TeXLive::TLConfig; use TeXLive::TLMedia; use TeXLive::TLUtils; +TeXLive::TLUtils->import( qw(kpsewhich) ); use Cwd qw/abs_path/; use Getopt::Long; use Pod::Usage; @@ -152,7 +153,7 @@ if ($action =~ m/^generate$/i) { die "Unknown option for generate: $what"; } # should we do some postinst actions? - exit(0); + exit(0); } elsif ($action =~ m/^arch$/i) { my $what = shift; if ($what =~ m/^list$/i) { @@ -176,7 +177,7 @@ if ($action =~ m/^generate$/i) { if (TeXLive::TLUtils::member($a, @already_installed_arch)) { print "Arch $a is already installed\n"; next; - } + } if (!TeXLive::TLUtils::member($a, @available_arch)) { print "Arch $a not available, use 'tlmgr available_archs'!\n"; next; @@ -292,7 +293,7 @@ if ($action =~ m/^generate$/i) { next if ($pkg =~ m/\./); my $t = $tlpdb->get_package($pkg)->shortdesc; $t |= ""; - if (($pkg =~ m/$r/) || ($t =~ m/$r/)) { + if (($pkg =~ m/$r/) || ($t =~ m/$r/)) { $ret .= " $pkg - $t\n"; } } @@ -301,8 +302,8 @@ if ($action =~ m/^generate$/i) { } elsif ($action =~ m/^remove$/i) { # we do the following: # - (not implemented) order collections such that those depending on - # other collections are first removed, and then those which only - # depend on packages. Otherwise + # other collections are first removed, and then those which only + # depend on packages. Otherwise # remove collection-latex collection-latexrecommended # will not succeed # - first loop over all cmd line args and consider only the collections @@ -465,10 +466,10 @@ sub remove_package { # also remove the .tlpobj file push @files, "tlpkg/tlpobj/$pkg.tlpobj"; # and the ones from src/doc splitting - if (-r "tlpkg/tlpobj/$pkg.src.tlpobj") { + if (-r "tlpkg/tlpobj/$pkg.src.tlpobj") { push @files, "tlpkg/tlpobj/$pkg.src.tlpobj"; } - if (-r "tlpkg/tlpobj/$pkg.doc.tlpobj") { + if (-r "tlpkg/tlpobj/$pkg.doc.tlpobj") { push @files, "tlpkg/tlpobj/$pkg.doc.tlpobj"; } my @removals = &removed_dirs (@files); @@ -509,13 +510,13 @@ sub remove_package { } -# +# # return all the directories from which all content will be removed # # idea: # - create a hashes by_dir listing all files that should be removed # by directory, i.e., key = dir, value is list of files -# - for each of the dirs (keys of by_dir and ordered deepest first) +# - for each of the dirs (keys of by_dir and ordered deepest first) # check that all actually contained files are removed # and all the contained dirs are in the removal list. If this is the # case put that directory into the removal list @@ -526,7 +527,7 @@ sub removed_dirs my (@files) = @_; my %removed_dirs; my %by_dir; - + # construct hash of all directories mentioned, values are lists of the # files/dirs in that directory. for my $f (@files) { @@ -537,7 +538,7 @@ sub removed_dirs push (@a, $abs_f); $by_dir{$d} = \@a; } - + # for each of our directories, see if we are removing everything in # the directory. if so, return the directory; else return the # individual files. @@ -545,7 +546,7 @@ sub removed_dirs opendir (DIR, $d) || die "opendir($d) failed: $!"; my @dirents = readdir (DIR); closedir (DIR) || warn "closedir($d) failed: $!"; - + # initialize test hash with all the files we saw in this dir. # (These idioms are due to "Finding Elements in One Array and Not # Another" in the Perl Cookbook.) @@ -558,12 +559,12 @@ sub removed_dirs for my $dirent (@dirents) { next if $dirent =~ /^\.(\.|svn)?$/; # ignore . .. .svn my $item = "$d/$dirent"; # prepend directory for comparison - if ( + if ( ((-d $item) && (defined($removed_dirs{$item}))) || (exists $seen{$item}) ) { - # do nothing + # do nothing } else { $cleandir = 0; last; @@ -584,7 +585,7 @@ tlmgr - the TeX Live Manager =head1 SYNOPSIS -tlmgr ACTION [OPTIONS] ... +tlmgr ACTION [OPTIONS] ... =head1 ACTION @@ -608,7 +609,7 @@ Update all packages if newer ones are available Remove all packages given on the cmdline. Removing a collection will remove all dependencies, too, unless with option B<-no-depends>. -Removing a package which is referenced as a dependency in another +Removing a package which is referenced as a dependency in another collection or scheme will not succeed unless the B<-force> option is given. =item B C> @@ -622,7 +623,7 @@ Possible values for C are: C. (Will be extended). =item B<[xdvi|dvips|pdftex|dvipdfm|dvipdfmx] paper [help|papersize]> -Configures the system wide paper settings, either for all programs in +Configures the system wide paper settings, either for all programs in one go, or for the given program on the command line. =item B @@ -646,7 +647,7 @@ the install media. =item B -Without argument lists all packages available at the default install +Without argument lists all packages available at the default install location, prefixing those already installed with "i ". With arguments lists only collections or schemes. @@ -664,7 +665,7 @@ Uninstalls the TeX Live installation. =item B -Generate language.dat, fmtutil.cnf, and updmap.cfg from a TLPDB and local +Generate language.dat, fmtutil.cnf, and updmap.cfg from a TLPDB and local additions B -- cgit v1.2.3