1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
|
Index: tlpkg/TeXLive/TLPDB.pm
===================================================================
--- tlpkg/TeXLive/TLPDB.pm (revision 10798)
+++ tlpkg/TeXLive/TLPDB.pm (working copy)
@@ -33,6 +33,8 @@
$tlpdb->remove_package($pkg);
$tlpdb->get_package("packagename");
$tlpdb->list_packages;
+ $tlpdb->expand_dependencies(["-only-arch",] $totlpdb, @list);
+ $tlpdb->expand_dependencies(["-no-collections",] $totlpdb, @list);
$tlpdb->find_file("filename");
$tlpdb->collections;
$tlpdb->schemes;
@@ -446,6 +448,93 @@
=pod
+=item C<< $tlpdb->expand_dependencies >>
+
+This function takes as first argument the target TLPDB and then a list of
+packages and returns the closure of this
+list with respect to the depends operator. (Sorry, that was for
+mathematicians)
+
+If the very first argument is "-only-arch" then it expands only dependencies
+of the form .ARCH.
+
+=cut
+
+sub expand_dependencies {
+ my $self = shift;
+ my $only_arch = 0;
+ my $no_collections = 0;
+ my $first = shift;
+ my $totlpdb;
+ if ($first eq "-only-arch") {
+ $only_arch = 1;
+ $totlpdb = shift;
+ } elsif ($first eq "-no-collections") {
+ $no_collections = 1;
+ $totlpdb = shift;
+ } else {
+ $totlpdb = $first;
+ }
+ my %install = ();
+ my @archs = $totlpdb->available_architectures;
+ for my $p (@_) {
+ $install{$p} = 1;
+ }
+ my $changed = 1;
+ while ($changed) {
+ $changed = 0;
+ my @pre_select = keys %install;
+ ddebug("pre_select = @pre_select\n");
+ for my $p (@pre_select) {
+ next if ($p =~ m/^00texlive/);
+ my $pkg = $self->get_package($p);
+ if (!defined($pkg)) {
+ tlwarn("W: $p is mentioned somewhere but not available, disabling it!\n");
+ $install{$p} = 0;
+ next;
+ }
+ for my $p_dep ($pkg->depends) {
+ ddebug("checking $p_dep in $p\n");
+ my $tlpdd = $self->get_package($p_dep);
+ if (defined($tlpdd)) {
+ if ($tlpdd->category =~ m/$MetaCategoriesRegexp/) {
+ # we are taking a look at a dependency which is a collection
+ # or scheme, and if the option "-no-collections" is given
+ # we skip that one
+ ddebug("expand_deps: skipping $p_dep in $p due to -no-collections\n");
+ next if $no_collections;
+ }
+ }
+ if ($p_dep =~ m/^(.*)\.ARCH$/) {
+ my $foo = "$1";
+ foreach $a (@archs) {
+ $install{"$foo.$a"} = 1 if defined($self->get_package("$foo.$a"));
+ }
+ } elsif ($p_dep =~ m/^(.*)\.win32$/) {
+ # a win32 package should *only* be installed if we are installing
+ # the win32 arch
+ if (grep(/^win32$/,@archs)) {
+ $install{$p_dep} = 1;
+ }
+ } else {
+ $install{$p_dep} = 1 unless $only_arch;
+ }
+ }
+ }
+
+ # check for newly selected packages
+ my @post_select = keys %install;
+ ddebug("post_select = @post_select\n");
+ ddebug("nr pre select $#pre_select, nr post select $#post_select\n");
+ if ($#pre_select != $#post_select) {
+ $changed = 1;
+ }
+ }
+ return(keys %install);
+}
+
+=pod
+
=item C<< $tlpdb->find_file("filename") >>
The C<find_file> returns a list of packages:filename
Index: tlpkg/TeXLive/TLMedia.pm
===================================================================
--- tlpkg/TeXLive/TLMedia.pm (revision 10798)
+++ tlpkg/TeXLive/TLMedia.pm (working copy)
@@ -89,14 +89,14 @@
# returns a scalar (0) on error
# returns a reference to a hash with actions on success
sub install_package {
- my ($self, $pkg, $totlpdb, $nodepends, $nopostinstall, $fallbackmedia) = @_;
+ my ($self, $pkg, $totlpdb, $nopostinstall, $fallbackmedia) = @_;
my $fromtlpdb = $self->tlpdb;
my $ret;
die("TLMedia not initialized, cannot find tlpdb!") unless (defined($fromtlpdb));
my $tlpobj = $fromtlpdb->get_package($pkg);
if (!defined($tlpobj)) {
if (defined($fallbackmedia)) {
- if ($ret = $fallbackmedia->install_package($pkg,$totlpdb, $nodepends, $nopostinstall)) {
+ if ($ret = $fallbackmedia->install_package($pkg,$totlpdb, $nopostinstall)) {
debug("installed $pkg from fallback");
return $ret;
} else {
@@ -204,37 +204,6 @@
# compute the return value
my %ret;
merge_into(\%ret, $tlpobj->make_return_hash_from_executes("enable"));
- # now install all the depends if they are not already present
- # NOTE: installation of .ARCH dependencies is done in *ANY*CASE*, regardless
- # of the $nodepends setting
- foreach my $d ($tlpobj->depends) {
- if ($d =~ m/^(.*)\.ARCH$/) {
- # we only want to try to install a .ARCH package if it actually contains
- # files
- my $foo = $1;
- foreach my $a ($totlpdb->available_architectures) {
- if (defined($fromtlpdb->get_package("$foo.$a")) &&
- !defined($totlpdb->get_package("$foo.$a"))) {
- merge_into(\%ret,
- $self->install_package("$foo.$a", $totlpdb, $nodepends, $fallbackmedia, 0));
- }
- }
- } elsif ($d =~ m/^(.*).win32$/) {
- # install only of win32 is under the available archs
- if (TeXLive::TLUtils::member("win32",$totlpdb->available_architectures)) {
- merge_into(\%ret,
- $self->install_package($d, $totlpdb, $nodepends, $nopostinstall, $fallbackmedia));
- }
- } else {
- if (!$nodepends) {
- if (!defined($totlpdb->get_package($d))) {
- # we have to install it!
- merge_into(\%ret,
- $self->install_package($d, $totlpdb, $nodepends, $nopostinstall, $fallbackmedia));
- }
- }
- }
- }
if (!$nopostinstall) {
# do the postinstallation actions
if (defined($PostInstall{$pkg})) {
Index: texmf/scripts/texlive/tlmgr.pl
===================================================================
--- texmf/scripts/texlive/tlmgr.pl (revision 10809)
+++ texmf/scripts/texlive/tlmgr.pl (working copy)
@@ -32,6 +32,74 @@
# - move the remove_package function into TLPDB.pm, so that the remove_package
# from TLPDB actually removes the files, too. Maybe some better names
# are necessary.
+#
+#
+# Some documentation I need to remember myself:
+# TLMedia->install_package does ONLY INSTALL ONE PACKAGE, no deps whatsoever
+# anymore!!!! That has all to be done by hand.
+#
+# INSTALL
+#
+# tlmgr install foo bar baz
+# will create the closure under dependencies of {foo,bar,baz}, i.e. all
+# dependencies recursively down to the last package, and install all
+# the packages that are necessary
+#
+# tlmgr install --no-depends foo bar baz
+# will *only* install these three packages (if they are not already installed
+# but it will STILL INSTALL foo.ARCH if they are necessary!!
+#
+# tlmgr install --really-no-depends foo bar baz
+# will absolutely only install these three packages, and will not even
+# take .ARCH deps into account
+#
+# tlmgr install --reinstall ...
+# behaves exactely like without --reinstall BUT the following two
+# differences:
+# . dependencies are not expanded from collection to collection, so
+# if you reinstall a collection then all its dependencies of type
+# Package will be reinstalled, too, but not the dependencies on
+# other collection, because that would force the full reinstallation
+# of the whole installation
+# . it does not care for whether a package seems to be installed or
+# not (that is the --reinstall)
+#
+# REMOVE
+#
+# tlmgr remove foo bar baz
+# will remove the packages foo bar baz itself
+# and will remove all .ARCH dependencies, too
+# and if some of them are collections it will also remove the
+# depending packs which are NOT Collections|Schemes!!!
+# if some of them are referenced somewhere they will not be removed
+# unless --force given
+#
+# tlmgr remove --no-depends foo bar baz
+# will remove the packages foo bar baz itself without any dependencies
+# but it will still remove all .ARCH dependency
+# if some of them are referenced somewhere they will not be removed
+# unless --force given
+#
+# tlmgr remove --really-no-depends foo bar baz
+# willabsolutely only install foo bar baz not even taking .ARCH into
+# account
+#
+# UPDATE
+#
+# tlmgr update foo
+# if foo is of type Package|Documentation it will update only foo
+# and the respective .ARCH dependencies
+# if foo is of type Collection|Scheme it will update itself AND
+# will check all depending packs of type NOT(COllection|Scheme)
+# for necessary updates
+#
+# tlmgr update --no-depends foo
+# as above, but will not check for depends of Collections/Schemes
+# but it will still update .ARCH deps
+#
+# tlmgr update --really-no-depends foo
+# will absolutely only update foo not even taking .ARCH into account
+#
my $svnrev = '$Revision$';
my $tlmgrrevision;
@@ -293,18 +361,6 @@
$localtlpdb->remove_package($pkg);
merge_into(\%ret, $tlp->make_return_hash_from_executes("disable"));
$ret{'mktexlsr'} = 1;
- # remove those bin dependencies .ARCH
- foreach my $d ($tlp->depends) {
- if ($d eq "$pkg.ARCH") {
- foreach my $a ($localtlpdb->available_architectures) {
- if (defined($localtlpdb->get_package("$pkg.$a"))) {
- debug ("remove $pkg.$a\n");
- merge_into(\%ret,
- &remove_package("$pkg.$a", $localtlpdb, $force));
- }
- }
- }
- }
# should we save at each removal???
# advantage: the tlpdb actually reflects what is installed
# disadvantage: removing a collection calls the save routine several times
@@ -319,6 +375,26 @@
return \%ret;
}
+# REMOVE
+#
+# tlmgr remove foo bar baz
+# will remove the packages foo bar baz itself
+# and will remove all .ARCH dependencies, too
+# and if some of them are collections it will also remove the
+# depending packs which are NOT Collections|Schemes!!!
+# if some of them are referenced somewhere they will not be removed
+# unless --force given
+#
+# tlmgr remove --no-depends foo bar baz
+# will remove the packages foo bar baz itself without any dependencies
+# but it will still remove all .ARCH dependency
+# if some of them are referenced somewhere they will not be removed
+# unless --force given
+#
+# tlmgr remove --really-no-depends foo bar baz
+# willabsolutely only install foo bar baz not even taking .ARCH into
+# account
+#
sub action_remove {
if ($opt_gui) {
action_gui("remove");
@@ -340,16 +416,24 @@
#
my %ret;
my $opt_nodepends = 0;
+ my $opt_reallynodepends = 0;
my $opt_force = 0;
my $opt_dry = 0;
Getopt::Long::Configure(qw(no_pass_through));
GetOptions("no-depends" => \$opt_nodepends,
+ "really-no-depends" => \$opt_reallynodepends,
"force" => \$opt_force,
"dry-run" => \$opt_dry) or pod2usage(2);
+ $opt_nodepends = 1 if $opt_reallynodepends;
my %already_removed;
my @more_removal;
init_local_db();
- foreach my $pkg (@ARGV) {
+ my @packs = @ARGV;
+ # remove all .ARCH dependencies, too, unless $opt_reallynodepends
+ @packs = $localtlpdb->expand_dependencies("-only-arch", $localtlpdb, @packs) unless $opt_reallynodepends;
+ # remove deps unless $opt_nodepends
+ @packs = $localtlpdb->expand_dependencies("-no-collections", $localtlpdb, @packs) unless $opt_nodepends;
+ foreach my $pkg (sort @packs) {
my $tlp = $localtlpdb->get_package($pkg);
next if defined($already_removed{$pkg});
if (!defined($tlp)) {
@@ -376,20 +460,6 @@
# remove dependencies, too
merge_into(\%ret, \%foo);
$already_removed{$pkg} = 1;
- if (!$opt_nodepends) {
- foreach my $d ($tlp->depends) {
- my $tlpdd = $localtlpdb->get_package($d);
- if (defined($tlpdd)) {
- if ($tlpdd->category !~ m/$MetaCategoriesRegexp/) {
- info ("remove $d\n");
- if (!$opt_dry) {
- merge_into(\%ret, &remove_package($d, $localtlpdb, $opt_force));
- }
- $already_removed{$d} = 1;
- }
- }
- }
- }
}
} else {
# save all the other packages into the @more_removal list to
@@ -400,7 +470,7 @@
}
}
}
- foreach my $pkg (@more_removal) {
+ foreach my $pkg (sort @more_removal) {
if (!defined($already_removed{$pkg})) {
info ("remove $pkg\n");
if (!$opt_dry) {
@@ -625,6 +695,22 @@
}
+# UPDATE
+#
+# tlmgr update foo
+# if foo is of type Package|Documentation it will update only foo
+# and the respective .ARCH dependencies
+# if foo is of type Collection|Scheme it will update itself AND
+# will check all depending packs of type NOT(COllection|Scheme)
+# for necessary updates
+#
+# tlmgr update --no-depends foo
+# as above, but will not check for depends of Collections/Schemes
+# but it will still update .ARCH deps
+#
+# tlmgr update --really-no-depends foo
+# will absolutely only update foo not even taking .ARCH into account
+#
sub action_update {
if ($opt_gui) {
action_gui("update");
@@ -632,6 +718,7 @@
init_local_db(1);
# initialize the TLMedia from $location
my $opt_nodepends = 0;
+ my $opt_reallynodepends = 0;
my $opt_dry = 0;
my $opt_all = 0;
my $opt_list = 0;
@@ -639,11 +726,13 @@
my $opt_backupdir;
Getopt::Long::Configure(qw(no_pass_through));
GetOptions("no-depends" => \$opt_nodepends,
+ "really-no-depends" => \$opt_reallynodepends,
"all" => \$opt_all,
"list" => \$opt_list,
"no-remove" => \$opt_noremove,
"backupdir=s" => \$opt_backupdir,
"dry-run" => \$opt_dry) or pod2usage(2);
+ $opt_nodepends = 1 if $opt_reallynodepends;
my %ret;
init_tlmedia();
my $mediatlpdb = $tlmediasrc->tlpdb;
@@ -721,7 +810,11 @@
}
my $updater_started = 0;
my $nrupdated = 0;
- foreach my $pkg (@todo) {
+ # update all .ARCH dependencies, too, unless $opt_reallynodepends
+ @todo = $mediatlpdb->expand_dependencies("-only-arch", $localtlpdb, @todo) unless $opt_reallynodepends;
+ # update deps unless $opt_nodepends
+ @todo = $mediatlpdb->expand_dependencies("-no-collections", $localtlpdb, @todo) unless $opt_nodepends;
+ foreach my $pkg (sort @todo) {
next if ($pkg =~ m/^00texlive/);
my $tlp = $localtlpdb->get_package($pkg);
if (!defined($tlp)) {
@@ -832,7 +925,7 @@
# the remove_package should also remove empty dirs in case
# a dir is changed into a file
merge_into(\%ret, &remove_package($pkg, $localtlpdb, 1));
- my $foo = $tlmediasrc->install_package($pkg, $localtlpdb, $opt_nodepends, 0);
+ my $foo = $tlmediasrc->install_package($pkg, $localtlpdb);
if (ref $foo) {
# installation succeeded because we got a reference
merge_into (\%ret, $foo);
@@ -914,6 +1007,32 @@
return(\%ret);
}
+# INSTALL
+#
+# tlmgr install foo bar baz
+# will create the closure under dependencies of {foo,bar,baz}, i.e. all
+# dependencies recursively down to the last package, and install all
+# the packages that are necessary
+#
+# tlmgr install --no-depends foo bar baz
+# will *only* install these three packages (if they are not already installed
+# but it will STILL INSTALL foo.ARCH if they are necessary!!
+#
+# tlmgr install --really-no-depends foo bar baz
+# will absolutely only install these three packages, and will not even
+# take .ARCH deps into account
+#
+# tlmgr install --reinstall ...
+# behaves exactely like without --reinstall BUT the following two
+# differences:
+# . dependencies are not expanded from collection to collection, so
+# if you reinstall a collection then all its dependencies of type
+# Package will be reinstalled, too, but not the dependencies on
+# other collection, because that would force the full reinstallation
+# of the whole installation
+# . it does not care for whether a package seems to be installed or
+# not (that is the --reinstall)
+#
sub action_install {
if ($opt_gui) {
action_gui("install");
@@ -921,19 +1040,41 @@
init_local_db(1);
# initialize the TLMedia from $location
my $opt_nodepends = 0;
+ my $opt_reallynodepends = 0;
my $opt_dry = 0;
+ my $opt_reinstall = 0;
Getopt::Long::Configure(qw(no_pass_through));
GetOptions("no-depends" => \$opt_nodepends,
+ "really-no-depends" => \$opt_reallynodepends,
+ "reinstall" => \$opt_reinstall,
"dry-run" => \$opt_dry) or pod2usage(2);
my %ret;
init_tlmedia();
- foreach my $pkg (@ARGV) {
- if ($opt_dry) {
- print "install: $pkg\n";
- } else {
- # install the packages and run postinstall actions (that is the 0)
+ my $tlmediatlpdb = $tlmediasrc->tlpdb;
+ $opt_nodepends = 1 if $opt_reallynodepends;
+ my @packs = @ARGV;
+ # first expand the .ARCH dependencies unless $opt_reallynodepends
+ @packs = $tlmediatlpdb->expand_dependencies("-only-arch", $localtlpdb, @ARGV) unless $opt_reallynodepends;
+ # now expand all others unless $opt_nodepends
+ # if $opt_reinstall do not collection->collection dependencies
+ if ($opt_reinstall) {
+ @packs = $tlmediatlpdb->expand_dependencies("-no-collections", $localtlpdb, @packs) unless $opt_nodepends;
+ } else {
+ @packs = $tlmediatlpdb->expand_dependencies($localtlpdb, @packs) unless $opt_nodepends;
+ }
+ foreach my $pkg (sort @packs) {
+ if (defined($localtlpdb->get_package($pkg))) {
+ if ($opt_reinstall) {
+ info("re-");
+ } else {
+ debug("already installed: $pkg\n");
+ next;
+ }
+ }
+ info("install: $pkg\n");
+ if (!$opt_dry) {
info("install: $pkg\n");
- merge_into(\%ret, $tlmediasrc->install_package($pkg, $localtlpdb, $opt_nodepends, 0));
+ merge_into(\%ret, $tlmediasrc->install_package($pkg, $localtlpdb));
}
}
if ($opt_dry) {
@@ -1097,7 +1238,7 @@
print "Installing $pkg.$a\n";
} else {
info("install: $pkg.$a\n");
- merge_into(\%ret, $tlmediasrc->install_package("$pkg.$a", $localtlpdb, 0, 0));
+ merge_into(\%ret, $tlmediasrc->install_package("$pkg.$a", $localtlpdb));
}
}
}
@@ -1106,11 +1247,11 @@
if (TeXLive::TLUtils::member('win32', @todoarchs)) {
# install the necessary win32 stuff
info("install: bin-tlperl.win32\n");
- merge_into (\%ret, $tlmediasrc->install_package("bin-tlperl.win32", $localtlpdb, 1, 0));
+ merge_into (\%ret, $tlmediasrc->install_package("bin-tlperl.win32", $localtlpdb));
info("install: bin-tlgs.win32\n");
- merge_into (\%ret, $tlmediasrc->install_package("bin-tlgs.win32", $localtlpdb, 1, 0));
+ merge_into (\%ret, $tlmediasrc->install_package("bin-tlgs.win32", $localtlpdb));
info("install: bin-tlpsv.win32\n");
- merge_into (\%ret, $tlmediasrc->install_package("bin-tlpsv.win32", $localtlpdb, 1, 0));
+ merge_into (\%ret, $tlmediasrc->install_package("bin-tlpsv.win32", $localtlpdb));
}
# update the option_archs list of installed archs
my @larchs = $localtlpdb->option_available_architectures;
Index: tlpkg/bin/tl-update-containers
===================================================================
--- tlpkg/bin/tl-update-containers (revision 10800)
+++ tlpkg/bin/tl-update-containers (working copy)
@@ -56,7 +56,7 @@
chomp(my $Master = `cd $mydir/../.. && pwd`);
my $tlpdb = TeXLive::TLPDB->new("root" => $Master);
die "cannot find tlpdb in $Master" unless defined($tlpdb);
- my @packs = @ARGV ? @ARGV : $tlpdb->list_packages;
+ my @packs = $tlpdb->expand_dependencies("-only-arch", $tlpdb, @ARGV ? @ARGV : $tlpdb->list_packages);
# get configuration of package splitting
my $srcsplit = $tlpdb->config_src_container;
@@ -87,7 +87,7 @@
if ($opt_recreate) {
# remake everything.
if (@ARGV) {
- @todopacks = @ARGV;
+ @todopacks = @packs;
$nettlpdb = TeXLive::TLPDB->new;
die "Cannot create new tlpdb" unless defined($nettlpdb);
} else {
|