| 1 |
#!/usr/bin/perl -w
|
| 2 |
# (c) 2000, 2001, 2002, 2003, 2006 Palfrader Peter <weasel@debian.org>
|
| 3 |
|
| 4 |
require 5.002;
|
| 5 |
use strict;
|
| 6 |
|
| 7 |
my %DISTRIBUTIONS = (
|
| 8 |
oldstable => 'sarge',
|
| 9 |
stable => 'etch',
|
| 10 |
testing => 'lenny',
|
| 11 |
unstable => 'sid' );
|
| 12 |
my $PARAM = $ARGV[0];
|
| 13 |
my $DIST;
|
| 14 |
die ("$0: argument expected\nusage: $0 <dist>\n") unless defined $PARAM;
|
| 15 |
my $VERBOSE = 0;
|
| 16 |
|
| 17 |
for my $key (keys %DISTRIBUTIONS) {
|
| 18 |
if ($PARAM eq $key) {
|
| 19 |
$DIST = $DISTRIBUTIONS{$key};
|
| 20 |
last;
|
| 21 |
} elsif ($PARAM eq $DISTRIBUTIONS{$key}) {
|
| 22 |
$DIST = $PARAM;
|
| 23 |
last;
|
| 24 |
};
|
| 25 |
};
|
| 26 |
die ("$0: wrong argument\nusage: $0 <dist>\n") unless defined $DIST;
|
| 27 |
|
| 28 |
|
| 29 |
my $LINK_BTS = "http://bugs.debian.org/";
|
| 30 |
my $LINK_BTS_SRC = "http://bugs.debian.org/src:";
|
| 31 |
my $RESULTDIR_PACKAGE = "result.new/$DIST/packages/";
|
| 32 |
my $RESULTDIR_LIST = "result.new/$DIST/lists/";
|
| 33 |
my $DONE = "result.new/$DIST/DONE";
|
| 34 |
|
| 35 |
my @ARCHS = ($DIST eq 'sarge' ) ? qw{alpha arm hppa i386 ia64 m68k mips mipsel powerpc s390 sparc} :
|
| 36 |
($DIST eq 'etch' ) ? qw{alpha amd64 arm hppa i386 ia64 mips mipsel powerpc s390 sparc} :
|
| 37 |
($DIST eq 'lenny' ) ? qw{alpha amd64 arm hppa i386 ia64 mips mipsel powerpc s390 sparc} :
|
| 38 |
qw{alpha amd64 arm hppa i386 ia64 m68k mips mipsel powerpc s390 sparc};
|
| 39 |
#qw{alpha arm hppa hurd-i386 i386 ia64 m68k mips mipsel powerpc s390 sparc};
|
| 40 |
|
| 41 |
my @DISTSECTIONS = qw{main contrib non-free};
|
| 42 |
my %PACKAGES_FILES = map { my $section=$_;
|
| 43 |
my %sect = map { $_ => "../ftp/get-packages -v ftp -s $DIST -c $section -a $_ |"; } @ARCHS;
|
| 44 |
$_ => \%sect;
|
| 45 |
} @DISTSECTIONS;
|
| 46 |
my %SOURCES_FILES = map { $_ => "../ftp/get-packages -v ftp -s $DIST -c $_ -a source |"; } @DISTSECTIONS;
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
my $OLDLIBS = 'oldlibs';
|
| 51 |
my $NEEDED_CONTROL = "Package|Provides|Depends|Pre-Depends|Recommends|Suggests|Priority|Version|Section|Source|Maintainer";
|
| 52 |
my $NEEDED_CONTROL_SOURCES = "Package|Standards-Version|Architecture|Build-Depends|Maintainer|Version";
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
my %PRIORITY = ( # must be a 1 to 1 relationship
|
| 57 |
'required' => 5,
|
| 58 |
'important' => 4,
|
| 59 |
'standard' => 3,
|
| 60 |
'optional' => 2,
|
| 61 |
'extra' => 1);
|
| 62 |
my $DEFAULT_PRIORITY = 2;
|
| 63 |
my %PRIORITY_REV = map { $PRIORITY{$_} => $_; } keys %PRIORITY;
|
| 64 |
|
| 65 |
my %entity= ( '>' => '>',
|
| 66 |
'<' => '<',
|
| 67 |
'&' => '&',
|
| 68 |
'"' => '"' );
|
| 69 |
|
| 70 |
my $NOW=gmtime();
|
| 71 |
|
| 72 |
my @PROBLEMS=qw{
|
| 73 |
relationship-Pre-Depends
|
| 74 |
relationship-Depends
|
| 75 |
relationship-Recommends
|
| 76 |
relationship-Suggests
|
| 77 |
halfbroken-relationship-Pre-Depends
|
| 78 |
halfbroken-relationship-Depends
|
| 79 |
halfbroken-relationship-Recommends
|
| 80 |
halfbroken-relationship-Suggests
|
| 81 |
Standards-Version
|
| 82 |
No-Standards-Version
|
| 83 |
Wrong-Standards-Version-Syntax
|
| 84 |
build-depends
|
| 85 |
halfbroken-build-depends
|
| 86 |
malformed-build-depends
|
| 87 |
oldlibs
|
| 88 |
withinmain
|
| 89 |
priority
|
| 90 |
};
|
| 91 |
|
| 92 |
my $MAIN='main';
|
| 93 |
|
| 94 |
my $PROBLEMINDEXTABLEHEADER = << "EOF";
|
| 95 |
<table border=1>
|
| 96 |
<tr><th>Package</th><th colspan=4>Broken Relationships</th> <th colspan=4>Half Broken Rel.</th> <th colspan=3>Build Dep</th> <th colspan=3>Standards-Version</th> <th>OldLibs</th><th>Priority</th><th>Maintainer</th></tr>
|
| 97 |
<tr><th> </th><th>Pre</th><th>Dep.</th><th>Rec.</th><th>Sug.</th> <th>Pre</th><th>Dep.</th><th>Rec.</th><th>Sug.</th> <th>Broken</th><th>Half B.</th><th>malformed</th><th>old</th><th>no</th><th>syntax</th> <th> </th> <th> </th><th> </th></tr>
|
| 98 |
EOF
|
| 99 |
|
| 100 |
my %VERSION_CACHE;
|
| 101 |
my %PROBLEMINDEX;
|
| 102 |
my %PROBLEMLIST;
|
| 103 |
|
| 104 |
|
| 105 |
# my $LINK_PACKAGE = "debcheck.php?dist=$DIST\&package";
|
| 106 |
# my $LINK_LIST = "debcheck.php?dist=$DIST\&list"; # should support &arch=<arch>
|
| 107 |
|
| 108 |
sub makeLinkPackage($$$) {
|
| 109 |
my ($dist, $package, $txt) = @_;
|
| 110 |
return sprintf("<a href=\"debcheck.php?dist=%s\&package=%s\">%s</a>", url($dist), url($package), $txt);
|
| 111 |
};
|
| 112 |
|
| 113 |
sub makeLinkList($$$$) {
|
| 114 |
my ($dist, $list, $arch, $txt) = @_;
|
| 115 |
if (defined $arch) {
|
| 116 |
return sprintf("<a href=\"debcheck.php?dist=%s\&list=%s\&arch=%s\">%s</a>", url($dist), url($list), url($arch), $txt);
|
| 117 |
} else {
|
| 118 |
return sprintf("<a href=\"debcheck.php?dist=%s\&list=%s\">%s</a>", url($dist), url($list), $txt);
|
| 119 |
};
|
| 120 |
};
|
| 121 |
|
| 122 |
sub makeLinkSummary($$) {
|
| 123 |
my ($dist, $txt) = @_;
|
| 124 |
return sprintf("<a href=\"debcheck.php?dist=%s\&package=INDEX\">%s</a>", url($dist), $txt);
|
| 125 |
};
|
| 126 |
|
| 127 |
sub parse_file($$) {
|
| 128 |
my ($Rarchs, $Rsources) = @_;
|
| 129 |
|
| 130 |
local $/ = "";
|
| 131 |
for my $arch (@ARCHS) {
|
| 132 |
my $Rpackages = {};
|
| 133 |
my $Rprovides = {};
|
| 134 |
for my $distsection (@DISTSECTIONS) {
|
| 135 |
open(INPUT, $PACKAGES_FILES{$distsection}->{$arch}) ||
|
| 136 |
die("$0: Cannot open packages file '".$PACKAGES_FILES{$distsection}->{$arch}.": $!'");
|
| 137 |
while(<INPUT>){
|
| 138 |
my @control_fields = grep { /^($NEEDED_CONTROL): / } split /\n(?!\s)/;
|
| 139 |
my %package = map {
|
| 140 |
my ($name, $value) = split /: /;
|
| 141 |
$name => $value;
|
| 142 |
}
|
| 143 |
@control_fields;
|
| 144 |
if (!defined $package{'Source'}) {
|
| 145 |
$package{'Source'} = $package{'Package'};
|
| 146 |
};
|
| 147 |
$package{'Source'} =~ s/\s+.*//;
|
| 148 |
$package{'DistSection'} = $distsection;
|
| 149 |
$Rpackages->{ $package{'Package'} } = \%package;
|
| 150 |
if (defined $package{'Provides'}) {
|
| 151 |
foreach my $provided ( split /\s*,\s*/, $package{'Provides'}) {
|
| 152 |
push @{ $Rprovides->{$provided} }, $package{'Package'};
|
| 153 |
};
|
| 154 |
};
|
| 155 |
};
|
| 156 |
};
|
| 157 |
close(INPUT);
|
| 158 |
$Rarchs->{$arch} = { 'packages' => $Rpackages, 'provides' => $Rprovides };
|
| 159 |
};
|
| 160 |
for my $distsection (@DISTSECTIONS) {
|
| 161 |
open(INPUT, $SOURCES_FILES{$distsection}) || die("$0: Cannot open sources file '".$SOURCES_FILES{$distsection}."': $!");
|
| 162 |
while(<INPUT>) {
|
| 163 |
my @control_fields = grep { /^($NEEDED_CONTROL_SOURCES): / } split /\n(?!\s)/;
|
| 164 |
my %package = map {
|
| 165 |
my ($name, $value) = split /: /;
|
| 166 |
$name => $value;
|
| 167 |
}
|
| 168 |
@control_fields;
|
| 169 |
$package{'DistSection'} = $distsection;
|
| 170 |
$Rsources->{ $package{'Package'} } = \%package;
|
| 171 |
};
|
| 172 |
};
|
| 173 |
close(INPUT);
|
| 174 |
}
|
| 175 |
|
| 176 |
# Priority-Checker: Gets the Priority of a package and returns a number. the
|
| 177 |
# highter the more important is the package. Warnings are printed if no Priority
|
| 178 |
# or a wrong Priority is given.
|
| 179 |
sub get_priority($) {
|
| 180 |
my ($Rpackage) = @_;
|
| 181 |
if (defined $Rpackage->{'Priority'}) {
|
| 182 |
if (defined $PRIORITY{ $Rpackage->{'Priority'} }) {
|
| 183 |
return $PRIORITY{ $Rpackage->{'Priority'} };
|
| 184 |
} else {
|
| 185 |
printf(STDERR "p E: %s has an unknown Priority entry: %s\n",$Rpackage->{'Package'},$Rpackage->{'Priority'}) if $VERBOSE;
|
| 186 |
return $DEFAULT_PRIORITY;
|
| 187 |
};
|
| 188 |
} else {
|
| 189 |
printf(STDERR "p W: %s has no Priority entry.\n",$Rpackage->{'Package'}) if $VERBOSE;
|
| 190 |
return $DEFAULT_PRIORITY;
|
| 191 |
};
|
| 192 |
};
|
| 193 |
|
| 194 |
# Checks whether the is_version satisfies the depends_version
|
| 195 |
#
|
| 196 |
# For this dpkg is called since it simply knows best about what itself considers
|
| 197 |
# newer. If speed matters code it in perl.
|
| 198 |
sub version_ok($$) {
|
| 199 |
my ($depends, $is) = @_;
|
| 200 |
return $VERSION_CACHE{$is}->{$depends} if defined ($VERSION_CACHE{$is}->{$depends});
|
| 201 |
$depends =~ /^\s*(<=|<<|<|=|>|>=|>>)\s*([^=<>]*?)\s*$/ or die("Could not parse '$depends'");
|
| 202 |
my $version_depends = $2;
|
| 203 |
my $type_depends = $1; # <, <=, >> etc..
|
| 204 |
$VERSION_CACHE{$is}->{$depends} = ! system("/usr/bin/dpkg", "--compare-versions", $is, $type_depends, $version_depends);
|
| 205 |
return $VERSION_CACHE{$is}->{$depends};
|
| 206 |
};
|
| 207 |
|
| 208 |
|
| 209 |
|
| 210 |
####################################################################################################
|
| 211 |
sub registerSummaryItem($$$$) {
|
| 212 |
my ($type, $archs, $pkg, $maint) = @_;
|
| 213 |
|
| 214 |
$PROBLEMINDEX{$pkg}->{$type}=$maint;
|
| 215 |
|
| 216 |
$PROBLEMLIST{$type}->{$pkg}->{'ANY'} = $maint;
|
| 217 |
if (defined $archs) {
|
| 218 |
for my $arch (keys %$archs) {
|
| 219 |
$PROBLEMLIST{$type}->{$pkg}->{$arch} = $archs->{$arch};
|
| 220 |
};
|
| 221 |
};
|
| 222 |
};
|
| 223 |
|
| 224 |
###########################################################################
|
| 225 |
###########################################################################
|
| 226 |
sub makeheader($$) {
|
| 227 |
my ($pkg, $problems) = @_;
|
| 228 |
my $maint = defined $problems->{$pkg}->{'Maintainer'} ? $problems->{$pkg}->{'Maintainer'} : '[unknown source package]';
|
| 229 |
my $ver = defined $problems->{$pkg}->{'Version'} ? $problems->{$pkg}->{'Version'} : '[unknown source package]';
|
| 230 |
my $section = defined $problems->{$pkg}->{'DistSection'} ? $problems->{$pkg}->{'DistSection'} : '[unknown source package]';
|
| 231 |
$maint =~ s/([<>"&])/ $entity{$1} /exg;
|
| 232 |
$ver =~ s/([<>"&])/ $entity{$1} /exg;
|
| 233 |
my $bts = $LINK_BTS_SRC.url($pkg);
|
| 234 |
print FILE << "EOF";
|
| 235 |
<h1>Problems for source package $pkg</h1>
|
| 236 |
Current Source Version: $ver<br>
|
| 237 |
Current Maintainer: $maint<br>
|
| 238 |
Section: $section<br>
|
| 239 |
BTS entry: <a href="$bts">$LINK_BTS_SRC$pkg</a><br>
|
| 240 |
<p>
|
| 241 |
EOF
|
| 242 |
};
|
| 243 |
###########################################################################
|
| 244 |
sub makebinheader($$) {
|
| 245 |
my ($binpkg, $version) = @_;
|
| 246 |
my $bts = $LINK_BTS.url($binpkg);
|
| 247 |
print FILE << "EOF";
|
| 248 |
<h1>Binary Package: $binpkg (Version: $version)</h1>
|
| 249 |
BTS entry: <a href="$bts">$LINK_BTS$binpkg</a><br>
|
| 250 |
<p>
|
| 251 |
EOF
|
| 252 |
};
|
| 253 |
###########################################################################
|
| 254 |
sub makefooter($) {
|
| 255 |
my ($pkg) = @_;
|
| 256 |
print FILE << "EOF";
|
| 257 |
<p>
|
| 258 |
<hr>
|
| 259 |
Last updated: $NOW
|
| 260 |
EOF
|
| 261 |
};
|
| 262 |
###########################################################################
|
| 263 |
sub url($) {
|
| 264 |
my ($url) = @_;
|
| 265 |
$url =~ s/([^A-Za-z0-9 ])/ '%' . unpack("H2", $1) /gex;
|
| 266 |
$url =~ s/ /+/g;
|
| 267 |
return $url;
|
| 268 |
};
|
| 269 |
|
| 270 |
|
| 271 |
|
| 272 |
###########################################################################
|
| 273 |
################### CHECKS ################################################
|
| 274 |
###########################################################################
|
| 275 |
# Checks whether source packages are at least at a certain Standards-Version
|
| 276 |
sub checkStandardsVersion($$$$) {
|
| 277 |
my ($Rsources, $Rproblems, $major, $minor) = @_;
|
| 278 |
for my $packagename (keys %$Rsources) {
|
| 279 |
if (defined $Rsources->{$packagename}->{'Standards-Version'}) {
|
| 280 |
my $thismajor;
|
| 281 |
my $thisminor;
|
| 282 |
if ($Rsources->{$packagename}->{'Standards-Version'} =~ /^(\d+)\.(\d+)\.\d+(\.\d+)?$/) {
|
| 283 |
$thismajor=$1;
|
| 284 |
$thisminor=$2;
|
| 285 |
} elsif ($Rsources->{$packagename}->{'Standards-Version'} =~ /^(\d+)\.(\d+)$/) {
|
| 286 |
$thismajor=$1;
|
| 287 |
$thisminor=$2;
|
| 288 |
$Rproblems->
|
| 289 |
{$packagename}->
|
| 290 |
{'Wrong-Standards-Version-Syntax'} = $Rsources->{$packagename}->{'Standards-Version'};
|
| 291 |
} else {
|
| 292 |
$Rproblems->
|
| 293 |
{$packagename}->
|
| 294 |
{'Wrong-Standards-Version-Syntax'} = $Rsources->{$packagename}->{'Standards-Version'};
|
| 295 |
};
|
| 296 |
if ((defined $thismajor) && (($major > $thismajor) || (($major == $thismajor) && ($minor > $thisminor)))) {
|
| 297 |
$Rproblems->
|
| 298 |
{$packagename}->
|
| 299 |
{'Standards-Version'} = $Rsources->{$packagename}->{'Standards-Version'};
|
| 300 |
};
|
| 301 |
} else {
|
| 302 |
$Rproblems->
|
| 303 |
{$packagename}->
|
| 304 |
{'No-Standards-Version'} = 1;
|
| 305 |
}
|
| 306 |
};
|
| 307 |
};
|
| 308 |
|
| 309 |
# Dependancy-Checker: Checks whether "Pre-Depends", "Depends", "Recommends" or
|
| 310 |
# "Suggests" can be satisfied. The parameter $tocheck has to either be
|
| 311 |
# "Pre-Depends" "Depends","Recommends" or "Suggests" depending on what you want
|
| 312 |
# to be checked.
|
| 313 |
#
|
| 314 |
# The regexp checks for the package name, optional whitespace, delimit a
|
| 315 |
# subpattern without saving, it as a subpattern and optional version part.
|
| 316 |
#
|
| 317 |
# Ff this dependency has a version flag, the use of virtual packages is not
|
| 318 |
# allowed, so we only check real packages. Then check whether the dependency was
|
| 319 |
# satisfied by a real package. Check wheter we only depend on packages with a
|
| 320 |
# higher or equal Priority. Whine about beeing unsatisfied, but the dependency
|
| 321 |
# can be satisfied with another package in an alternatives block then say so.
|
| 322 |
sub checkRelationships($$$$$) {
|
| 323 |
my ($Rarchs, $Rproblems, $tocheck, $check_priority, $checkmaindepends) = @_;
|
| 324 |
|
| 325 |
my @packages;
|
| 326 |
for my $arch (@ARCHS) {
|
| 327 |
push @packages, keys %{ $Rarchs->{$arch}->{'packages'} };
|
| 328 |
};
|
| 329 |
|
| 330 |
my %unique;
|
| 331 |
@packages = grep { !$unique{$_}++ } @packages;
|
| 332 |
|
| 333 |
|
| 334 |
for my $packagename (@packages) {
|
| 335 |
for my $arch (@ARCHS) {
|
| 336 |
my $Rpackages = $Rarchs->{$arch}->{'packages'};
|
| 337 |
my $Rprovides = $Rarchs->{$arch}->{'provides'};
|
| 338 |
|
| 339 |
if (defined $Rpackages->{$packagename} &&
|
| 340 |
defined $Rpackages->{$packagename}->{$tocheck}) {
|
| 341 |
my $checknr=0;
|
| 342 |
for my $dependency ( split /\s*,\s*/, $Rpackages->{$packagename}->{$tocheck} ) {
|
| 343 |
$checknr++;
|
| 344 |
my %relationship_problems = ();
|
| 345 |
my $at_least_one_ok_alternatives = 0;
|
| 346 |
my %priority_problems = ();
|
| 347 |
my $priority_ok = 0;
|
| 348 |
my $checked_priority = 0;
|
| 349 |
my $this_priority;
|
| 350 |
my $depends_withinmain_ok = 0;
|
| 351 |
my %withinmain_problems = ();
|
| 352 |
if ($check_priority) {
|
| 353 |
$this_priority = get_priority( $Rpackages->{$packagename} );
|
| 354 |
};
|
| 355 |
for my $partdependency ( split /\s*\|\s*/, $dependency ) {
|
| 356 |
$partdependency =~ /^\s*([a-zA-Z0-9.+_-]+)\s*(?:\((.*)\))?\s*$/x ||
|
| 357 |
die ("Could not parse '$partdependency'");
|
| 358 |
my $depends_name = $1;
|
| 359 |
my $depends_version = $2;
|
| 360 |
if (defined $depends_version && ! ($depends_version =~ /^\s*(<=|<<|<|=|>|>=|>>)\s*([^=<>]*?)\s*$/)) {
|
| 361 |
$Rproblems->
|
| 362 |
{ $Rpackages->{$packagename}->{'Source'} }->
|
| 363 |
{'bin'}->
|
| 364 |
{$packagename}->
|
| 365 |
{ $Rpackages->{$packagename}->{'Version'} }->
|
| 366 |
{'malformed-relationship'}->
|
| 367 |
{$tocheck}->
|
| 368 |
{$partdependency}->
|
| 369 |
{$arch} = 1;
|
| 370 |
next;
|
| 371 |
};
|
| 372 |
my $ok = (defined $Rprovides->{$depends_name}) ||
|
| 373 |
((defined $Rpackages->{$depends_name}) &&
|
| 374 |
(! (defined $depends_version) ||
|
| 375 |
version_ok( $depends_version, $Rpackages->{$depends_name}->{'Version'})
|
| 376 |
));
|
| 377 |
if ($ok) {
|
| 378 |
if ($Rpackages->{$packagename}->{'Section'} !~ /$OLDLIBS/ and
|
| 379 |
defined $Rpackages->{$depends_name}) {
|
| 380 |
if ($Rpackages->{$depends_name}->{'Section'} =~ /$OLDLIBS/) {
|
| 381 |
$Rproblems->
|
| 382 |
{ $Rpackages->{$packagename}->{'Source'} }->
|
| 383 |
{'bin'}->
|
| 384 |
{$packagename}->
|
| 385 |
{ $Rpackages->{$packagename}->{'Version'} }->
|
| 386 |
{'oldlibs'}->
|
| 387 |
{$tocheck}->
|
| 388 |
{$partdependency}->
|
| 389 |
{$arch} = $Rpackages->{$depends_name}->{'Section'};
|
| 390 |
};
|
| 391 |
if ($checkmaindepends &&
|
| 392 |
($Rpackages->{$packagename}->{'DistSection'} eq $MAIN) &&
|
| 393 |
($Rpackages->{$depends_name}->{'DistSection'} ne $MAIN)) {
|
| 394 |
$withinmain_problems{$partdependency} =
|
| 395 |
$Rpackages->{$packagename}->{'DistSection'}.':'.$Rpackages->{$depends_name}->{'DistSection'};
|
| 396 |
} else {
|
| 397 |
$depends_withinmain_ok = 1;
|
| 398 |
};
|
| 399 |
if ($check_priority) {
|
| 400 |
my $other_priority = get_priority( $Rpackages->{$depends_name} );
|
| 401 |
$checked_priority = 1;
|
| 402 |
if ($other_priority < $this_priority) {
|
| 403 |
$priority_problems{$partdependency}->
|
| 404 |
{ $PRIORITY_REV{$this_priority}.':'.$PRIORITY_REV{$other_priority} } = 1;
|
| 405 |
} else {
|
| 406 |
$priority_ok = 1;
|
| 407 |
}
|
| 408 |
};
|
| 409 |
} else {
|
| 410 |
if ($check_priority) {
|
| 411 |
for my $provider (@{$Rprovides->{$depends_name}}) {
|
| 412 |
my $other_priority = get_priority( $Rpackages->{ $provider } );
|
| 413 |
if ($other_priority >= $this_priority) {
|
| 414 |
$priority_ok = 1;
|
| 415 |
};
|
| 416 |
};
|
| 417 |
};
|
| 418 |
};
|
| 419 |
} else {
|
| 420 |
$relationship_problems{$partdependency} = defined $Rpackages->{$depends_name} ? $Rpackages->{$depends_name}->{'Version'} : '';
|
| 421 |
};
|
| 422 |
$at_least_one_ok_alternatives ||= $ok;
|
| 423 |
};
|
| 424 |
if ($checked_priority && !$priority_ok) {
|
| 425 |
for my $partdependency (keys %priority_problems) {
|
| 426 |
for my $priType (keys %{$priority_problems{$partdependency}}) {
|
| 427 |
$Rproblems->
|
| 428 |
{ $Rpackages->{$packagename}->{'Source'} }->
|
| 429 |
{'bin'}->
|
| 430 |
{$packagename}->
|
| 431 |
{ $Rpackages->{$packagename}->{'Version'} }->
|
| 432 |
{'priority'}->
|
| 433 |
{$tocheck}->
|
| 434 |
{$dependency}->
|
| 435 |
{$partdependency}->
|
| 436 |
{$priType}->
|
| 437 |
{$arch} = 1;
|
| 438 |
};
|
| 439 |
};
|
| 440 |
};
|
| 441 |
for my $partdependency (keys %relationship_problems) {
|
| 442 |
$Rproblems->
|
| 443 |
{ $Rpackages->{$packagename}->{'Source'} }->
|
| 444 |
{'bin'}->
|
| 445 |
{$packagename}->
|
| 446 |
{ $Rpackages->{$packagename}->{'Version'} }->
|
| 447 |
{$at_least_one_ok_alternatives ? 'halfbroken-relationship' : 'relationship'}->
|
| 448 |
{$tocheck}->
|
| 449 |
{$dependency}->
|
| 450 |
{$partdependency}->
|
| 451 |
{$arch} = $relationship_problems{$partdependency};
|
| 452 |
};
|
| 453 |
unless ($depends_withinmain_ok) {
|
| 454 |
for my $partdependency (keys %withinmain_problems) {
|
| 455 |
$Rproblems->
|
| 456 |
{ $Rpackages->{$packagename}->{'Source'} }->
|
| 457 |
{'bin'}->
|
| 458 |
{$packagename}->
|
| 459 |
{ $Rpackages->{$packagename}->{'Version'} }->
|
| 460 |
{'withinmain'}->
|
| 461 |
{$tocheck}->
|
| 462 |
{$dependency}->
|
| 463 |
{$partdependency}->
|
| 464 |
{$arch} = $withinmain_problems{$partdependency};
|
| 465 |
};
|
| 466 |
};
|
| 467 |
};
|
| 468 |
};
|
| 469 |
};
|
| 470 |
};
|
| 471 |
};
|
| 472 |
|
| 473 |
|
| 474 |
# Checks whether build depends can be satisfied
|
| 475 |
sub checkBuildDepends($$$) {
|
| 476 |
my ($Rsources, $Rarch, $Rproblems) = @_;
|
| 477 |
for my $packagename (keys %$Rsources) {
|
| 478 |
if (defined $Rsources->{$packagename}->{'Build-Depends'}) {
|
| 479 |
my @archs;
|
| 480 |
if ($Rsources->{$packagename}->{'Architecture'} =~ /^all|any$/) {
|
| 481 |
@archs = @ARCHS;
|
| 482 |
} else {
|
| 483 |
for my $thisarch (split /\s+/, $Rsources->{$packagename}->{'Architecture'}) {
|
| 484 |
for my $knownarch (@ARCHS) {
|
| 485 |
push (@archs, $knownarch) if ($thisarch eq $knownarch);
|
| 486 |
};
|
| 487 |
};
|
| 488 |
};
|
| 489 |
|
| 490 |
for my $arch (@archs) {
|
| 491 |
my $Rpackages = $Rarch->{$arch}->{'packages'};
|
| 492 |
my $Rprovides = $Rarch->{$arch}->{'provides'};
|
| 493 |
my $checknr=0;
|
| 494 |
for my $dependency ( split /\s*,\s*/, $Rsources->{$packagename}->{'Build-Depends'} ) {
|
| 495 |
$checknr++;
|
| 496 |
my %relationship_problems = ();
|
| 497 |
my $at_least_one_ok_alternatives = 0;
|
| 498 |
for my $partdependency ( split /\s*\|\s*/, $dependency ) {
|
| 499 |
# Check if this part-dependency has a more or less proper syntax.
|
| 500 |
# this tends to cach stuff like "Build-Depends: foo bar" (i.e. missing separator)
|
| 501 |
if (! ($partdependency =~ /^\s*([a-zA-Z0-9.+_-]+)\s*(?:\((.*)\))?\s*(?:\[\s*(.*?)\s*\])?$/x)) {
|
| 502 |
$Rproblems->
|
| 503 |
{$packagename}->
|
| 504 |
{'malformed-build-depends'}->
|
| 505 |
{$dependency}->
|
| 506 |
{$partdependency} = 1;
|
| 507 |
next;
|
| 508 |
};
|
| 509 |
my $depends_name = $1;
|
| 510 |
my $depends_version = $2;
|
| 511 |
my $depends_archs = $3;
|
| 512 |
my $bad_syntax = 0;
|
| 513 |
if (defined $depends_archs) {
|
| 514 |
my $neg;
|
| 515 |
my $includes = 0;
|
| 516 |
$depends_archs =~ s/\!\s*/!/g;
|
| 517 |
for my $this_depend_arch ( split /\s+/, $depends_archs ) {
|
| 518 |
my $thisneg = substr($this_depend_arch, 0, 1) eq '!';
|
| 519 |
unless (defined $neg) {
|
| 520 |
$neg = $thisneg;
|
| 521 |
} elsif ($neg != $thisneg) {
|
| 522 |
$bad_syntax = 1;
|
| 523 |
last;
|
| 524 |
}
|
| 525 |
substr($this_depend_arch, 0, 1) = '' if ($thisneg);
|
| 526 |
next unless $this_depend_arch eq $arch;
|
| 527 |
$includes = 1;
|
| 528 |
# last; # don't make last so we catch bad_syntax above.
|
| 529 |
};
|
| 530 |
next if (((!$includes && !$neg) || ($includes && $neg)) && !$bad_syntax);
|
| 531 |
};
|
| 532 |
if ($bad_syntax || (defined $depends_version && ! ($depends_version =~ /^\s*(<=|<<|<|=|>|>=|>>)\s*([^=<>]*?)\s*$/))) {
|
| 533 |
$Rproblems->
|
| 534 |
{$packagename}->
|
| 535 |
{'malformed-build-depends'}->
|
| 536 |
{$partdependency} = $partdependency;
|
| 537 |
next;
|
| 538 |
};
|
| 539 |
#my $ok = (defined $depends_version) ?
|
| 540 |
# (defined $Rpackages->{$depends_name}) && version_ok( $depends_version, $Rpackages->{$depends_name}->{'Version'}):
|
| 541 |
# (defined $Rpackages->{$depends_name}) || (defined $Rprovides->{$depends_name});
|
| 542 |
my $ok = (defined $Rprovides->{$depends_name}) ||
|
| 543 |
((defined $Rpackages->{$depends_name}) &&
|
| 544 |
(! (defined $depends_version) ||
|
| 545 |
version_ok( $depends_version, $Rpackages->{$depends_name}->{'Version'})
|
| 546 |
));
|
| 547 |
if (!$ok) {
|
| 548 |
$relationship_problems{$partdependency} = defined $Rpackages->{$depends_name} ? $Rpackages->{$depends_name}->{'Version'} : '';
|
| 549 |
};
|
| 550 |
$at_least_one_ok_alternatives ||= $ok;
|
| 551 |
};
|
| 552 |
for my $partdependency (keys %relationship_problems) {
|
| 553 |
$Rproblems->
|
| 554 |
{$packagename}->
|
| 555 |
{$at_least_one_ok_alternatives ? 'halfbroken-build-depends' : 'build-depends'}->
|
| 556 |
{$dependency}->
|
| 557 |
{$partdependency}->
|
| 558 |
{$arch} = $relationship_problems{$partdependency};
|
| 559 |
};
|
| 560 |
};
|
| 561 |
};
|
| 562 |
};
|
| 563 |
};
|
| 564 |
};
|
| 565 |
|
| 566 |
###########################################################################
|
| 567 |
################### OUTPUT ################################################
|
| 568 |
###########################################################################
|
| 569 |
sub builddepends($$$$$) {
|
| 570 |
my ($pkg, $prob, $maint, $section, $Rarchs) = @_;
|
| 571 |
print FILE "<h1>BuildDepends</h1><p>";
|
| 572 |
my %broken_archs=();
|
| 573 |
for my $dependency (keys %$prob) {
|
| 574 |
for my $partdependency (keys %{$prob->{$dependency}}) {
|
| 575 |
for my $arch (keys %{$prob->{$dependency}->{$partdependency}}) {
|
| 576 |
print FILE "Package declares a build time dependency on $dependency which cannot be satisfied on $arch.";
|
| 577 |
if ($prob->{$dependency}->{$partdependency}->{$arch} ne '') {
|
| 578 |
print FILE " $partdependency ".$prob->{$dependency}->{$partdependency}->{$arch}." is available.";
|
| 579 |
};
|
| 580 |
my $exists = exists $Rarchs->{$arch}->{'packages'}->{$pkg};
|
| 581 |
unless ($exists) {
|
| 582 |
print FILE " Package $pkg does not exist on $arch.";
|
| 583 |
}
|
| 584 |
print FILE "<br>\n";
|
| 585 |
$broken_archs{$arch}= $exists ? 1 : -1;
|
| 586 |
};
|
| 587 |
};
|
| 588 |
};
|
| 589 |
registerSummaryItem('build-depends', \%broken_archs, $pkg, $maint);
|
| 590 |
registerSummaryItem('main-only-build-depends', \%broken_archs, $pkg, $maint) if ($section eq 'main');
|
| 591 |
};
|
| 592 |
|
| 593 |
sub halfbrokenbuilddepends($$$$) {
|
| 594 |
my ($pkg, $prob, $maint, $section) = @_;
|
| 595 |
print FILE "<h1>Half Broken Build-Depends</h1>(not necessarily bugs)<p>";
|
| 596 |
my %broken_archs=();
|
| 597 |
for my $dependency (keys %$prob) {
|
| 598 |
for my $partdependency (keys %{$prob->{$dependency}}) {
|
| 599 |
for my $arch (keys %{$prob->{$dependency}->{$partdependency}}) {
|
| 600 |
print FILE "Package declares a build time dependency on $partdependency which cannot be satisfied on $arch.";
|
| 601 |
if ($prob->{$dependency}->{$partdependency}->{$arch} ne '') {
|
| 602 |
print FILE " $partdependency ".$prob->{$dependency}->{$partdependency}->{$arch}." is available.";
|
| 603 |
};
|
| 604 |
print FILE " At least one of $dependency can be satisfied however.<br>\n";
|
| 605 |
$broken_archs{$arch}=1;
|
| 606 |
};
|
| 607 |
};
|
| 608 |
};
|
| 609 |
registerSummaryItem('halfbroken-build-depends', \%broken_archs, $pkg, $maint);
|
| 610 |
registerSummaryItem('main-only-halfbroken-build-depends', \%broken_archs, $pkg, $maint) if ($section eq 'main');
|
| 611 |
};
|
| 612 |
|
| 613 |
sub malformedbuilddepends($$$$) {
|
| 614 |
my ($pkg, $prob, $maint, $section) = @_;
|
| 615 |
print FILE "<h1>Malformed Build-Depends</h1><p>";
|
| 616 |
for my $dependency (keys %$prob) {
|
| 617 |
print FILE "Package declares a build time dependency on '$dependency' which is broken Syntax.<br>\n";
|
| 618 |
};
|
| 619 |
registerSummaryItem('malformed-build-depends', undef, $pkg, $maint);
|
| 620 |
registerSummaryItem('main-only-malformed-build-depends', undef, $pkg, $maint) if ($section eq 'main');
|
| 621 |
};
|
| 622 |
|
| 623 |
sub standardversion($$$$) {
|
| 624 |
my ($pkg, $prob, $maint, $section) = @_;
|
| 625 |
print FILE "<h1>Standards-Version</h1><p>";
|
| 626 |
print FILE "Package has a Standards-Version of $prob which is pretty old.<br>\n";
|
| 627 |
registerSummaryItem('Standards-Version', undef, $pkg, $maint);
|
| 628 |
registerSummaryItem('main-only-Standards-Version', undef, $pkg, $maint) if ($section eq 'main');
|
| 629 |
};
|
| 630 |
|
| 631 |
sub wrongstandardversion($$$$) {
|
| 632 |
my ($pkg, $prob, $maint, $section) = @_;
|
| 633 |
print FILE "<h1>Wrong-Standards-Version-Syntax</h1><p>";
|
| 634 |
print FILE "Package has a Standards-Version of '$prob' which is broken Syntax.<br>\n";
|
| 635 |
registerSummaryItem('Wrong-Standards-Version-Syntax', undef, $pkg, $maint);
|
| 636 |
registerSummaryItem('main-only-Wrong-Standards-Version-Syntax', undef, $pkg, $maint) if ($section eq 'main');
|
| 637 |
};
|
| 638 |
|
| 639 |
sub nostandardversion($$$$) {
|
| 640 |
my ($pkg, $prob, $maint, $section) = @_;
|
| 641 |
print FILE << "EOF";
|
| 642 |
<h1>Missing Standards-Version</h1>
|
| 643 |
<p>
|
| 644 |
According to Policy <a href="http://www.debian.org/doc/debian-policy/ch-source.html#s-standardsversion">Section 4.1: Standards conformance</a>
|
| 645 |
packages SHOULD specify the most recent version of the packaging standards
|
| 646 |
with which the package complies in the source package's
|
| 647 |
`Standards-Version' field.
|
| 648 |
</p>
|
| 649 |
EOF
|
| 650 |
print FILE "Package has no Standards-Version.<br>\n";
|
| 651 |
registerSummaryItem('No-Standards-Version', undef, $pkg, $maint);
|
| 652 |
registerSummaryItem('main-only-No-Standards-Version', undef, $pkg, $maint) if ($section eq 'main');
|
| 653 |
};
|
| 654 |
|
| 655 |
sub priority($$$$) {
|
| 656 |
my ($pkg, $prob, $maint, $section) = @_;
|
| 657 |
print FILE << "EOF";
|
| 658 |
<h3>Priority</h3>
|
| 659 |
<p>
|
| 660 |
According to Policy <a href="http://www.debian.org/doc/debian-policy/ch-archive.html#s-priorities">Section 2.5: Priorities</a>
|
| 661 |
packages MUST NOT depend on packages with lower priority values (excluding build-time dependencies). In order
|
| 662 |
to ensure this, the priorities of one or more packages must be adjusted.
|
| 663 |
<p>
|
| 664 |
EOF
|
| 665 |
my %broken_archs=();
|
| 666 |
for my $depType (keys %$prob) {
|
| 667 |
for my $depTarget (keys %{$prob->{$depType}}) {
|
| 668 |
for my $partdepTarget (keys %{$prob->{$depType}->{$depTarget}}) {
|
| 669 |
for my $priType (keys %{$prob->{$depType}->{$depTarget}->{$partdepTarget}}) {
|
| 670 |
$priType =~ /(.*):(.*)/;
|
| 671 |
my $me = $1;
|
| 672 |
my $them = $2;
|
| 673 |
for my $arch (keys %{$prob->{$depType}->{$depTarget}->{$partdepTarget}->{$priType}}) {
|
| 674 |
if ($depTarget eq $partdepTarget) {
|
| 675 |
print FILE "Package is $me and has a $depType on $depTarget which is $them on $arch.<br>\n";
|
| 676 |
} else {
|
| 677 |
print FILE "Package is $me and has a $depType on $partdepTarget (within $depTarget) which is $them on $arch.<br>\n";
|
| 678 |
};
|
| 679 |
$broken_archs{$arch}=1;
|
| 680 |
};
|
| 681 |
};
|
| 682 |
};
|
| 683 |
};
|
| 684 |
};
|
| 685 |
registerSummaryItem('priority', \%broken_archs, $pkg, $maint);
|
| 686 |
registerSummaryItem('main-only-priority', \%broken_archs, $pkg, $maint) if ($section eq 'main');
|
| 687 |
};
|
| 688 |
|
| 689 |
sub oldlibs($$$$) {
|
| 690 |
my ($pkg, $prob, $maint, $section) = @_;
|
| 691 |
print FILE "<h3>Old Libraries</h3><p>";
|
| 692 |
my %broken_archs=();
|
| 693 |
for my $depType (keys %$prob) {
|
| 694 |
for my $depTarget (keys %{$prob->{$depType}}) {
|
| 695 |
for my $arch (keys %{$prob->{$depType}->{$depTarget}}) {
|
| 696 |
print FILE "Package has a $depType on $depTarget which is in Section ".$prob->{$depType}->{$depTarget}->{$arch}." on $arch.<br>\n";
|
| 697 |
$broken_archs{$arch}=1;
|
| 698 |
};
|
| 699 |
};
|
| 700 |
};
|
| 701 |
registerSummaryItem('oldlibs', \%broken_archs, $pkg, $maint);
|
| 702 |
registerSummaryItem('main-only-oldlibs', \%broken_archs, $pkg, $maint) if ($section eq 'main');
|
| 703 |
};
|
| 704 |
|
| 705 |
sub withinmain($$$) {
|
| 706 |
my ($pkg, $prob, $maint) = @_;
|
| 707 |
print FILE "<h3>Relationship outside main</h3><p>";
|
| 708 |
my %broken_archs=();
|
| 709 |
for my $depType (keys %$prob) {
|
| 710 |
for my $depTarget (keys %{$prob->{$depType}}) {
|
| 711 |
for my $deppartTarget (keys %{$prob->{$depType}->{$depTarget}}) {
|
| 712 |
for my $arch (keys %{$prob->{$depType}->{$depTarget}->{$deppartTarget}}) {
|
| 713 |
$prob->{$depType}->{$depTarget}->{$deppartTarget}->{$arch} =~ /(.*):(.*)/;
|
| 714 |
my $me = $1;
|
| 715 |
my $them = $2;
|
| 716 |
if ($depTarget eq $deppartTarget) {
|
| 717 |
print FILE "Package is in $me has a $depType on $depTarget which is in Section $them on $arch.<br>\n";
|
| 718 |
} else {
|
| 719 |
print FILE "Package is in $me has a $depType on $deppartTarget (within $depTarget) which is in Section $them on $arch.<br>\n";
|
| 720 |
};
|
| 721 |
$broken_archs{$arch}=1;
|
| 722 |
};
|
| 723 |
};
|
| 724 |
};
|
| 725 |
};
|
| 726 |
registerSummaryItem('withinmain', \%broken_archs, $pkg, $maint);
|
| 727 |
};
|
| 728 |
|
| 729 |
sub relationship($$$$) {
|
| 730 |
my ($pkg, $prob, $maint, $section) = @_;
|
| 731 |
print FILE "<h3>Relationships</h3><p>";
|
| 732 |
for my $depType ('Pre-Depends', 'Depends', 'Recommends', 'Suggests') {
|
| 733 |
next unless defined $prob->{$depType};
|
| 734 |
my %broken_archs=();
|
| 735 |
for my $depTarget (keys %{$prob->{$depType}}) {
|
| 736 |
for my $partdepTarget (keys %{$prob->{$depType}->{$depTarget}}) {
|
| 737 |
for my $arch (keys %{$prob->{$depType}->{$depTarget}->{$partdepTarget}}) {
|
| 738 |
print FILE "Package has a $depType on $depTarget which cannot be satisfied on $arch.";
|
| 739 |
if ($prob->{$depType}->{$depTarget}->{$partdepTarget}->{$arch} ne '') {
|
| 740 |
print FILE " $partdepTarget ".$prob->{$depType}->{$depTarget}->{$partdepTarget}->{$arch}." is available.";
|
| 741 |
};
|
| 742 |
print FILE "<br>\n";
|
| 743 |
$broken_archs{$arch}=1;
|
| 744 |
};
|
| 745 |
};
|
| 746 |
};
|
| 747 |
registerSummaryItem('relationship-'.$depType, \%broken_archs, $pkg, $maint);
|
| 748 |
registerSummaryItem('main-only-relationship-'.$depType, \%broken_archs, $pkg, $maint) if ($section eq 'main');
|
| 749 |
};
|
| 750 |
};
|
| 751 |
|
| 752 |
sub halfbrokenrelationship($$$$) {
|
| 753 |
my ($pkg, $prob, $maint, $section) = @_;
|
| 754 |
print FILE "<h3>Half Broken Relationships</h3>(not necessarily bugs)<p>";
|
| 755 |
for my $depType ('Pre-Depends', 'Depends', 'Recommends', 'Suggests') {
|
| 756 |
next unless defined $prob->{$depType};
|
| 757 |
my %broken_archs=();
|
| 758 |
for my $depTarget (keys %{$prob->{$depType}}) {
|
| 759 |
for my $partdepTarget (keys %{$prob->{$depType}->{$depTarget}}) {
|
| 760 |
for my $arch (keys %{$prob->{$depType}->{$depTarget}->{$partdepTarget}}) {
|
| 761 |
print FILE "Package has a $depType on $partdepTarget which cannot be satisfied on $arch.";
|
| 762 |
if ($prob->{$depType}->{$depTarget}->{$partdepTarget}->{$arch} ne '') {
|
| 763 |
print FILE " $partdepTarget ".$prob->{$depType}->{$depTarget}->{$partdepTarget}->{$arch}." is available.";
|
| 764 |
};
|
| 765 |
print FILE " At least one of $depTarget can be satisfied however.<br>\n";
|
| 766 |
$broken_archs{$arch}=1;
|
| 767 |
};
|
| 768 |
};
|
| 769 |
};
|
| 770 |
registerSummaryItem('halfbroken-relationship-'.$depType, \%broken_archs, $pkg, $maint);
|
| 771 |
registerSummaryItem('main-only-halfbroken-relationship-'.$depType, \%broken_archs, $pkg, $maint) if ($section eq 'main');
|
| 772 |
};
|
| 773 |
};
|
| 774 |
|
| 775 |
###########################################################################
|
| 776 |
###########################################################################
|
| 777 |
###########################################################################
|
| 778 |
|
| 779 |
my %archs;
|
| 780 |
my %sources;
|
| 781 |
|
| 782 |
my %problems;
|
| 783 |
|
| 784 |
parse_file(\%archs, \%sources);
|
| 785 |
|
| 786 |
checkStandardsVersion(\%sources, \%problems, 3, 0);
|
| 787 |
|
| 788 |
checkRelationships(\%archs, \%problems, 'Pre-Depends', 1, 1);
|
| 789 |
checkRelationships(\%archs, \%problems, 'Depends' , 1, 1);
|
| 790 |
checkRelationships(\%archs, \%problems, 'Recommends' , 0, 1);
|
| 791 |
checkRelationships(\%archs, \%problems, 'Suggests' , 0, 0);
|
| 792 |
|
| 793 |
checkBuildDepends(\%sources, \%archs, \%problems);
|
| 794 |
|
| 795 |
for (keys %problems) {
|
| 796 |
$problems{$_}->{'Maintainer'} = $sources{$_}->{'Maintainer'};
|
| 797 |
$problems{$_}->{'Version'} = $sources{$_}->{'Version'};
|
| 798 |
$problems{$_}->{'DistSection'} = $sources{$_}->{'DistSection'};
|
| 799 |
};
|
| 800 |
|
| 801 |
#require Data::Dumper;
|
| 802 |
#open (FILE, ">result.cache") || die ("Cannot open result.cache: $!\n");
|
| 803 |
#print FILE ( Data::Dumper->Dump( [ \%problems ] ) );
|
| 804 |
#close FILE;
|
| 805 |
#exit;
|
| 806 |
#
|
| 807 |
#{
|
| 808 |
# $/ = undef;
|
| 809 |
# open (FILE, "result.cache") || die ("Cannot open result.cache: $!\n");
|
| 810 |
# my $code = <FILE>;
|
| 811 |
# close FILE;
|
| 812 |
# my $VAR1;
|
| 813 |
# eval $code;
|
| 814 |
# %problems = %$VAR1;
|
| 815 |
#};
|
| 816 |
|
| 817 |
|
| 818 |
# Create per package problem reports.
|
| 819 |
for my $pkg (keys %problems) {
|
| 820 |
my $nodotpkg = $pkg;
|
| 821 |
$nodotpkg =~ s/\./_/;
|
| 822 |
open (FILE, ">$RESULTDIR_PACKAGE/$nodotpkg") || die ("Cannot open $RESULTDIR_PACKAGE/$nodotpkg: $!\n");
|
| 823 |
makeheader($pkg, \%problems);
|
| 824 |
my $section = $sources{$pkg}->{'DistSection'};
|
| 825 |
if (!defined $section) {
|
| 826 |
print(STDERR "Package $pkg has no section\n") if $VERBOSE;
|
| 827 |
$section='unknown';
|
| 828 |
}
|
| 829 |
|
| 830 |
my $maint = defined $problems{$pkg}->{'Maintainer'} ? $problems{$pkg}->{'Maintainer'} : '[unknown source package]';
|
| 831 |
$maint =~ s/([<>"&])/ $entity{$1} /exg;
|
| 832 |
|
| 833 |
my $tmp = $problems{$pkg}->{'build-depends'}; builddepends ($pkg, $tmp, $maint, $section, \%archs) if defined $tmp;
|
| 834 |
$tmp = $problems{$pkg}->{'halfbroken-build-depends'}; halfbrokenbuilddepends($pkg, $tmp, $maint, $section) if defined $tmp;
|
| 835 |
$tmp = $problems{$pkg}->{'malformed-build-depends'}; malformedbuilddepends( $pkg, $tmp, $maint, $section) if defined $tmp;
|
| 836 |
$tmp = $problems{$pkg}->{'Standards-Version'}; standardversion( $pkg, $tmp, $maint, $section) if defined $tmp;
|
| 837 |
$tmp = $problems{$pkg}->{'Wrong-Standards-Version-Syntax'}; wrongstandardversion( $pkg, $tmp, $maint, $section) if defined $tmp;
|
| 838 |
$tmp = $problems{$pkg}->{'No-Standards-Version'}; nostandardversion( $pkg, $tmp, $maint, $section) if defined $tmp;
|
| 839 |
|
| 840 |
if (defined $problems{$pkg}->{'bin'}) {
|
| 841 |
for my $binpkg (keys %{$problems{$pkg}->{'bin'}}) {
|
| 842 |
for my $version (keys %{$problems{$pkg}->{'bin'}->{$binpkg}}) {
|
| 843 |
makebinheader($binpkg, $version);
|
| 844 |
$tmp = $problems{$pkg}->{'bin'}->{$binpkg}->{$version}->{'priority'}; priority( $pkg, $tmp, $maint, $section) if defined $tmp;
|
| 845 |
$tmp = $problems{$pkg}->{'bin'}->{$binpkg}->{$version}->{'oldlibs'}; oldlibs( $pkg, $tmp, $maint, $section) if defined $tmp;
|
| 846 |
$tmp = $problems{$pkg}->{'bin'}->{$binpkg}->{$version}->{'relationship'}; relationship( $pkg, $tmp, $maint, $section) if defined $tmp;
|
| 847 |
$tmp = $problems{$pkg}->{'bin'}->{$binpkg}->{$version}->{'halfbroken-relationship'}; halfbrokenrelationship($pkg, $tmp, $maint, $section) if defined $tmp;
|
| 848 |
$tmp = $problems{$pkg}->{'bin'}->{$binpkg}->{$version}->{'withinmain'}; withinmain( $pkg, $tmp, $maint) if defined $tmp;
|
| 849 |
die ("malformed-relationship not supported yet\n") if defined $problems{$pkg}->{'bin'}->{$binpkg}->{$version}->{'malformed-relationship'};
|
| 850 |
};
|
| 851 |
};
|
| 852 |
};
|
| 853 |
makefooter($pkg);
|
| 854 |
close (FILE);
|
| 855 |
};
|
| 856 |
|
| 857 |
|
| 858 |
|
| 859 |
# Prepare PACKLIST
|
| 860 |
my %PACKLIST;
|
| 861 |
|
| 862 |
for my $problem (keys %PROBLEMLIST) {
|
| 863 |
for my $pkg (keys %{$PROBLEMLIST{$problem}}) {
|
| 864 |
my $txt = "<tr><td>". makeLinkPackage($DIST, $pkg, $pkg). "</td>";
|
| 865 |
my $all=1;
|
| 866 |
for my $arch (@ARCHS) {
|
| 867 |
if (defined $PROBLEMLIST{$problem}->{$pkg}->{$arch} && $PROBLEMLIST{$problem}->{$pkg}->{$arch} ne "-1") {
|
| 868 |
$txt .= "<td>X</td>";
|
| 869 |
} else {
|
| 870 |
if (defined $PROBLEMLIST{$problem}->{$pkg}->{$arch}) {
|
| 871 |
$txt .= "<td>.</td>";
|
| 872 |
} else {
|
| 873 |
$txt .= "<td> </td>";
|
| 874 |
$all = 0;
|
| 875 |
};
|
| 876 |
};
|
| 877 |
};
|
| 878 |
$txt .= "<td>".$PROBLEMLIST{$problem}->{$pkg}->{'ANY'}."</td></tr>\n";
|
| 879 |
|
| 880 |
push @{$PACKLIST{$problem}->{'ANY'}}, $txt;
|
| 881 |
for my $arch (@ARCHS) {
|
| 882 |
if (defined $PROBLEMLIST{$problem}->{$pkg}->{$arch}) {
|
| 883 |
push @{$PACKLIST{$problem}->{$arch}}, $txt;
|
| 884 |
};
|
| 885 |
};
|
| 886 |
|
| 887 |
if ($all) {
|
| 888 |
push @{$PACKLIST{$problem}->{'EVERY'}}, $txt;
|
| 889 |
};
|
| 890 |
};
|
| 891 |
};
|
| 892 |
|
| 893 |
|
| 894 |
# Create indizes
|
| 895 |
for my $problem (keys %PACKLIST) {
|
| 896 |
for my $arch (keys %{$PACKLIST{$problem}}) {
|
| 897 |
my %unique;
|
| 898 |
@{$PACKLIST{$problem}->{$arch}} = grep { !$unique{$_}++ } @{$PACKLIST{$problem}->{$arch}};
|
| 899 |
};
|
| 900 |
|
| 901 |
|
| 902 |
my $archlink = '';
|
| 903 |
for my $arch ('ANY', 'EVERY', @ARCHS) {
|
| 904 |
if (defined $PACKLIST{$problem}->{$arch}) {
|
| 905 |
$archlink .= makeLinkList($DIST, $problem, $arch, $arch).' ';
|
| 906 |
};
|
| 907 |
};
|
| 908 |
|
| 909 |
|
| 910 |
my $tableheader = "<table border=1><tr><th>Package</th>";
|
| 911 |
for my $arch (@ARCHS) {
|
| 912 |
$tableheader .= "<th>$arch</th>";
|
| 913 |
};
|
| 914 |
$tableheader .= "<th>Maintainer</th></tr>\n";
|
| 915 |
for my $arch ('ANY', 'EVERY', @ARCHS) {
|
| 916 |
if (defined $PACKLIST{$problem}->{$arch}) {
|
| 917 |
open (FILE, ">$RESULTDIR_LIST/$problem-$arch") || die ("Cannot open $RESULTDIR_LIST/$problem-$arch: $!\n");
|
| 918 |
print FILE "<h1>List of Packages with $problem on $arch</h1><p>Show this list for Architecture: $archlink<p>\n$tableheader";
|
| 919 |
print FILE join('', (sort @{$PACKLIST{$problem}->{$arch}}));
|
| 920 |
print FILE "</table>";
|
| 921 |
print FILE "<hr>Last updated: $NOW\n";
|
| 922 |
close FILE;
|
| 923 |
};
|
| 924 |
};
|
| 925 |
};
|
| 926 |
|
| 927 |
|
| 928 |
|
| 929 |
open (FILE, ">$RESULTDIR_LIST/ALL") || die ("Cannot open $RESULTDIR_LIST/ALL: $!\n");
|
| 930 |
open (FILELIGHT, ">$RESULTDIR_LIST/ALL-light") || die ("Cannot open $RESULTDIR_LIST/ALL-light: $!\n");
|
| 931 |
open (FILEPKPLIST, ">$RESULTDIR_LIST/ALL-pkglist") || die ("Cannot open $RESULTDIR_LIST/ALL-pkglist $!\n");
|
| 932 |
|
| 933 |
print FILE "<h1>List of all Packages with issues</h1><p>$PROBLEMINDEXTABLEHEADER";
|
| 934 |
print FILELIGHT "<h1>List of all Packages with issues</h1><p>";
|
| 935 |
|
| 936 |
for my $pkg (sort keys %PROBLEMINDEX) {
|
| 937 |
print FILE "<tr><td>". makeLinkPackage($DIST, $pkg, $pkg). "</td>";
|
| 938 |
print FILELIGHT makeLinkPackage($DIST, $pkg, $pkg). " (";
|
| 939 |
print FILEPKPLIST $pkg. "\n";
|
| 940 |
my $maint;
|
| 941 |
for (@PROBLEMS) {
|
| 942 |
if (defined $PROBLEMINDEX{$pkg}->{$_}) {
|
| 943 |
$maint = $PROBLEMINDEX{$pkg}->{$_} ;
|
| 944 |
print FILE "<td>X</td>";
|
| 945 |
print FILELIGHT " $_ ";
|
| 946 |
} else {
|
| 947 |
print FILE "<td> </td>";
|
| 948 |
};
|
| 949 |
};
|
| 950 |
print FILE "<td>$maint</td></tr>\n";
|
| 951 |
print FILELIGHT ") $maint<br>\n";
|
| 952 |
};
|
| 953 |
print FILE "</table>";
|
| 954 |
print FILE "<hr>Last updated: $NOW\n";
|
| 955 |
print FILELIGHT "<hr>Last updated: $NOW\n";
|
| 956 |
close FILE;
|
| 957 |
close FILELIGHT;
|
| 958 |
close FILEPKPLIST;
|
| 959 |
|
| 960 |
|
| 961 |
open (FILE, ">$RESULTDIR_LIST/INDEX") || die ("Cannot open $RESULTDIR_LIST/INDEX: $!\n");
|
| 962 |
|
| 963 |
my $ARCHCNT2 = scalar @ARCHS + 2;
|
| 964 |
my $ARCHCNT3 = scalar @ARCHS + 3;
|
| 965 |
|
| 966 |
my $LINK_ALL = makeLinkList($DIST, 'ALL', undef, 'table (heavy!)');
|
| 967 |
my $LINK_ALL_light = makeLinkList($DIST, 'ALL-light', undef, 'light');
|
| 968 |
|
| 969 |
print FILE << "EOF";
|
| 970 |
<h1>Summary</h1>
|
| 971 |
<p>
|
| 972 |
List of all packages with issues: $LINK_ALL or $LINK_ALL_light.
|
| 973 |
<p>
|
| 974 |
<table border=1>
|
| 975 |
<tr><th>Type of Issue</th><th colspan=$ARCHCNT2>ARCH</th></tr>
|
| 976 |
<tr><th> </th>
|
| 977 |
EOF
|
| 978 |
for my $arch ('ANY', 'EVERY', @ARCHS) { print FILE "<th>$arch</th>"; };
|
| 979 |
print FILE "</tr>\n\n";
|
| 980 |
|
| 981 |
|
| 982 |
sub makeSummaryLine($$$) {
|
| 983 |
my ($head, $prob, $onearch) = @_;
|
| 984 |
|
| 985 |
print FILE "<tr><td>$head</td>\n";
|
| 986 |
for my $arch ('ANY', 'EVERY', @ARCHS) {
|
| 987 |
print FILE "<td>".
|
| 988 |
($onearch && ($arch ne 'ANY')?
|
| 989 |
'N/A' :
|
| 990 |
(defined $PACKLIST{$prob}->{$arch} ?
|
| 991 |
makeLinkList($DIST, $prob, $arch, scalar @{$PACKLIST{$prob}->{$arch}}) :
|
| 992 |
'none'
|
| 993 |
)
|
| 994 |
).
|
| 995 |
"</td>";
|
| 996 |
};
|
| 997 |
print FILE "</tr>\n";
|
| 998 |
|
| 999 |
};
|
| 1000 |
|
| 1001 |
print FILE "<tr><td colspan=$ARCHCNT3>Broken Relationships (main only)</td></tr>\n";
|
| 1002 |
for my $depType ('Pre-Depends', 'Depends', 'Recommends', 'Suggests') {
|
| 1003 |
makeSummaryLine($depType, 'main-only-relationship-'.$depType, 0);
|
| 1004 |
};
|
| 1005 |
|
| 1006 |
print FILE "<tr><td colspan=$ARCHCNT3>Half Broken Broken Relationships (main only)</td></tr>\n";
|
| 1007 |
for my $depType ('Pre-Depends', 'Depends', 'Recommends', 'Suggests') {
|
| 1008 |
makeSummaryLine($depType, 'main-only-halfbroken-relationship-'.$depType, 0);
|
| 1009 |
};
|
| 1010 |
|
| 1011 |
print FILE "<tr><td colspan=$ARCHCNT3> </td></tr>\n";
|
| 1012 |
|
| 1013 |
print FILE "<tr><td colspan=$ARCHCNT3>Broken Relationships</td></tr>\n";
|
| 1014 |
for my $depType ('Pre-Depends', 'Depends', 'Recommends', 'Suggests') {
|
| 1015 |
makeSummaryLine($depType, 'relationship-'.$depType, 0);
|
| 1016 |
};
|
| 1017 |
|
| 1018 |
print FILE "<tr><td colspan=$ARCHCNT3>Half Broken Broken Relationships</td></tr>\n";
|
| 1019 |
for my $depType ('Pre-Depends', 'Depends', 'Recommends', 'Suggests') {
|
| 1020 |
makeSummaryLine($depType, 'halfbroken-relationship-'.$depType, 0);
|
| 1021 |
};
|
| 1022 |
|
| 1023 |
|
| 1024 |
print FILE "<tr><td colspan=$ARCHCNT3> </td></tr>\n";
|
| 1025 |
makeSummaryLine('Depends Main on !Main' , 'withinmain' , 0);
|
| 1026 |
print FILE "<tr><td colspan=$ARCHCNT3> </td></tr>\n";
|
| 1027 |
makeSummaryLine('BuildDepends' , 'build-depends' , 0);
|
| 1028 |
makeSummaryLine('Half Broken BuildDepends' , 'halfbroken-build-depends' , 0);
|
| 1029 |
makeSummaryLine('Malformed BuildDepends' , 'malformed-build-depends' , 1);
|
| 1030 |
makeSummaryLine('OldLibs' , 'oldlibs' , 0);
|
| 1031 |
makeSummaryLine('Priorty' , 'priority' , 0);
|
| 1032 |
makeSummaryLine('Old StandardsVersion' , 'Standards-Version' , 1);
|
| 1033 |
makeSummaryLine('No StandardsVersion' , 'No-Standards-Version' , 1);
|
| 1034 |
makeSummaryLine('Wrong StandardsVersion Syntax' , 'Wrong-Standards-Version-Syntax', 1);
|
| 1035 |
print FILE "<tr><td colspan=$ARCHCNT3> </td></tr>\n";
|
| 1036 |
makeSummaryLine('BuildDepends (main only)' , 'main-only-build-depends' , 0);
|
| 1037 |
makeSummaryLine('Half Broken BuildDepends (main only)' , 'main-only-halfbroken-build-depends' , 0);
|
| 1038 |
makeSummaryLine('Malformed BuildDepends (main only)' , 'main-only-malformed-build-depends' , 1);
|
| 1039 |
makeSummaryLine('OldLibs (main only)' , 'main-only-oldlibs' , 0);
|
| 1040 |
makeSummaryLine('Priorty (main only)' , 'main-only-priority' , 0);
|
| 1041 |
makeSummaryLine('Old StandardsVersion (main only)' , 'main-only-Standards-Version' , 1);
|
| 1042 |
makeSummaryLine('No StandardsVersion (main only)' , 'main-only-No-Standards-Version' , 1);
|
| 1043 |
makeSummaryLine('Wrong StandardsVersion Syntax (main only)' , 'main-only-Wrong-Standards-Version-Syntax', 1);
|
| 1044 |
|
| 1045 |
print FILE "</table>\n";
|
| 1046 |
print FILE "<hr>Last updated: $NOW\n";
|
| 1047 |
|
| 1048 |
open (FILE, ">$DONE") || die ("Cannot open $DONE: $!\n");
|
| 1049 |
close FILE;
|
| 1050 |
# vim:set ts=2:
|
| 1051 |
# vim:set shiftwidth=2:
|