diff options
author | atatat <atatat@pkgsrc.org> | 2003-04-30 03:16:06 +0000 |
---|---|---|
committer | atatat <atatat@pkgsrc.org> | 2003-04-30 03:16:06 +0000 |
commit | 8050c6cfffcebb0f79adbe5e5c6dcdae49734913 (patch) | |
tree | 117c3779b98edd282451bfcb64dbc9e1ab4ce944 /pkgtools | |
parent | de4d36d9e7a80ba58514e46b23d1145fe606d158 (diff) | |
download | pkgsrc-8050c6cfffcebb0f79adbe5e5c6dcdae49734913.tar.gz |
Add some code to the "stored database" to deal with counting packages
that have multiple versions (eg, apache or emacs), so that the number
of packages loaded when generating the database will match the number
loaded from the database afterwards.
Curiously, reorganizing the code a little makes the stored database
about 20-25% smaller.
Old stored databases are still completely supported.
Jump to version 3.53.
Diffstat (limited to 'pkgtools')
-rw-r--r-- | pkgtools/pkglint/Makefile | 4 | ||||
-rwxr-xr-x | pkgtools/pkglint/files/lintpkgsrc.pl | 33 |
2 files changed, 29 insertions, 8 deletions
diff --git a/pkgtools/pkglint/Makefile b/pkgtools/pkglint/Makefile index 080d4a32a3e..8701f1cc5dd 100644 --- a/pkgtools/pkglint/Makefile +++ b/pkgtools/pkglint/Makefile @@ -1,7 +1,7 @@ -# $NetBSD: Makefile,v 1.158 2003/04/22 10:18:22 wiz Exp $ +# $NetBSD: Makefile,v 1.159 2003/04/30 03:16:06 atatat Exp $ # -DISTNAME= pkglint-3.52 +DISTNAME= pkglint-3.53 WRKSRC= ${WRKDIR} CATEGORIES= pkgtools devel MASTER_SITES= # empty diff --git a/pkgtools/pkglint/files/lintpkgsrc.pl b/pkgtools/pkglint/files/lintpkgsrc.pl index bcd81d9b294..2f323cc2938 100755 --- a/pkgtools/pkglint/files/lintpkgsrc.pl +++ b/pkgtools/pkglint/files/lintpkgsrc.pl @@ -1,6 +1,6 @@ #!@PREFIX@/bin/perl -# $NetBSD: lintpkgsrc.pl,v 1.76 2003/03/27 05:16:12 atatat Exp $ +# $NetBSD: lintpkgsrc.pl,v 1.77 2003/04/30 03:16:07 atatat Exp $ # Written by David Brownlee <abs@netbsd.org>. # @@ -1278,7 +1278,8 @@ sub scan_pkgsrc_distfiles_vs_distinfo sub load_pkgsrc_makefiles { open(STORE, "<$_[0]") || die("Cannot read pkgsrc store from $_[0]: $!\n"); - my ($pkgver, $pkgcnt, $pkgnum); + my ($pkgver); + our ($pkgcnt, $pkgnum, $subpkgcnt, $subpkgnum); $pkglist = new PkgList; while (<STORE>) { eval $_; } @@ -1289,6 +1290,10 @@ sub store_pkgsrc_makefiles { open(STORE, ">$_[0]") || die("Cannot save pkgsrc store to $_[0]: $!\n"); my $was = select(STORE); + print('sub __pkgcount { $subpkgnum += $_[0]; ', + 'verbose("\rReading pkgsrc database: ', + '$pkgnum / $pkgcnt ($subpkgnum / $subpkgcnt) pkgs"); }', + "\n"); $pkglist->store; print("verbose(\"...done\\n\");\n"); select($was); @@ -1401,10 +1406,21 @@ sub store { my $self = shift; my @pkgs = keys %{$self->{_pkgs}}; - print("\$pkgcnt = ", scalar(@pkgs), ";\n"); + my ($cnt, $subcnt) = $self->count; + print("\$pkgcnt = $cnt;\n"); + print("\$subpkgcnt = $subcnt;\n"); map($self->{_pkgs}{$_}->store, keys %{$self->{_pkgs}}); } +sub count + { + my $self = shift; + my ($pkgcnt, $pkgsubcnt); + map({ $pkgcnt++; $pkgsubcnt += $self->{_pkgs}{$_}->count; } + keys %{$self->{_pkgs}}); + wantarray ? ($pkgcnt, $pkgsubcnt) : $pkgcnt; + } + # Pkgs is all versions of a given package (eg: apache-1.x and apache-2.x) # package Pkgs; @@ -1458,11 +1474,15 @@ sub store { my $self = shift; print("\$pkgnum++;\n"); - print("verbose(\"\\rReading pkgsrc database: ", - "\$pkgnum / \$pkgcnt pkgs\");\n"); map($self->{_pkgver}{$_}->store, keys %{$self->{_pkgver}}); } +sub count + { + my $self = shift; + scalar(keys %{$self->{_pkgver}}); + } + # PkgVer is a unique package+version # package PkgVer; @@ -1513,7 +1533,8 @@ sub store { my $self = shift; my $data; - print("\$pkgver = \$pkglist->add(\"$self->{_pkg}\", \"$self->{_ver}\");\n"); + print("\$pkgver = \$pkglist->add(\"$self->{_pkg}\", \"$self->{_ver}\"); "); + print("__pkgcount(1);\n"); foreach ($self->vars) { ($data = $self->{$_}) =~ s/([\\\$\@\%\"])/\\$1/g; |