Commit a2990efe authored by Ivo De Decker's avatar Ivo De Decker

update-key-packages.pl: support build-depends-arch

Get all the build-depends fields in a single query, and add the
build-depends-arch field, which was missing.
Signed-off-by: Ivo De Decker's avatarIvo De Decker <ivodd@debian.org>
parent 99ae297d
......@@ -26,6 +26,7 @@ my $TESTING='';
my $testing_archs = {};
my $debug = 0;
$| = 1 if ($debug);
my $now = time;
sub debug {
......@@ -89,28 +90,35 @@ sub is_testing_arch {
sub get_depends {
my $handle = shift;
my $query = shift;
my $type = shift;
my $pkgfield = shift;
my $depfields = shift;
my $pkgs = shift;
my $sthc = do_query($handle,$query);
while (my ($pkg,$deps) = $sthc->fetchrow_array()) {
next unless $deps;
foreach my $dep (split(/\s*[|,]\s*/,$deps)) {
my $d = $dep;
$dep =~ s/\([^\)]*\)//og;
$dep =~ s/<[^\>]*>//og;
$dep =~ s/^\s*+//o;
$dep =~ s/\s*+$//o;
if ($dep =~ s/\s*\[([^\]]*)\]//og) {
unless (is_testing_arch($1)) {
#print "skip $pkg $type $dep $d not in testing\n";
next;
while (my $row = $sthc->fetchrow_hashref()) {
my $pkg = $row->{$pkgfield};
for my $field (@$depfields) {
my $deps = $row->{$field};
next unless $deps;
foreach my $dep (split(/\s*[|,]\s*/,$deps)) {
my $d = $dep;
$dep =~ s/\([^\)]*\)//og;
$dep =~ s/<[^\>]*>//og;
$dep =~ s/^\s*+//o;
$dep =~ s/\s*+$//o;
if ($dep =~ s/\s*\[([^\]]*)\]//og) {
unless (is_testing_arch($1)) {
#print "skip $pkg $type $dep $d not in testing\n";
next;
}
}
}
my $info = "$pkg $type $dep";
unless (defined $pkgs->{$dep}) {
$pkgs->{$dep} = $info;
my $type = $field;
$type =~ s/_/-/g;
my $info = "$pkg $type $dep";
unless (defined $pkgs->{$dep}) {
$pkgs->{$dep} = $info;
}
}
}
}
......@@ -184,29 +192,24 @@ while (1) {
my $pkgs = {};
debug "# Getting build-depends for sources\n";
get_depends($dbh,"select source,build_depends from sources
where release='$TESTING' and source in ('".join("','",keys %$newsrcs)."')","build-depends",$pkgs);
get_depends($dbh,"select source,build_depends,build_depends_indep,build_depends_arch from sources
where release='$TESTING' and source in ('".join("','",keys %$newsrcs)."')","source",["build_depends","build_depends_indep","build_depends_arch"],$pkgs);
debug "# Getting sources for build-depends\n";
my $newsrcs_a = add_pkg_sources($dbh,$srcs,$pkgs);
debug "# Getting build-depends-indep for sources\n";
get_depends($dbh,"select source,build_depends_indep from sources
where release='$TESTING' and source in ('".join("','",keys %$newsrcs)."')","build-depends-indep",$pkgs);
my $newsrcs_b = add_pkg_sources($dbh,$srcs,$pkgs);
my $newsrcs_c = {};
if ($do_deps) {
$pkgs = {};
debug "# Getting depends for sources\n";
get_depends($dbh,"select package,depends from packages
where release='$TESTING' and source in ('".join("','",keys %$newsrcs)."')","depends",$pkgs);
where release='$TESTING' and source in ('".join("','",keys %$newsrcs)."')","package",["depends"],$pkgs);
debug "# Getting sources for depends\n";
$newsrcs_c = add_pkg_sources($dbh,$srcs,$pkgs);
}
$newsrcs = {%$newsrcs_a,%$newsrcs_b,%$newsrcs_c};
$newsrcs = {%$newsrcs_a,%$newsrcs_c};
debug "# Adding ".(scalar keys %$newsrcs)." source packages: ".join(" ",sort keys %$newsrcs)."\n";
last unless scalar keys %$newsrcs;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment