diff options
author | Norbert Preining <preining@logic.at> | 2008-03-29 14:28:19 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2008-03-29 14:28:19 +0000 |
commit | d4eedbeb6301b3ed03a6b6f703020f7dc5dcdc63 (patch) | |
tree | 2e75e7be0a5c8389343b511710f59c3e87dd65d9 /Master/tlpkg/TeXLive/TLPDB.pm | |
parent | 90c3bb4dc0c455df131af548a15d4cf875a86708 (diff) |
too many changes, see email, basically tl.-package-manager work
git-svn-id: svn://tug.org/texlive/trunk@7221 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/TeXLive/TLPDB.pm')
-rw-r--r-- | Master/tlpkg/TeXLive/TLPDB.pm | 115 |
1 files changed, 112 insertions, 3 deletions
diff --git a/Master/tlpkg/TeXLive/TLPDB.pm b/Master/tlpkg/TeXLive/TLPDB.pm index 696342ecf18..19df28c30e6 100644 --- a/Master/tlpkg/TeXLive/TLPDB.pm +++ b/Master/tlpkg/TeXLive/TLPDB.pm @@ -28,6 +28,8 @@ C<TeXLive::TLPDB> -- A database of TeX Live Packages $tlpdb->available_architectures(); $tlpdb->add_tlpcontainer($pkg, $ziploc [, $archrefs [, $dest ]] ); $tlpdb->add_tlpobj($tlpobj); + $tlpdb->needed_by($pkg); + $tlpdb->remove_package($pkg); $tlpdb->get_package("packagename"); $tlpdb->list_packages; $tlpdb->find_file("filename"); @@ -51,8 +53,8 @@ C<TeXLive::TLPDB> -- A database of TeX Live Packages =cut use TeXLive::TLConfig qw($CategoriesRegexp $DefaultCategory $InfraLocation - $DatabaseName); -use TeXLive::TLUtils qw(dirname mkdirhier tllog); + $DatabaseName $MetaCategoriesRegexp); +use TeXLive::TLUtils qw(dirname mkdirhier tllog member); use TeXLive::TLPOBJ; my $_listdir; @@ -103,6 +105,59 @@ sub add_tlpobj { =pod +=item C<< $tlpdb->needed_by($pkg) >> + +Returns an array of package names depending on $pkg. + +=cut + +sub needed_by { + my ($self,$pkg) = @_; + my @ret; + # we only check collections and schemes ... + foreach my $p ($self->list_packages) { + my $tlp = $self->get_package($p); + if ($tlp->category =~ m/$MetaCategoriesRegexp/) { + foreach my $d ($tlp->depends) { + if ($d =~ m/^(.*)\.win32$/) { + if (member("win32", $self->available_architectures)) { + if ($d eq $pkg) { + push @ret, $p; + last; + } + } + } else { + if ($d eq $pkg) { + push @ret, $p; + last; + } + } + } + } + } + return @ret; +} + +=pod + +=item C<< $tlpdb->remove_package($pkg) >> + +Remove the package named C<$pkg> from the tlpdb. Gives a warning if the +package is not present + +=cut + +sub remove_package { + my ($self,$pkg) = @_; + if (defined($self->{'tlps'}{$pkg})) { + delete $self->{'tlps'}{$pkg}; + } else { + warn "Cannot find package $pkg for removal in tlpdb!"; + } +} + +=pod + =item C<< $tlpdb->from_file($filename) >> The C<from_file> function initializes the C<TLPDB> in case the @@ -198,7 +253,7 @@ sub available_architectures { my $self = shift; my @packs = $self->list_packages; my @archs; - map { s@^$tltree/@@ ; push @nf, $_; } @files; + # map { s@^$tltree/@@ ; push @nf, $_; } @files; map { s/^bin-tex\.// ; push @archs, $_ ; } grep(/^bin-tex\.(.*)$/, @packs); return @archs; } @@ -602,6 +657,8 @@ sub config_src_container { return 0; } +=pod + =item C<< $tlpdb->config_doc_container >> Returns 1 if the the texlive config option for doc files splitting on @@ -621,6 +678,8 @@ sub config_doc_container { return 0; } +=pod + =item C<< $tlpdb->config_doc_container >> Returns the currently set default container format. See Options below. @@ -639,6 +698,8 @@ sub config_container_format { return ""; } +=pod + =item C<< $tlpdb->config_release >> Returns the currently set release. See Options below. @@ -659,6 +720,54 @@ sub config_release { =pod +=item C<< $tlpdb->option_XXXXX >> + +Need to be documented + +=cut + +sub _option_value { + my ($self,$key) = @_; + if (defined($self->{'tlps'}{'00texlive-installation.config'})) { + foreach my $d ($self->{'tlps'}{'00texlive-installation.config'}->depends) { + if ($d =~ m!^$key/(.*)$!) { + return "$1"; + } + } + return ""; + } + return; +} +sub _option_setting { + my ($self,$key) = @_; + if (defined($self->{'tlps'}{'00texlive-installation.config'})) { + foreach my $d ($self->{'tlps'}{'00texlive-installation.config'}->depends) { + if ($d =~ m!^$key$!) { + return 1; + } + } + return 0; + } + return; +} + +sub option_symlinks { my $self = shift; return $self->_option_setting("symlinks"); } +sub option_docfiles { my $self = shift; return $self->_option_setting("docfiles"); } +sub option_srcfiles { my $self = shift; return $self->_option_setting("srcfiles"); } +sub option_formats { my $self = shift; return $self->_option_setting("formats"); } +sub option_letter { my $self = shift; return $self->_option_setting("letter"); } +sub option_location { my $self = shift; return $self->_option_value("location"); } +sub option_TEXDIR { my $self = shift; return $self->_option_value("TEXDIR"); } +sub option_TEXMFSYSVAR { my $self = shift; return $self->_option_value("TEXMFSYSVAR"); } +sub option_TEXMFLOCAL { my $self = shift; return $self->_option_value("TEXMFLOCAL"); } +sub option_TEXMFHOME { my $self = shift; return $self->_option_value("TEXMFHOME"); } +sub option_sys_bin { my $self = shift; return $self->_option_value("sys_bin"); } +sub option_sys_man { my $self = shift; return $self->_option_value("sys_man"); } +sub option_sys_info { my $self = shift; return $self->_option_value("sys_info"); } +sub option_platform { my $self = shift; return $self->_option_value("platform"); } + +=pod + =item C<< $tlpdb->fmtutil_cnf_lines >> The function C<fmtutil_cnf_lines> returns the list of a fmtutil.cnf file |