From: Joachim Breitner Date: Mon, 27 Jul 2009 22:49:25 +0000 (+0200) Subject: edos-builddebcheck X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=a20f20f9ce15f8c896e9ec469db8a3e637b97961;p=wannabuild.git edos-builddebcheck This file from edos-distcheck needs to be made more flexible for our use. The changes can probably be migrated back to them. We still depend on edos-distcheck (>= 1.4.2-1) for edos-debcheck support. --- diff --git a/bin/edos-builddebcheck b/bin/edos-builddebcheck new file mode 100755 index 0000000..6941fd5 --- /dev/null +++ b/bin/edos-builddebcheck @@ -0,0 +1,132 @@ +#!/usr/bin/perl -w + +# Copyright (C) 2008 Ralf Treinen +# 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, version 2 of the License. + +$debug=0; + +# the prefix used to encode source packages +$sourceprefix="source---"; + +$architecture=""; +$binexplain=0; +$edosoptions = "-failures -explain"; +while ( $arg = shift @ARGV ) { + if ( $arg eq '-a' || $arg eq '--architecture' ) { + if ($#ARGV == -1) { + die "-a option needs a value"; + } else { + $architecture = shift @ARGV; + } + } elsif ( $arg =~ "--binexplain" || $arg =~ "-be" ) { + $binexplain = 1; + } elsif ( $arg =~ /^-.*/ ) { + die "unrecognized option: $arg"; + } else { + last; + } +} + +if ($#ARGV != 0) { + die "Usage: edos-debbuildcheck [options] Packages Sources" +} else { + $packagefile = $arg; + $sourcesfile = shift(@ARGV); +} + +if ($debug) { + print "Arch: $architecture\n"; + print "Packages: $packagefile\n"; + print "Sources: $sourcesfile\n"; + print "Edos options: $edosoptions\n"; +} + +$packagearch=""; +open(P,$packagefile); +while (

) { + next unless /^Architecture/; + next if /^Architecture:\s*all/; + /Architecture:\s*([^\s]*)/; + if ($packagearch eq "") { + $packagearch = $1; + } elsif ( $packagearch ne $1) { + die "Package file contains different architectures: $packagearch, $1"; + } +} +close P; + +if ( $architecture eq "" ) { + if ( $packagearch eq "" ) { + die "No architecture option given, " . + "and no non-all architecture found in the Packages file"; + } else { + $architecture = $packagearch; + } +} else { + if ( $packagearch ne "" & $architecture ne $packagearch) { + die "Architecture option is $architecture ". + "but the package file contains architecture $packagearch"; + } +} + +open(RESULT,"python /usr/share/edos-distcheck/add-sources.py ". + "--prefix \"$sourceprefix\" < $packagefile $sourcesfile $architecture ". + "| edos-debcheck $edosoptions|"); + +$sourcestanza=0; +$explanation=""; +$binpackage=""; + +while () { + if (/^\s+/) { + if ($sourcestanza) { + s/^(\s*)$sourceprefix(.*)(depends on|conflicts with)/$1$2build-$3/o; + print; + if (/depends on ([^\s]*) .*\{.*\}/) { + push(@binqueue,$1); + } + } else { + $explanation .= $_; + } + } else { + if ($binpackage ne ""){ + $binfailures{$binpackage} = $explanation; + $binpackage=""; + } + if (/^$sourceprefix.*: FAILED/o) { + s/^$sourceprefix//o; + print; + + $_=; + print; + + $sourcestanza=1; + } elsif (/^([^\s]*) .*: FAILED/) { + $binpackage=$1; + $explanation=$_; + $explanation.=; + $sourcestanza=0; + } else { + # we have someting strange here + $sourcestanza=0; + } + } +} + +close RESULT; + +if ($binexplain) { + while (@binqueue) { + $p=pop(@binqueue); + $v=$binfailures{$p}; + next unless defined $v; + $binfailures{$p}=""; + print "$v" if $v ne ""; + if ($v=~/depends on ([^\s]*) .*\{.*\}/) { + push(@binqueue,$1); + } + } +} +