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

[SCM] Debian package checker branch, master, updated. 1.24.4-116-g35bb1ea



The following commit has been merged in the master branch:
commit c0489abba552bfe9ed731d9e5db552905d5fd1f3
Author: Niko Tyni <ntyni@debian.org>
Date:   Wed Sep 10 21:39:46 2008 +0300

    Incorporate static data about packages in the Perl core
    
    The new file, data/fields/perl-provides, contains information on
    modules included in the Perl core packages that also have a separate
    binary package available.
    
    The 'refresh-perl-provides' target in debian/rules provides a way to
    semi-automatically refresh the data, and the 'build' target issues
    a warning if the data is clearly stale.

diff --git a/data/fields/perl-provides b/data/fields/perl-provides
new file mode 100644
index 0000000..2e866c6
--- /dev/null
+++ b/data/fields/perl-provides
@@ -0,0 +1,24 @@
+# virtual packages provided by the Perl core packages that also have a
+# separate binary package available
+#
+# the listed version is the one included in the Perl core
+#
+# regenerate by running
+#   debian/rules refresh-perl-provides
+# in the lintian source tree
+#
+# last updated for PERL_VERSION=5.010000
+libtime-piece-perl 1.12
+libdigest-sha-perl 5.45
+libtest-simple-perl 0.72
+libtest-harness-perl 2.64
+libpod-simple-perl 3.05
+libparams-check-perl 0.26
+libmodule-pluggable-perl 3.6
+libmodule-load-conditional-perl 0.22
+libmodule-corelist-perl 2.12
+libmodule-build-perl 0.2808.01
+libio-zlib-perl 1.07
+libfile-temp-perl 0.18
+libextutils-parsexs-perl 2.18.02
+libextutils-cbuilder-perl 0.21
diff --git a/debian/copyright b/debian/copyright
index 13c6b03..449c970 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -34,6 +34,7 @@ Portions Copyright (C) 2005 René van Bevern
 Portions Copyright (C) 2006 Adeodato Simó
 Portions Copyright (C) 2007, 2008 Russ Allbery
 Portions Copyright (C) 2008 Patrick Schoenfeld
+Portions Copyright (C) 2008 Niko Tyni
 
 This program is free software; you may redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
diff --git a/debian/rules b/debian/rules
index 33afeee..945d329 100755
--- a/debian/rules
+++ b/debian/rules
@@ -10,6 +10,7 @@ allchecks := $(wildcard checks/*)
 allcollect := $(wildcard collection/*)
 tagfiles := $(wildcard testset/tags.* t/*/tags)
 testfiles := $(wildcard t/tests/*.desc)
+perlprovides := data/fields/perl-provides
 onlyrun =
 
 runtests: $(neededfiles) $(allchecks) $(allcollect) $(tagfiles) $(testfiles)
@@ -19,6 +20,10 @@ runtests: $(neededfiles) $(allchecks) $(allcollect) $(tagfiles) $(testfiles)
 	LINTIAN_ROOT="" $(PERL) t/runtests -k t debian/tests $(onlyrun)
 	if [ "$(onlyrun)" = "" ]; then touch $@; fi
 
+# this target is only run manually
+refresh-perl-provides:
+	perl private/refresh-perl-provides > $(perlprovides)
+
 build: build-stamp
 build-stamp: $(neededfiles) $(docsource)
 	@echo .... running build ....
@@ -28,6 +33,10 @@ build-stamp: $(neededfiles) $(docsource)
 	LINTIAN_ROOT="" ./frontend/lintian --help \
 		| tail -n +3 | $(PERL) -n -e 'print "  $$_"' >doc/help.tmp
 	$(PERL) -p -e 'BEGIN { open HELP, "<", "doc/help.tmp" or die; local $$/ = undef; $$h = <HELP> }; s/%LINTIAN_HELP%/$$h/' doc/README.in >doc/README
+
+	# check that the static data about perl core modules is up to date
+	$(PERL) -ne '/PERL_VERSION=(.+)/ and $$] > $$1 and warn q{*}x60 . qq{\n$(perlprovides) needs an update, please run\n  debian/rules refresh-perl-provides\n(which needs the libapt-pkg-perl package)\n} . q{*}x60 . qq{\n}' $(perlprovides)
+
 	touch $@
 
 clean: $(neededfiles)
@@ -66,5 +75,5 @@ binary-arch:
 
 binary:	binary-indep binary-arch
 
-.PHONY: build binary binary-arch binary-indep clean
+.PHONY: build binary binary-arch binary-indep clean refresh-perl-provides
 .DELETE_ON_ERROR: runtests
diff --git a/private/refresh-perl-provides b/private/refresh-perl-provides
new file mode 100755
index 0000000..17d23ff
--- /dev/null
+++ b/private/refresh-perl-provides
@@ -0,0 +1,116 @@
+#!/usr/bin/perl -w
+use strict;
+
+# Generate a list of packages that are provided by the Perl core packages
+# and also packaged separately at a (hopefully) newer version.
+# The list will have the package name and the upstream version of the
+# corresponding module integrated in the currently installed Perl version.
+
+# Copyright (C) 2008 Niko Tyni
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 2 of the License, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# from /usr/share/doc/libapt-pkg-perl/examples/apt-cache
+use AptPkg::Config '$_config';
+use AptPkg::System '$_system';
+use AptPkg::Cache;
+
+(my $self = $0) =~ s#.*/##;
+
+# initialise the global config object with the default values and
+# setup the $_system object
+$_config->init;
+$_system = $_config->system;
+
+# supress cache building messages
+$_config->{quiet} = 2;
+
+# set up the cache
+my $cache = AptPkg::Cache->new;
+# end from /usr/share/doc/libapt-pkg-perl/examples/apt-cache
+
+use Module::CoreList;
+my $versioning = $_system->versioning;
+
+# we look at packages provided by these
+my @core_packages = (qw(perl-base perl perl-modules));
+
+# check we have a cache of Debian sid packages available
+warn("Warning: this list should only be updated on a system with an up to date APT cache of the Debian unstable distribution")
+    if !grep { defined $_->{Origin} &&
+               defined $_->{Archive} &&
+               $_->{Origin} eq "Debian" &&
+               $_->{Archive} eq "unstable" }
+       @{$cache->files};
+
+print <<EOF;
+# virtual packages provided by the Perl core packages that also have a
+# separate binary package available
+#
+# the listed version is the one included in the Perl core
+#
+# regenerate by running
+#   debian/rules refresh-perl-provides
+# in the lintian source tree
+#
+# last updated for PERL_VERSION=$]
+EOF
+
+for my $pkg (@core_packages) {
+    my $cached_versions = $cache->{$pkg}
+        or die("no such binary package found in the APT cache: $pkg");
+    my $latest = bin_latest($cached_versions);
+
+    for my $provides (@{$latest->{ProvidesList}}) {
+        my $name = $provides->{Name};
+        # skip virtual-only packages
+        next if (!$cache->{$name}{VersionList});
+        my $version = find_core_version($name);
+        next if !$version;
+
+        # the underscore notates a CPAN development version;
+        # these may need special casing with some packages
+        $version =~ s/_/./g;
+        print "$name $version\n";
+    }
+}
+
+# look up the version of a package in the core
+sub find_core_version {
+    my $module = shift;
+    my $ret;
+    return if $module =~ /^perl(5|api)/;
+
+    # mangle the package name into the module name
+    $module =~ s/^lib//;
+    $module =~ s/-perl$//;
+    $module =~ s/-/::/g;
+
+    for (Module::CoreList->find_modules(qr/^\Q$module\E$/i, 0+$])) {
+        $ret = $Module::CoreList::version{0+$]}{$_};
+        last;
+    }
+
+    return $ret;
+}
+
+sub bin_latest {
+    my $p = shift;
+    return (sort bin_byversion @{$p->{VersionList}})[-1];
+}
+
+sub bin_byversion {
+    return $versioning->compare($a->{VerStr}, $b->{VerStr});
+}
+

-- 
Debian package checker


Reply to: