diff options
author | Norbert Preining <preining@logic.at> | 2010-10-11 09:08:50 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2010-10-11 09:08:50 +0000 |
commit | eee32eee89e766d89596907354aaf0c1276d8ffd (patch) | |
tree | fee3cf1fd0d30fdae76e3792c4ac6dfdda640980 | |
parent | 1075645c77d13039228bbb90f049881132137682 (diff) |
tlmgr gui improvements for partial updates of main/sub packages:
- the combination:
. main package
. sub package package.ARCH for ARCH in the available_architectures
are considered as a unit,
BUT: sub packages package.ARCH with ARCH NOT in the the available_archs
list are considered as separate packages
(mind that running on i386-linux and having only that installed, one
can still call: tlmgr install luatex.win32!, in this case luatex.win32
would be considered an independent package)
- if an update to the main package is available, mark it as usually
- if an update *only* for the sub package package.ARCH with ARCH in
the list of available_archs is present, then mark it is updated
by changing the revision number AS SHOWN FOR THE main package
on the remote side to NNNNN+ (i.e., adding a "+" sign at the end),
marking that there are depending updates
- if a sub package package.ARCH with ARCH not in the available_archs
list then it is shown and treated as a normal package
git-svn-id: svn://tug.org/texlive/trunk@20056 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf/scripts/texlive/tlmgrgui.pl | 233 |
1 files changed, 125 insertions, 108 deletions
diff --git a/Master/texmf/scripts/texlive/tlmgrgui.pl b/Master/texmf/scripts/texlive/tlmgrgui.pl index a49bbb3ca2d..4a0ea709515 100644 --- a/Master/texmf/scripts/texlive/tlmgrgui.pl +++ b/Master/texmf/scripts/texlive/tlmgrgui.pl @@ -814,6 +814,17 @@ sub update_grid { sub MatchesFilters { my $p = shift; + sub maybe_strip_last_plus { + my $v = shift; + if ($v =~ m/\+$/) { + chop($v); + # just for comparison add one to the version of there is a "+" + $v++; + } + return $v; + } + # we have to take care since strings in revision numbers on the remote + # and might contain "+" indicating sub-package updates # status if (( ($status_value == $status_all) ) || ( ($status_value == $status_only_installed) && @@ -825,7 +836,8 @@ sub MatchesFilters { ( ($status_value == $status_only_updated) && (defined($Packages{$p}{'localrevision'})) && (defined($Packages{$p}{'remoterevision'})) && - ($Packages{$p}{'localrevision'} < $Packages{$p}{'remoterevision'}))) { + ($Packages{$p}{'localrevision'} < + maybe_strip_last_plus($Packages{$p}{'remoterevision'})))) { # do nothing, more checks have to be done } else { return 0; @@ -1589,6 +1601,56 @@ sub reinit_local_tlpdb { } # +# sub populate_Packages +# +sub populate_Packages { + my ($mode, $tlp) = @_; + my $p = $tlp->name; + $Packages{$p}{'displayname'} = $p; + if ($mode eq "local") { + $Packages{$p}{'localrevision'} = $tlp->revision; + $Packages{$p}{'installed'} = 1; + $Packages{$p}{'selected'} = 0; + delete($Packages{$p}{'tlp'}) if defined($Packages{$p}{'tlp'}); + $Packages{$p}{'tlp'} = $tlp; + } else { + $Packages{$p}{'remoterevision'} = $tlp->revision; + $Packages{$p}{'selected'} = 0 + unless defined $Packages{$p}{'selected'}; + if (!defined($Packages{$p}{'tlp'})) { + $Packages{$p}{'tlp'} = $tlp; + } + } + $Packages{$p}{'match_desc'} = "$p\n"; + $Packages{$p}{'match_desc'} .= ($tlp->shortdesc || ""); + $Packages{$p}{'match_desc'} .= "\n"; + $Packages{$p}{'match_desc'} .= ($tlp->longdesc || ""); + my @all_f = $tlp->all_files; + if ($tlp->relocated) { for (@all_f) { s:^$RelocPrefix/:$RelocTree/:; } } + $Packages{$p}{'match_files'} = "@all_f"; + if ($mode eq "local") { + $Packages{$p}{'cb'}->destroy() if defined($Packages{$p}{'cb'}); + $Packages{$p}{'cb'} = $g->Checkbutton(-variable => \$Packages{$p}{'selected'}); + } else { + $Packages{$p}{'cb'} = $g->Checkbutton(-variable => \$Packages{$p}{'selected'}) + unless defined $Packages{$p}{'cb'}; + } + if (($tlp->category eq "Collection") || + ($tlp->category eq "Scheme")) { + $Packages{$p}{'category'} = $tlp->category; + } else { + $Packages{$p}{'category'} = "Other"; + } + if (defined($tlp->cataloguedata->{'version'})) { + if ($mode eq "local") { + $Packages{$p}{'localcatalogueversion'} = $tlp->cataloguedata->{'version'}; + } else { + $Packages{$p}{'remotecatalogueversion'} = $tlp->cataloguedata->{'version'}; + } + } +} + +# # creates/updates the list of packages as shown in tix grid # sub setup_list { @@ -1604,59 +1666,34 @@ sub setup_list { next; } my $tlp = $localtlpdb->get_package($p); - # collect information about that package we will show - $Packages{$p}{'displayname'} = $p; - $Packages{$p}{'localrevision'} = $tlp->revision; - $Packages{$p}{'installed'} = 1; - $Packages{$p}{'selected'} = 0; - delete($Packages{$p}{'tlp'}) if defined($Packages{$p}{'tlp'}); - $Packages{$p}{'tlp'} = $tlp; - $Packages{$p}{'match_desc'} = "$p\n"; - $Packages{$p}{'match_desc'} .= ($tlp->shortdesc || ""); - $Packages{$p}{'match_desc'} .= "\n"; - $Packages{$p}{'match_desc'} .= ($tlp->longdesc || ""); - my @all_f = $tlp->all_files; - if ($tlp->relocated) { for (@all_f) { s:^$RelocPrefix/:$RelocTree/:; } } - $Packages{$p}{'match_files'} = "@all_f"; - $Packages{$p}{'cb'}->destroy() if defined($Packages{$p}{'cb'}); - $Packages{$p}{'cb'} = $g->Checkbutton(-variable => \$Packages{$p}{'selected'}); - if (($tlp->category eq "Collection") || - ($tlp->category eq "Scheme")) { - $Packages{$p}{'category'} = $tlp->category; - } else { - $Packages{$p}{'category'} = "Other"; - } - if (defined($tlp->cataloguedata->{'version'})) { - $Packages{$p}{'localcatalogueversion'} = $tlp->cataloguedata->{'version'}; - } + populate_Packages("local", $tlp); } + my @avail_arch = $localtlpdb->available_architectures; for my $p (@do_later) { - my $s = $p; - $s =~ s!\.[^.]*$!!; - if (!defined($Packages{$s})) { + my ($mp, $ma) = ($p =~ m/^(.*)\.([^.]*)$/); + if (!defined($mp)) { + tlerror("very strange, above it matched and now not anymore?!?! $p\n"); + next; + } + if (!defined($Packages{$mp})) { my $tlp = $localtlpdb->get_package($p); - # collect information about that package we will show - $Packages{$p}{'displayname'} = $p; - $Packages{$p}{'localrevision'} = $tlp->revision; - $Packages{$p}{'installed'} = 1; - $Packages{$p}{'selected'} = 0; - $Packages{$p}{'tlp'} = $tlp; - $Packages{$p}{'match_desc'} = "$p\n"; - $Packages{$p}{'match_desc'} .= ($tlp->shortdesc || ""); - $Packages{$p}{'match_desc'} .= "\n"; - $Packages{$p}{'match_desc'} .= ($tlp->longdesc || ""); - my @all_f = $tlp->all_files; - if ($tlp->relocated) { for (@all_f) { s:^$RelocPrefix/:$RelocTree/:; } } - $Packages{$p}{'match_files'} = "@all_f"; - $Packages{$p}{'cb'} = $g->Checkbutton(-variable => \$Packages{$p}{'selected'}); - if (($tlp->category eq "Collection") || - ($tlp->category eq "Scheme")) { - $Packages{$p}{'category'} = $tlp->category; - } else { - $Packages{$p}{'category'} = "Other"; - } - if (defined($tlp->cataloguedata->{'version'})) { - $Packages{$p}{'localcatalogueversion'} = $tlp->cataloguedata->{'version'}; + populate_Packages("local", $tlp); + } else { + # two cases: + # - $mp.$ma where $ma is in available_archs + # check if $pkg itself has been update present, otherwise + # add a "+" to the revision number of the upstream package + # but do NOT show the sub package + # + # this has to be deferred to later processing as we don't have + # this information at hand at this time + # + # - $pkg.$arch where $arch is NOT in available_arch + # thus it was installed by the user, show it + # + if (!TeXLive::TLUtils::member($ma, @avail_arch)) { + my $tlp = $localtlpdb->get_package($p); + populate_Packages("local", $tlp); } } } @@ -1687,67 +1724,47 @@ sub update_list_remote { next; } my $tlp = $tlmediatlpdb->get_package($p); - $Packages{$p}{'displayname'} = $p; - $Packages{$p}{'remoterevision'} = $tlp->revision; - if (!defined($Packages{$p}{'tlp'})) { - $Packages{$p}{'tlp'} = $tlp; - } - $Packages{$p}{'match_desc'} = "\n$p\n"; - $Packages{$p}{'match_desc'} .= ($tlp->shortdesc || ""); - $Packages{$p}{'match_desc'} .= "\n"; - $Packages{$p}{'match_desc'} .= ($tlp->longdesc || ""); - my @all_f = $tlp->all_files; - if ($tlp->relocated) { for (@all_f) { s:^$RelocPrefix/:$RelocTree/:; } } - $Packages{$p}{'match_files'} = "@all_f"; - ## delete($Packages{$p}{'tlp'}) if defined($Packages{$p}{'tlp'}); - ## $Packages{$p}{'tlp'} = $tlp; - $Packages{$p}{'selected'} = 0 - unless defined $Packages{$p}{'selected'}; - $Packages{$p}{'cb'} = $g->Checkbutton(-variable => \$Packages{$p}{'selected'}) - unless defined $Packages{$p}{'cb'}; - if (($tlp->category eq "Collection") || - ($tlp->category eq "Scheme")) { - $Packages{$p}{'category'} = $tlp->category; - } else { - $Packages{$p}{'category'} = "Other"; - } - if (defined($tlp->cataloguedata->{'version'})) { - $Packages{$p}{'remotecatalogueversion'} = $tlp->cataloguedata->{'version'}; - } + populate_Packages("remote", $tlp); } } + my @avail_arch = $localtlpdb->available_architectures; for my $p (@do_later_media) { - my $s = $p; - $s =~ s!\.[^.]*$!!; - if (!defined($Packages{$s})) { - my $tlp = $tlmediatlpdb->get_package($p); - # collect information about that package we will show - $Packages{$p}{'displayname'} = $p; - $Packages{$p}{'remoterevision'} = $tlp->revision; - if (!defined($Packages{$p}{'tlp'})) { - $Packages{$p}{'tlp'} = $tlp; - } - $Packages{$p}{'match_desc'} = "\n$p\n"; - $Packages{$p}{'match_desc'} .= ($tlp->shortdesc || ""); - $Packages{$p}{'match_desc'} .= "\n"; - $Packages{$p}{'match_desc'} .= ($tlp->longdesc || ""); - my @all_f = $tlp->all_files; - if ($tlp->relocated) { for (@all_f) { s:^$RelocPrefix/:$RelocTree/:; } } - $Packages{$p}{'match_files'} = "@all_f"; - ## disabled, the file lists in remote tlpd contain RELOC - ## $Packages{$p}{'tlp'} = $tlp; - $Packages{$p}{'selected'} = 0 - unless defined $Packages{$p}{'selected'}; - $Packages{$p}{'cb'} = $g->Checkbutton(-variable => \$Packages{$p}{'selected'}) - unless defined $Packages{$p}{'cb'}; - if (($tlp->category eq "Collection") || - ($tlp->category eq "Scheme")) { - $Packages{$p}{'category'} = $tlp->category; + my ($mp, $ma) = ($p =~ m/^(.*)\.([^.]*)$/); + if (!defined($mp)) { + tlerror("very strange, above it matched and now not anymore?!?! $p\n"); + next; + } + my $tlp = $tlmediatlpdb->get_package($p); + if (!defined($Packages{$mp})) { + populate_Packages("remote", $tlp); + } else { + # two cases: + # - $mp.$ma where $ma is in available_archs + # check if $pkg itself has been update present, otherwise + # add a "+" to the revision number of the upstream package + # but do NOT show the sub package + # + if (TeXLive::TLUtils::member($ma, @avail_arch)) { + if (defined($Packages{$mp}{'localrevision'}) && + defined($Packages{$mp}{'remoterevision'}) && + $Packages{$mp}{'localrevision'} < $Packages{$mp}{'remoterevision'}) { + # the main package is updated, so just do nothing + } else { + # if there is an update to a binary sub package mark that with + # a "+" in the remote revision + my $ltlp = $localtlpdb->get_package($p); + if (defined($ltlp) && $ltlp->revision < $tlp->revision) { + $Packages{$mp}{'remoterevision'} .= "+"; + } + } + # - $pkg.$arch where $arch is NOT in available_arch + # thus it was installed by the user, show it + # } else { - $Packages{$p}{'category'} = "Other"; - } - if (defined($tlp->cataloguedata->{'version'})) { - $Packages{$p}{'remotecatalogueversion'} = $tlp->cataloguedata->{'version'}; + # only show that one if it is locally installed + if (defined($Packages{$p})) { + populate_Packages("remote", $tlp); + } } } } |