[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#701819: lintian: [reporting] Hard to interpret/ambiguous numbers



On 2013-02-27 15:33, Niels Thykier wrote:
> Package: lintian
> Version: 2.5.11
> Severity: minor
> 
> The front page on lintian.d.o has the following entries in its
> "statistics" table.
> 
> """
>    Maintainers: 	2301 (+1)
>    Source packages: 	17530 (-1)
>    Binary packages: 	32288 (+3)
>    μdeb packages: 	119 (+1)
> """
> 
> If you do not know the code, it is hard to tell that this is in fact
> *NOT* the actual number of packages on lintian.d.o.
>   No, these numbers are based on the packages that emit 1 (or more)
> lintian tags.  For comparison, the actual number of source and binary
> packages are closer to 20000 and 40000 (respectively) than the numbers
> listed above.
> 
> 
> [...]

Attached is two patches that adds the total number of packages (and
maintainers).  With the patches, this part of the table now looks like[1]:

"""
Maintainers:    	2190 (+0) 	2281 (+0)
Source packages: 	13514 (+0) 	18422 (+0)
Binary packages: 	29989 (+0) 	38824 (+0)
μdeb packages:  	86 (+0) 	439 (+0)
"""

There is still no explanation of the numbers; perhaps the table should
be split and we could use <th> tags to explain the contents of the tables?

No needs on the second part of this (and accordingly no "patch" tag).

~Niels

[1] Disclaimer: result is from a very old partial snapshot of the
laboratory from lintian.d.o, so the numbers themselves do not reflect
the actual state.


From fabc7d5953bc7749057bd6f910fa476b25e85f0c Mon Sep 17 00:00:00 2001 From: Niels Thykier Date: Sun, 3 Mar 2013 11:28:05 +0100 Subject: [PATCH 1/2] L::Lab(::Manifest): Add method to determine package count Add methods to determine the number of packages (by type) in the Lab. Signed-off-by: Niels Thykier --- lib/Lintian/Lab.pm | 28 ++++++++++++++++++++++++++++ lib/Lintian/Lab/Manifest.pm | 10 +++++++++- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/lib/Lintian/Lab.pm b/lib/Lintian/Lab.pm index 5bf2500..affa6ec 100644 --- a/lib/Lintian/Lab.pm +++ b/lib/Lintian/Lab.pm @@ -450,6 +450,34 @@ sub visit_packages { } } +=item count_packages (TYPE) + +Returns the number of packages of the given TYPE. + +=cut + +sub count_packages { + my ($self, $rtype) = @_; + my $size = 0; + + croak "Missing TYPE argument" + unless defined $rtype; + + return $self->_get_lab_index ($rtype)->size + if exists $SUPPORTED_TYPES{$rtype}; + + croak "Unknown package type: \"$rtype\"" + unless exists $SUPPORTED_VIEWS{$rtype} or $rtype eq 'ALL'; + + # Side-effect, ensures all real types are loaded, so check view + # sizes after the loop. + foreach my $t (keys %SUPPORTED_TYPES) { + $size += $self->_get_lab_index ($t); + } + + return $size if $rtype eq 'ALL'; + return $self->_get_lab_index ($rtype)->size; +} # Non-API method used by reporting to look up the manifest data via the Lab # rather than bypassing it. diff --git a/lib/Lintian/Lab/Manifest.pm b/lib/Lintian/Lab/Manifest.pm index 3fd3575..8de1e35 100644 --- a/lib/Lintian/Lab/Manifest.pm +++ b/lib/Lintian/Lab/Manifest.pm @@ -162,6 +162,7 @@ sub new { 'type' => $pkg_type, 'dirty' => 0, 'state' => {}, + 'size' => 0, 'grouping' => $grouping, }; bless $self, $class; @@ -189,7 +190,7 @@ Returns the type of packages that this manifest has information about. # For some reason these getters seem to just return "undef", so they # have been added manually below. (not sure if this is a usage error # or a bug in Class::Accessor) -#Lintian::Lab::Manifest->mk_ro_accessors (qw(dirty type)); +#Lintian::Lab::Manifest->mk_ro_accessors (qw(dirty type size)); sub dirty { my ($self) = @_; @@ -201,6 +202,11 @@ sub type { return $self->{'type'}; } +sub size { + my ($self) = @_; + return $self->{'size'}; +} + =item read_list (FILE) Reads a manifest from FILE. Any records already in the manifest will @@ -444,6 +450,7 @@ sub _do_delete { if (defined $hash && exists $hash->{$lk}) { my $entry = delete $hash->{$lk}; $self->_mark_dirty(1); + $self->{'size'}--; if (my $grouping = $self->{'grouping'}) { my @keys = ($entry->{'source'}, $entry->{'source-version'}, $entry->{'identifier'}); @@ -611,6 +618,7 @@ sub _do_set { $cur = $element; } $k = $entry->{$qf->[$qfl]}; + $self->{'size'}++ unless exists $cur->{$k}; $cur->{$k} = $entry; if (my $grouping = $self->{'grouping'}) { $grouping->_do_set ($grouping->{'state'}, \@GROUP_QUERY, $entry); -- 1.7.10.4 From cb58e0f80ee17e42ae9d7659bdf5a27a6585882f Mon Sep 17 00:00:00 2001 From: Niels Thykier Date: Wed, 27 Feb 2013 15:56:01 +0100 Subject: [PATCH 2/2] reporting: Show total count for pkgs and maintainers Show the total number of packages (by type) and maintainers next to the number of packages (and the number of maintainers of these) that has at least one lintian tag. Signed-off-by: Niels Thykier --- reporting/html_reports | 10 +++++++++- reporting/templates/index.tmpl | 36 ++++++++++++++++++++---------------- 2 files changed, 29 insertions(+), 17 deletions(-) diff --git a/reporting/html_reports b/reporting/html_reports index 09642f4..9a26060 100755 --- a/reporting/html_reports +++ b/reporting/html_reports @@ -321,6 +321,12 @@ $source_info->visit_all (sub { $clean{$id} = $maintainer; }); +$statistics{'total-maintainers'} = scalar keys %clean; + +for my $type (qw(binary source udeb)) { + $statistics{"total-$type-packages"} = $LAB->count_packages ($type); +} + # Done with the lab and its metadata $LAB->close; undef $LAB; @@ -552,7 +558,9 @@ if (-f $statistics_file) { } my %delta; my @attrs = qw(maintainers source-packages binary-packages udeb-packages - errors warnings info experimental pedantic overridden); + errors warnings info experimental pedantic overridden + total-maintainers total-source-packages total-binary-packages + total-udeb-packages); for my $attr (@attrs) { my $old = $old_statistics->{$attr} || 0; $statistics{$attr} ||= 0; diff --git a/reporting/templates/index.tmpl b/reporting/templates/index.tmpl index d338e37..edd475f 100644 --- a/reporting/templates/index.tmpl +++ b/reporting/templates/index.tmpl @@ -45,40 +45,44 @@

Statistics

- - - - - - - - - + + + + + + + + + + + + + - + - + - + - + - + - + - +
Last updated: {$timestamp}
Archive timestamp:{$mirror}
Distribution: {$dist}
Archive area: {$area}
Architecture: {$architecture}
Maintainers: {$delta{maintainers}}
Source packages: {$delta{'source-packages'}}
Binary packages: {$delta{'binary-packages'}}
μdeb packages: {$delta{'udeb-packages'}}
Last updated: {$timestamp}
Archive timestamp:{$mirror}
Distribution: {$dist}
Archive area: {$area}
Architecture: {$architecture}
Maintainers: {$delta{maintainers}}{$delta{'total-maintainers'}}
Source packages: {$delta{'source-packages'}}{$delta{'total-source-packages'}}
Binary packages: {$delta{'binary-packages'}}{$delta{'total-binary-packages'}}
μdeb packages: {$delta{'udeb-packages'}}{$delta{'total-udeb-packages'}}
E Errors:{$delta{errors}}{$delta{errors}}
W Warnings:{$delta{warnings}}{$delta{warnings}}
I Info tags:{$delta{info}}{$delta{info}}
P Pedantic tags:{$delta{pedantic}}{$delta{pedantic}}
O Overridden tags:{$delta{overridden}}{$delta{overridden}}
X Experimental tags:{$delta{experimental}}{$delta{experimental}}
Lintian version: {$version}
Lintian version: {$version}

-- 1.7.10.4


Reply to: