[SCM] Debian package checker branch, master, updated. 2.2.9-27-gea1bdb8
The following commit has been merged in the master branch:
commit ea1bdb840fcb84c0a8a9a7704077381f7cea19de
Author: Russ Allbery <rra@debian.org>
Date: Mon Apr 27 00:49:03 2009 -0700
Remove depcheck
Remove depcheck/* and frontend/depcheck. This is very old code that does
nothing useful right now and which has been untouched except for global
cleanups since the Subversion import.
diff --git a/depcheck/buglist b/depcheck/buglist
deleted file mode 100644
index 07648bd..0000000
--- a/depcheck/buglist
+++ /dev/null
@@ -1,7 +0,0 @@
-22341 perl-base: pre-dependency libgdbmg1
-21039 libc5-dbg: dependency libc5-dev (= 5.4.38-1)
-12717 wm2: dependency xlib6 (>= 3.3-0)
-23436 vrwave: dependencies jdk1.1-runtime | jdk-shared | jdk-static, unzip (>= 5.20-3)
-25427 libzephyr2: dependency comerr2g
-25709 geomview: dependency libforms0.88
-25710 debian-cd: dependency unzip
diff --git a/depcheck/dependencies.py b/depcheck/dependencies.py
deleted file mode 100755
index 3f86317..0000000
--- a/depcheck/dependencies.py
+++ /dev/null
@@ -1,153 +0,0 @@
-#!/usr/bin/python
-
-# Copyright (C) 1998 Richard Braakman
-#
-# This program is free software. It is distributed 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, you can find it on the World Wide
-# Web at http://www.gnu.org/copyleft/gpl.html, or write to the Free
-# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
-# MA 02110-1301, USA.
-
-import string
-
-import package
-from relation import Virtual
-import version
-
-# Create a dictionary of the available packages, including provided
-# virtual packages. The dictionary maps package names to versions.
-def packagedict(packages):
- pkdict = {}
- for pk in packages.values():
- pkdict[pk['name']] = pk['version']
- for provided in pk['provides']:
- if not pkdict.has_key(provided):
- pkdict[provided] = Virtual
- return pkdict
-
-def satisfy(relations, pkdict):
- failed = []
- for rel in relations:
- needs = rel.satisfied_by(pkdict)
- if needs is None:
- failed.append(rel)
- return failed
- # Future dreams: check if the depended-on packages don't conflict.
-
-def failure(name, rels, singular, plural):
- use = singular
- if len(rels) > 1:
- use = plural
- deps = string.join(map(str, rels), ', ')
- return '%s: %s %s' % (name, use, deps)
-
-def delete_relations(pk, relation, deletions):
- for rel in deletions:
- pk[relation].remove(rel)
-
-def test_packages(packages):
- pkdict = packagedict(packages)
- warnings = []
- for pk in packages.values():
- if pk.has_key('depends'):
- fl = satisfy(pk['depends'], pkdict)
- if fl:
- warnings.append(failure(pk['name'], fl, 'dependency', 'dependencies'))
- delete_relations(pk, 'depends', fl)
- if pk.has_key('recommends'):
- fl = satisfy(pk['recommends'], pkdict)
- if fl:
- warnings.append(failure(pk['name'], fl, 'recommendation', 'recommendations'))
- delete_relations(pk, 'recommends', fl)
- if pk.has_key('pre-depends'):
- fl = satisfy(pk['pre-depends'], pkdict)
- if fl:
- warnings.append(failure(pk['name'], fl, 'pre-dependency', 'pre-dependencies'))
- delete_relations(pk, 'pre-depends', fl)
- warnings.sort()
- return warnings
-
-def tosubtract(warning):
- return warning not in subtract
-
-def print_warnings(warnings, header):
- warnings = filter(tosubtract, warnings)
- if len(warnings):
- print header + "\n"
- for warning in warnings:
- print " " + warning
- print ""
-
-
-def test(packagefile):
- filter = ['package', 'version', 'depends', 'recommends', 'provides',
- 'pre-depends', 'priority', 'section']
- allpackages = package.parsepackages(open(packagefile), filter)
- priorities = {'required': {}, 'important': {}, 'standard': {},
- 'optional': {}, 'extra': {}}
- for pk in allpackages.values():
- priorities[pk['priority']][pk['name']] = pk
-
- packages = allpackages
- print_warnings(test_packages(packages),
- "Cannot satisfy with packages in main:");
-
- # packages-in-base check moved up to here, because otherwise some
- # of them will show up as "Cannot satisfy with required packages".
- for pk in packages.keys():
- if packages[pk]['section'] != 'base':
- del packages[pk]
- print_warnings(test_packages(packages),
- "Cannot satisfy with packages in base:");
-
- packages = priorities['required']
- print_warnings(test_packages(packages),
- "Cannot satisfy with required packages:");
-
- packages.update(priorities['important'])
- print_warnings(test_packages(packages),
- "Cannot satisfy with important packages:");
-
- packages.update(priorities['standard'])
- print_warnings(test_packages(packages),
- "Cannot satisfy with standard packages:");
-
- packages.update(priorities['optional'])
- print_warnings(test_packages(packages),
- "Cannot satisfy with optional packages:");
-
- packages.update(priorities['extra'])
- print_warnings(test_packages(packages),
- "Cannot satisfy with extra packages:");
-
- for pk in packages.keys():
- if packages[pk]['section'] == 'oldlibs':
- del packages[pk]
- print_warnings(test_packages(packages),
- "Cannot satisfy without packages in oldlibs:");
-
-import sys
-
-if len(sys.argv) == 3:
- subtract = []
- for line in open(sys.argv[2]).readlines():
- subtract.append(line[2:-1])
-else:
- subtract = [];
-
-
-
-if len(sys.argv) > 1:
- test(sys.argv[1])
-else:
- test("/var/lib/dpkg/methods/ftp/Packages.hamm_main")
diff --git a/depcheck/deppages.pl b/depcheck/deppages.pl
deleted file mode 100755
index 48b4586..0000000
--- a/depcheck/deppages.pl
+++ /dev/null
@@ -1,197 +0,0 @@
-#!/usr/bin/perl
-
-# Create HTML pages describing the results of dependency-integrity checks
-# over the Debian archive.
-#
-# Copyright (C) 1998 Richard Braakman
-#
-# This program is free software. It is distributed 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, you can find it on the World Wide
-# Web at http://www.gnu.org/copyleft/gpl.html, or write to the Free
-# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
-# MA 02110-1301, USA.
-
-require './config';
-
-# comes from './config'
-use vars qw( $LOG_DIR );
-
-# lintian binary will define these
-use vars qw($LINTIAN_DIST $HTML_TMP_DIR $LINTIAN_ARCHIVEDIR $LINTIAN_ROOT);
-
-my @archs = ('i386', 'alpha', 'm68k', 'powerpc', 'sparc', 'arm', 'hurd-i386');
-
-my @logfiles = map { "$LOG_DIR/Depcheck-" . $_ } @archs;
-system("savelog @logfiles >/dev/null") == 0
- or die("cannot rotate logfiles");
-
-# this stuff is most likely broken
-my $BINARY = "$LINTIAN_ARCHIVEDIR/dists/$LINTIAN_DIST/main";
-
-my $libdir = defined $LINTIAN_ROOT ? "$LINTIAN_ROOT/" : "";
-my $DEPCHECKDIR = "${libdir}depcheck";
-my $DEPCHECK = "$DEPCHECKDIR/dependencies.py";
-
-$ENV{'PYTHONPATH'} = $DEPCHECKDIR;
-
-system("$DEPCHECK $BINARY/binary-i386/Packages >$LOG_DIR/Depcheck-i386") == 0
- or die("depcheck failed for i386 architecture");
-
-for my $arch (@archs) {
- next if $arch eq 'i386';
-
- system("$DEPCHECK $BINARY/binary-$arch/Packages $LOG_DIR/Depcheck-i386 >$LOG_DIR/Depcheck-$arch") == 0
- or die("depcheck failed for $arch architecture");
-}
-
-my %bug_used = ();
-my %bugs = ();
-
-open(BUGS, '<', "$LINTIAN_ROOT/depcheck/buglist") or die("buglist");
-while (<BUGS>) {
- chop;
- my $bugline = $_;
- my @b;
- while ($bugline =~ s/^(\d+)\s//) {
- push(@b, &make_bugref($1));
- }
- $bugs{$bugline} = join(", ", @b);
-}
-close(BUGS);
-
-open(HTML, '>', "$HTML_TMP_DIR/depcheck.html") or die("depcheck.html");
-
-print HTML <<EOT;
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 2.0//EN">
-<HTML>
-<HEAD>
- <TITLE>Debian: Dependency integrity check for the main distribution</TITLE>
-</HEAD>
-<BODY>
-<H1>Dependency checks</H1>
-This page summarizes the results of a scan that checks the following
-two bits of Debian policy:<P>
-<UL>
-<LI>From section 2.1.2: The main section<P>
- <blockquote>
- The packages in "main" must not require a package outside of
- "main" for compilation or execution (thus, the package may not
- declare a "Depends" or "Recommends" relationship on a non-main package).
- </blockquote><P>
-<LI>From section 2.2: Priorities<P>
- <blockquote>
- Packages may not depend on packages with lower priority values.
- If this should happen, one of the priority values will have to be
- adapted.
- </blockquote><P>
-</UL>
-
-The scan also looks for packages in the "base" section that depend on
-packages not in the "base" section, and for packages that depend on
-packages in "oldlibs" that are not themselves in "oldlibs".<P>
-
-The scan checks the Recommends, Depends, and Pre-Depends headers in
-all cases.<P>
-EOT
-
-for my $arch (@archs) {
- genarch($arch);
-}
-
-close(HTML);
-
-for my $bug (keys %bugs) {
- unless ($bug_used{$bug}) {
- print STDERR "Unused bugnumber: $bug\n";
- }
-}
-
-exit 0;
-
-sub genarch {
- my $arch = shift;
-
- print HTML "<HR>\n";
- print HTML "<A NAME=$arch>\n";
- print HTML "<H2>Dependency check for the $arch architecture</H2>\n\n";
-
- print HTML "<P>This list was generated from the $arch Packages file,<BR>\n"
- . "dated: " . &filetime("$BINARY/binary-$arch/Packages") . ".\n";
-
- if ($arch ne 'i386') {
- print HTML "<P>It excludes the checks which were already " .
- "reported for the i386 architecture.\n";
- }
-
- print HTML "\n";
-
- open(REPORT, '<', "$LOG_DIR/Depcheck-$arch") or die("Depcheck-$arch");
- &genreport;
- close(REPORT);
-}
-
-sub genreport {
- my $inlist = 0;
- my $brokendep;
- my $bug;
-
- while (<REPORT>) {
- chop;
- if (s/^\s+//) {
- $brokendep = $_;
- $bug = $bugs{$brokendep};
- if (defined $bug) {
- $bug_used{$brokendep} = 1;
- $brokendep = quotehtml($brokendep) . ' [' . $bug . ']';
- } else {
- $brokendep = quotehtml($brokendep);
- }
- print(HTML " <LI>$brokendep\n");
- } elsif (m/^$/) {
- next;
- } else {
- if ($inlist) {
- print(HTML "</UL>\n\n");
- }
- $_ = "ehtml($_);
- print(HTML "<H3>$_</H3>\n");
- print(HTML "<UL>\n");
- $inlist = 1;
- }
- }
-
- if ($inlist) {
- print(HTML "</UL>\n");
- }
-}
-
-sub make_bugref {
- my $bugnum = shift;
- my $bugdir = substr($bugnum, 0, 2);
-
- return "<A HREF=\"http://www.debian.org/Bugs/db/$bugdir/$bugnum.html\">"
- . "\#$bugnum</A>";
-}
-
-sub quotehtml {
- $_ = $_[0] . '';
- s/&/\&/g;
- s/</\</g;
- s/>/\>/g;
- return $_;
-}
-
-sub filetime {
- my $time = (stat(shift))[9]; # mtime
- return scalar(gmtime($time));
-}
diff --git a/depcheck/package.py b/depcheck/package.py
deleted file mode 100644
index 8679225..0000000
--- a/depcheck/package.py
+++ /dev/null
@@ -1,155 +0,0 @@
-# Copyright (C) 1998 Richard Braakman
-#
-# This program is free software. It is distributed 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, you can find it on the World Wide
-# Web at http://www.gnu.org/copyleft/gpl.html, or write to the Free
-# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
-# MA 02110-1301, USA.
-
-import string
-import regex
-
-import version
-import relation
-
-bad_field = 'Bad field value'
-
-defaults = {'depends': [], 'recommends': [], 'suggests': [], 'pre-depends': [],
- 'conflicts': [], 'replaces': [], 'provides': [],
- 'essential': 0, 'distribution': 'main', 'architecture': 'all',
- 'description': '', 'synopsis': ''}
-
-relationships = ['depends', 'recommends', 'suggests', 'pre-depends',
- 'conflicts', 'replaces']
-
-# The Package class models a read-only dictionary that is initialized
-# by feeding it a paragraph of control information.
-# Some translation is done on the field names:
-# 'package' -> 'name'
-# 'source' -> 'sourcepackage' and 'sourceversion'
-# 'description' -> 'synopsis' and 'description'
-# 'section' -> 'distribution' and 'section'
-class Package:
- def __init__(self):
- self.fields = {}
-
- def __len__(self):
- return len(self.fields)
-
- # Look up a field in this package.
- def __getitem__(self, key):
- if self.fields.has_key(key):
- return self.fields[key]
- # If it is not defined, return the default value for that field.
- if defaults.has_key(key):
- return defaults[key]
- # Special defaults
- if key == 'sourcepackage':
- return self['name']
- if key == 'sourceversion':
- return self['version']
- # If there is no default, try again with a lowercase version
- # of the field name.
- lcase = string.lower(key)
- if lcase != key:
- return self[lcase]
- raise KeyError, key
-
- # Define some standard dictionary methods
- def keys(self): return self.fields.keys()
- def items(self): return self.fields.items()
- def values(self): return self.fields.values()
- def has_key(self, key): return self.fields.has_key(key)
-
- def parsefield(self, field, fieldval):
- # Perform translations on field and fieldval
- if field == 'package':
- field = 'name'
- elif field == 'version':
- fieldval = version.make(fieldval)
- elif field == 'architecture':
- fieldval = string.split(fieldval)
- if len(fieldval) == 1:
- fieldval = fieldval[0]
- elif field == 'source':
- field = 'sourcepackage'
- splitsource = string.split(fieldval)
- if (len(splitsource) > 1):
- if splitsource[1][0] != '(' \
- or splitsource[1][-1] != ')':
- raise ValueError, fieldval
- fieldval = splitsource[0]
- self.fields['sourceversion'] = version.make(splitsource[1][1:-1])
- elif field in relationships:
- fieldval = map(relation.parse, string.split(fieldval, ','))
- elif field == 'provides':
- # I will assume that the alternates construct is
- # not allowed in the Provides: header.
- fieldval = string.split(fieldval, ', ')
- elif field == 'description':
- i = string.find(fieldval, '\n')
- if i >= 0:
- self.fields['description'] = fieldval[i+1:]
- fieldval = string.strip(fieldval[:i])
- elif field == 'essential':
- if fieldval == 'yes':
- fieldval = 1
- elif fieldval != 'no':
- raise ValueError, fieldval
- else:
- fieldval = 0
- elif field == 'section':
- i = string.find(fieldval, '/')
- if i >= 0:
- self.fields['distribution'] = fieldval[:i]
- fieldval = fieldval[i+1:]
- elif field == 'installed-size':
- fieldval = string.atoi(fieldval)
- elif field == 'size':
- fieldval = string.atoi(fieldval)
-
- self.fields[field] = fieldval
-
- # This function accepts a list of "field: value" strings,
- # with continuation lines already folded into the values.
- # "filter" is an array of header fields (lowercase) to parse.
- # If it is None, parse all fields.
- def parseparagraph(self, lines, filter=None):
- for line in lines:
- idx = string.find(line, ':')
- if idx < 0:
- raise bad_field, line
- field = string.lower(line[:idx])
- if not filter or field in filter:
- try:
- self.parsefield(field, string.strip(line[idx+1:]))
- except:
- raise bad_field, line
-
-def parsepackages(infile, filter=None):
- packages = {}
- paragraph = []
- while 1:
- line = infile.readline()
- if len(line) == 0:
- break
- elif line[0] == ' ' or line[0] == '\t':
- paragraph[-1] = paragraph[-1] + line
- elif line[0] == '\n':
- pk = Package()
- pk.parseparagraph(paragraph, filter)
- packages[pk['name']] = pk
- paragraph = []
- else:
- paragraph.append(line)
- return packages
diff --git a/depcheck/relation.py b/depcheck/relation.py
deleted file mode 100644
index b406309..0000000
--- a/depcheck/relation.py
+++ /dev/null
@@ -1,171 +0,0 @@
-# This module defines package relationships.
-# It exports two special "version" values: Virtual and Any.
-# A Virtual version never matches a versioned conflict or dependency.
-# An Any version always matches a versioned conflict or dependency.
-
-# Copyright (C) 1998 Richard Braakman
-#
-# This program is free software. It is distributed 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, you can find it on the World Wide
-# Web at http://www.gnu.org/copyleft/gpl.html, or write to the Free
-# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
-# MA 02110-1301, USA.
-
-
-import string
-
-import version
-
-# The two special "version" values. All empty lists are unique,
-# so these statements initialize them to unique values.
-Virtual = []
-Any = []
-
-# The basic relationship: a single package name.
-# Its name is stored in the name attribute.
-class SimpleRelation:
- def __init__(self, package):
- self.name = package
-
- def __str__(self):
- return self.name
-
- def __repr__(self):
- return 'SimpleRelation(' + `self.name` + ')'
-
- def satisfied(self, packagename, version):
- return packagename == self.name
-
- def satisfied_by(self, packages):
- if packages.has_key(self.name):
- return self.name
- return None
-
- def packagenames(self):
- return [self.name]
-
-# A package name with a version check.
-# The package name is stored in the name attribute.
-# The relation is stored as a string in the relationstring attribute,
-# and as a comparison function in the relation attribute.
-# The version to compare to is stored in the version attribute.
-class VersionedRelation:
- def __init__(self, package, relation, version):
- self.name = package
- self.version = version
- self.relationstring = relation
- if relation == '<' or relation == '<=':
- self.relation = lessthan
- elif relation == '>' or relation == '>=':
- self.relation = greaterthan
- elif relation == '=':
- self.relation = equalversion
- elif relation == '>>':
- self.relation = strictgreater
- elif relation == '<<':
- self.relation = strictless
- else:
- raise ValueError, 'relation: ' + relation
-
- def __str__(self):
- return '%s (%s %s)' % (self.name, self.relationstring, self.version)
-
- def __repr__(self):
- return 'VersionedRelation(' + `self.name` + ', ' + \
- `self.relationstring` + ', ' + `self.version` + ')'
-
- # version can be the special values Virtual or Any, in addition
- # to a normal Version instance.
- def satisfied(self, packagename, version):
- if packagename != self.name or version is Virtual:
- return 0
- if version is Any:
- return 1
- return self.relation(version, self.version)
-
- def satisfied_by(self, packages):
- version = packages.get(self.name)
- if version is not None and self.satisfied(self.name, version):
- return self.name
- return None
-
- def packagenames(self):
- return [self.name]
-
-# Relations joined with the "alternatives" operator, i.e. foo | bar.
-# This class just stores the joined relations as a sequence.
-class AltRelation:
- def __init__(self, relationlist):
- self.relations = relationlist
-
- def __str__(self):
- return string.join(map(str, self.relations), ' | ')
-
- def __repr__(self):
- return 'AltRelation(' + `self.relations` + ')'
-
- def satisfied(self, packagename, version):
- for rel in self.relations:
- if rel.satisfied(packagename, version):
- return 1
- return 0
-
- def satisfied_by(self, packages):
- rv = []
- for rel in self.relations:
- sb = rel.satisfied_by(packages)
- if sb is not None and rv.count(sb) == 0:
- rv.append(sb)
- if len(rv) > 0:
- return rv
- return None
-
- def packagenames(self):
- return reduce(lambda x, y: x + y.packagenames(), self.relations, [])
-
-def parsealt(str):
- i = string.find(str, '(')
- if i == -1:
- return SimpleRelation(string.strip(str))
- packagename = string.strip(str[:i])
- j = string.find(str, ')')
- relver = string.strip(str[i+1:j])
- if relver[1] == '<' or relver[1] == '=' or relver[1] == '>':
- return VersionedRelation(packagename, relver[:2],
- version.make(string.strip(relver[2:])))
- else:
- return VersionedRelation(packagename, relver[:1],
- version.make(string.strip(relver[1:])))
-
-def parse(str):
- alts = map(parsealt, string.split(str, '|'))
- if len(alts) > 1:
- return AltRelation(alts)
- return alts[0]
-
-# Possible values for the relation attribute
-def strictless(x, y):
- return x < y
-
-def lessthan(x, y):
- return x <= y
-
-def equalversion(x, y):
- return x.equals(y)
-
-def greaterthan(x, y):
- return x >= y
-
-def strictgreater(x, y):
- return x > y
-
diff --git a/depcheck/report2html.pl b/depcheck/report2html.pl
deleted file mode 100644
index 9daa35b..0000000
--- a/depcheck/report2html.pl
+++ /dev/null
@@ -1,83 +0,0 @@
-#!/usr/bin/perl -w
-
-# Copyright (C) 1998 Richard Braakman
-#
-# 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, you can find it on the World Wide
-# Web at http://www.gnu.org/copyleft/gpl.html, or write to the Free
-# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
-# MA 02110-1301, USA.
-
-my %bugs;
-if (my $buglist = shift) {
- open(BUGS, '<', $buglist) or die($buglist);
- while (<BUGS>) {
- chop;
- my $bugline = $_;
- my @b;
- while ($bugline =~ s/^(\d+)\s//) {
- push(@b, &make_bugref($1))
- }
- $bugs{$bugline} = join(", ", @b);
- }
- close(BUGS);
-}
-
-my $inmenu = 0;
-
-while (<STDIN>) {
- chop;
- if (s/^\s+//) {
- my $brokendep = "ehtml($_);
- my $bug = $bugs{$_};
- if (defined $bug) {
- delete $bugs{$_};
- $brokendep .= ' [' . $bug . ']';
- }
- print(" <LI>$brokendep\n");
- } elsif (m/^$/) {
- next;
- } else {
- if ($inmenu) {
- print("</MENU>\n\n");
- }
- $_ = "ehtml($_);
- print("<H2>$_</H2>\n");
- print("<MENU>\n");
- $inmenu = 1;
- }
-}
-
-if ($inmenu) {
- print("</MENU>\n");
-}
-
-exit 0;
-
-# -----
-
-sub make_bugref {
- my $bugnum = shift;
- my $bugdir = substr($bugnum, 0, 2);
-
- return "<A HREF=\"http://www.debian.org/Bugs/db/$bugdir/$bugnum.html\">"
- . "\#$bugnum</A>";
-}
-
-sub quotehtml {
- $_ = shift;
- s/&/\&/g;
- s/</\</g;
- s/>/\>/g;
- return $_;
-}
diff --git a/depcheck/version.py b/depcheck/version.py
deleted file mode 100644
index e7dc309..0000000
--- a/depcheck/version.py
+++ /dev/null
@@ -1,217 +0,0 @@
-# This module defines the immutable Version type.
-# Initialize it with Version(string). It defines attributes
-# epoch, upstream, and debian.
-# Comparison operations are defined on Versions and follow the same rules
-# as dpkg.
-
-# Copyright (C) 1998 Richard Braakman
-#
-# This program is free software. It is distributed 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, you can find it on the World Wide
-# Web at http://www.gnu.org/copyleft/gpl.html, or write to the Free
-# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
-# MA 02110-1301, USA.
-
-import string
-import re
-
-# TODO: Is the regexp very slow? Find out. It could be simplified
-# at the cost of some extra string slicing by the caller.
-
-# python can be just as incomprehensible as perl!
-version_format = re.compile(r"^(\d+:)?([\w][\w+.:\-]*?)(-[\w+.]+)?$")
-
-# The regexp above breaks down into three parts:
-# (\d+:)? Optional epoch
-# ([\w][\w+.:\-]*?) Upstream version number
-# (-[\w+.]+)? Optional Debian revision
-# The *? notation at the end of the upstream version number means the
-# regexp engine should attempt a minimum-length match, rather than
-# maximum-length. This prevents the upstream-version pattern from
-# gobbling up the Debian revision.
-
-# A non-numeric sequence followed by a numeric sequence.
-# The comparison code uses it to consume the version string according
-# to the algorithm in the Policy manual, two steps at a time.
-compare_format = re.compile(r"([^\d]*)(\d*)")
-
-# An alphabetic sequence followed by a non-alphabetic sequence.
-# This way, the non-numeric parts are divided into parts just
-# like the entire version string is.
-alph_compare_format = re.compile(r"([a-zA-Z]*)([^a-zA-Z]*)")
-
-# Compare non-numeric parts of version strings x and y.
-# It differs from the normal cmp, because non-alphabetic characters
-# must sort newer than alphabetic ones.
-def alphcmp(x, y):
- while len(x) > 0 and len(y) > 0:
- # The match is guaranteed not to fail, because the regexp can match
- # a zero-length string.
- (xalph, xnonalph) = alph_compare_format.match(x).groups()
- (yalph, ynonalph) = alph_compare_format.match(y).groups()
- if xalph == yalph:
- if xnonalph == ynonalph:
- x = x[len(xalph) + len(xnonalph):]
- y = y[len(yalph) + len(ynonalph):]
- else:
- return cmp(xnonalph, ynonalph)
- else:
- common = min(len(xalph), len(yalph))
- if xalph[:common] == yalph[:common]:
- if len(xalph) == common:
- if xnonalph == '':
- return -1 # y is the longer string
- else:
- return 1 # xnonalph will sort newer than yalph's tail
- else:
- if ynonalph == '':
- return 1 # x is the longer string
- else:
- return -1 # ynonalph will sort newer than xalph's tail
- else:
- return cmp(xalph[:common], yalph[:common])
-
- # One of the strings is exhausted. The longer string counts as newer.
- return cmp(len(x), len(y))
-
-
-# Compare the version strings x and y. Return positive if x is
-# newer than y, and negative if x is older than y. The caller
-# guarantees that they are not equal.
-def versioncmp(x, y):
- while len(x) > 0 and len(y) > 0:
- # The match is guaranteed not to fail, because the regexp can match
- # a zero-length string.
- (xnondigit, xdigit) = compare_format.match(x).groups()
- (ynondigit, ydigit) = compare_format.match(y).groups()
- if xnondigit == ynondigit:
- if xdigit == ydigit:
- x = x[len(xnondigit) + len(xdigit):]
- y = y[len(ynondigit) + len(ydigit):]
- # Count an empty digit string as zero. (i.e. 1.1 versus 1.)
- elif xdigit == '':
- return cmp(0, string.atoi(ydigit))
- elif ydigit == '':
- return cmp(string.atoi(xdigit), 0)
- else:
- return cmp(string.atoi(xdigit), string.atoi(ydigit))
- else:
- return alphcmp(xnondigit, ynondigit)
-
- # One of the strings is exhausted. The longer string counts as newer.
- return cmp(len(x), len(y))
-
-compare_cache = {}
-
-def cache_versioncmp(x, y):
- if compare_cache.has_key((x, y)):
- return compare_cache[(x, y)]
- c = versioncmp(x, y)
- compare_cache[(x, y)] = c
- compare_cache[(y, x)] = -c
- return c
-
-# A version is an immutable object. It is created with Version(string)
-# and is not changed thereafter. This is not enforced.
-class Version:
- # A Version object is defined by an epoch (stored in self.epoch
- # as an integer), an upstream version (stored in self.upstream as
- # a string), and a debian revision (stroed in self.debian as
- # a string).
- # self.debian may be None to indicate that the version number does
- # not have a Debian revision.
- def __init__(self, version):
- # See Policy manual, chapter 4.
- match = version_format.match(version)
- if not match:
- raise ValueError, version
- (epoch, upstream, debian) = match.group(1, 2, 3)
- if epoch:
- # slice off the colon
- self.epoch = string.atoi(epoch[:-1])
- else:
- self.epoch = 0
- self.upstream = upstream
- if debian:
- # slice off the leading hyphen
- self.debian = debian[1:]
- else:
- self.debian = None
-
- # This function compares two versions. We use the earlier/later
- # relationship defined in the policy manual as our ordering
- # relationship. Thus, the function should return a negative
- # number if self is earlier than other, zero if they are equal,
- # and a positive number if self is later than other.
- def __cmp__(self, other):
- if self.epoch == other.epoch:
- if self.upstream == other.upstream:
- if self.debian == other.debian:
- return 0
- # "The absence of a <debian_revision> compares earlier than
- # the presence of one". (Policy manual chapter 4)
- elif self.debian and not other.debian:
- return 1
- elif not self.debian and other.debian:
- return -1
- else:
- return cache_versioncmp(self.debian, other.debian)
- else:
- return cache_versioncmp(self.upstream, other.upstream)
- else:
- return cmp(self.epoch, other.epoch)
-
- # Return a good hash value when this object is used as a key
- # in a dictionary. Only immutable objects should define a
- # hash function.
- def __hash__(self):
- return hash(self.epoch) ^ hash(self.upstream) ^ hash(self.debian)
-
- # This should return a string representation of this object.
- # We represent a version string by recombining the epoch,
- # upstream version, and debian revision.
- def __str__(self):
- # We normally leave out an epoch of 0, but we do add it if
- # the upstream version contains a colon (:), in order to
- # keep it a valid version string.
- if self.epoch != 0 or string.find(self.upstream, ':') >= 0:
- if self.debian:
- return '%d:%s-%s' % (self.epoch, self.upstream, self.debian)
- else:
- return '%d:%s' % (self.epoch, self.upstream)
- elif self.debian:
- return self.upstream + '-' + self.debian
- else:
- return self.upstream
-
- # This should return a string that is a valid Python expression
- # for recreating this value. It is the "official" representation.
- # Useful for debugging.
- def __repr__(self):
- return 'Version(' + `str(self)` + ')'
-
- # Cheap comparison, when only equality is asked for.
- def equals(self, other):
- return self.upstream == other.upstream and \
- self.debian == other.debian and \
- self.epoch == other.epoch
-
-version_cache = {}
-
-def make(version):
- if version_cache.has_key(version):
- return version_cache[version]
- else:
- v = Version(version)
- version_cache[version] = v
- return v
diff --git a/frontend/depcheck b/frontend/depcheck
deleted file mode 100755
index 3285d57..0000000
--- a/frontend/depcheck
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/usr/bin/perl -w
-
-use strict;
-$ENV{'LINTIAN_ROOT'} = '..';
-require "$ENV{'LINTIAN_ROOT'}/lib/deplib.pl";
-
-my $foo = Dep::parse('aalib1 (>= 1.2), libc6 (>= 2.2.2-2), libgpmg1 (>= 1.14-16), libncurses5 (>= 5.2.20010310-1), libpng2, slang1 (>> 1.3.0-0), svgalibg1 | svgalib-dummyg1, slang1, xlibs (>= 4.0.1-11), libpng2, zlib1g (>= 1:1.1.3)');
-
-use Data::Dumper;
-
-if ($foo->[0] eq 'AND') {
- my %seen;
- shift @$foo;
- foreach my $i (@$foo) {
- next if ($i->[0] eq 'OR');
- $seen{$i->[1]}++;
- }
- my @dups = grep {$seen{$_} > 1} keys(%seen);
- if (scalar(@dups) > 0) {
- print "Dups: " . scalar(@dups) . "\n";
- print "@dups\n";
- }
-}
-
-print Dumper($foo) . "\n";
-
-#my @preds = $foo->[1];
-#print Dumper(@preds);
--
Debian package checker
Reply to: