From 48a7022ca63946e53a0128fccbf8a1cc1c47e419 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Mon, 10 Aug 2009 21:56:50 +0000 Subject: make sure that .ARCH packages are installed *before* the main package, so that when the postaction in the main package is run all files are present git-svn-id: svn://tug.org/texlive/trunk@14607 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf/scripts/texlive/tlmgr.pl | 36 +++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'Master/texmf') diff --git a/Master/texmf/scripts/texlive/tlmgr.pl b/Master/texmf/scripts/texlive/tlmgr.pl index 94ca766312c..e8cbdd9c0b0 100755 --- a/Master/texmf/scripts/texlive/tlmgr.pl +++ b/Master/texmf/scripts/texlive/tlmgr.pl @@ -1784,6 +1784,7 @@ sub action_update { push @new_packs, $pkg; } } + @new_packs = sort packagecmp @new_packs; for my $pkg (@new_packs, @new_colls, @new_schemes) { if ($opts{"no-auto-install"}) { info("not auto-installing $pkg due to -no-auto-install (new on server)\n") @@ -1836,6 +1837,7 @@ sub action_update { push @inst_packs, $pkg; } } + @inst_packs = sort packagecmp @inst_packs; # foreach my $pkg (@inst_packs, @inst_colls, @inst_schemes) { @@ -2114,6 +2116,7 @@ sub action_install { push @inst_packs, $pkg; } } + @inst_packs = sort packagecmp @inst_packs; foreach my $pkg (@inst_packs, @inst_colls, @inst_schemes) { my $re = ""; if (defined($localtlpdb->get_package($pkg))) { @@ -3549,6 +3552,39 @@ sub critical_updates_warning tlwarn("=" x 79, "\n"); } +# +# our compare function for package sorting, which makes sure that +# packages with .ARCH names are sorted *before* the main packages +sub packagecmp { + my $aa = $a; + my $bb = $b; + # remove the part after the . if at all present + $aa =~ s/\..*$//; + $bb =~ s/\..*$//; + if ($aa lt $bb) { + return -1; + } elsif ($aa gt $bb) { + return 1; + } else { + # the parts before the . are the same + # sort the .something *before* the ones without + if ($a eq $aa && $b eq $bb) { + return 0; + } elsif ($a eq $aa) { + # so $a = foobar + # and $b = foobar.something + # this is the special case where we want to invert the order + return 1; + } elsif ($b eq $bb) { + # so $a = foobar.something + # and $b = foobar + return -1; + } else { + return ($a cmp $b); + } + } +} + 1; __END__ -- cgit v1.2.3