summaryrefslogtreecommitdiff
path: root/Master/setuptl/TLPM/incl.pm
diff options
context:
space:
mode:
authorStaszek Wawrykiewicz <staw@gust.org.pl>2006-12-27 17:58:42 +0000
committerStaszek Wawrykiewicz <staw@gust.org.pl>2006-12-27 17:58:42 +0000
commit8a7c60c46ef0b8e1eb91b1cfbf28fafa75f6c4f7 (patch)
treec9391cde76a718202b476e95f4f5f7de2fd845c7 /Master/setuptl/TLPM/incl.pm
parent8991be85597c075fe49bd4c860a4f525eaa5441a (diff)
setuptl installers added
git-svn-id: svn://tug.org/texlive/trunk@2984 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/setuptl/TLPM/incl.pm')
-rw-r--r--Master/setuptl/TLPM/incl.pm60
1 files changed, 60 insertions, 0 deletions
diff --git a/Master/setuptl/TLPM/incl.pm b/Master/setuptl/TLPM/incl.pm
new file mode 100644
index 00000000000..a86c20eab39
--- /dev/null
+++ b/Master/setuptl/TLPM/incl.pm
@@ -0,0 +1,60 @@
+# This file belongs to TLPM v2.14, TeX Live Package Manager
+# Public Domain, P.Jackowski@gust.org.pl
+
+# incl <pkg> [-pfer] <mask>
+# display a list of included packages matching <mask>
+
+sub incl
+{
+ local $reg_method = \&string2reg;
+ local $incl_method = \&incl_packages;
+ local $getp_method = \&get_pkg_requires_all;
+ local $getf_method = \&get_pkg_contains_all;
+ my $pkges = $source_pkges;
+ my ($pkg,$arg,$reg);
+ while(defined($arg = shift))
+ {
+ $arg eq '' and next
+ or &no_opt($arg) and (defined $pkg ? $reg = $arg : $pkg = $arg)
+ or &is_opt($arg,'f','files') and $incl_method = \&incl_files
+ or &is_opt($arg,'p','packages') and $incl_method = \&incl_packages
+ or &is_opt($arg,'e','expression') and $reg_method = \&string2preg
+ or &is_opt($arg,'j','justone') and $getp_method = \&get_pkg_requires
+ and $getf_method = \&get_pkg_contains
+ or &is_opt($arg,'r','recurse') and $getp_method = \&get_pkg_requires_all
+ and $getf_method = \&get_pkg_contains_all
+ or &is_opt($arg,'h','help') and return $heeelp -> ('incl')
+ or &rem_opt($arg) and return $error{'wrong_opt'} -> ($arg,'incl --help');
+ }
+ return $error{'pkg_unspec'} -> () if $pkg eq '';
+ eval '$reg = $reg_method -> ($reg)';
+ if($@){return $error{'wrong_reg'} -> ($reg)}
+ return if &read_source();
+ is_pkg($pkg,$pkges) or return $error{'pkg_not_found'} -> ($pkg);
+ $incl_method -> ($pkg,$reg,$pkges);
+}
+
+sub incl_packages
+{
+ my ($pkg,$reg,$pkges) = @_;
+ my $count = 0;
+ $mess -> (grep {/$reg/ and ++$count} $getp_method -> ($pkg,$pkges));
+ $mess -> ("\n");
+ if($tlpm_redir < 2)
+ {
+ $message -> (&one_or_more($count,'package','packages'));
+ }
+}
+
+sub incl_files
+{
+ my ($pkg,$reg,$pkges) = @_;
+ my $count = 0;
+ $mess -> (grep {/$reg/ and ++$count} $getf_method -> ($pkg,$pkges));$mess -> ("\n");
+ if($tlpm_redir < 2)
+ {
+ $message -> ("$count " . ($count == 1 ? "file" : "files"));
+ }
+}
+
+1;