commit ba5b2acc7d6c08e59bf1668c23c6395ee427ba30 Author: Chris Lamb Date: Sat Apr 7 12:44:51 2018 +0100 WIP diff --git a/commands/reporting-sync-state.pm b/commands/reporting-sync-state.pm index 80741ad3c..ad3f91e53 100644 --- a/commands/reporting-sync-state.pm +++ b/commands/reporting-sync-state.pm @@ -88,6 +88,22 @@ sub required_cfg_non_empty_list_value { return $v; } +sub cfg_list_value { + my (@keys) = @_; + my $v = $CONFIG; + for my $key (@keys) { + if (not exists($v->{$key})) { + return []; + } + $v = $v->{$key}; + } + if (ref($v) ne 'ARRAY') { + my $k = join('.', @keys); + die("Invalid configuration: ${k} must be a list (or missing)\n"); + } + return $v; +} + sub main { my ($state_dir, $state, $archives); STDOUT->autoflush; @@ -116,8 +132,9 @@ sub main { my $distributions = required_cfg_non_empty_list_value('archives', $archive, 'distributions'); + my $blacklist = cfg_list_value('archives', $archive, 'blacklist'); local_mirror_manifests($state, $path, $distributions, $components, - $archs); + $archs, $blacklist); } cleanup_state($state); @@ -333,11 +350,13 @@ sub cleanup_group_state { # Helper for local_mirror_manifests - it parses a paragraph from Sources file sub _parse_srcs_pg { - my ($state, $extra_metadata, $paragraph) = @_; + my ($state, @blacklist, $extra_metadata, $paragraph) = @_; my $dir = $paragraph->{'directory'}//''; my $group_id = $paragraph->{'package'} . '/' . $paragraph->{'version'}; my $member_id = "source:${group_id}"; my (%data, %group_metadata, $group_mirror_md); + # Apply source package blacklist + return if grep { $paragraph->{'package'} eq $_ } @$blacklist; # only include the source if it has any binaries to be checked. # - Otherwise we may end up checking a source with no binaries # (happens if the architecture is "behind" in building) @@ -369,7 +388,7 @@ sub _parse_srcs_pg { # Helper for local_mirror_manifests - it parses a paragraph from Packages file sub _parse_pkgs_pg { - my ($state, $extra_metadata, $type, $paragraph) = @_; + my ($state, $blacklist, $extra_metadata, $type, $paragraph) = @_; my ($group_id, $member_id, %data, %group_metadata, $b64_checksum); my $package = $paragraph->{'package'}; my $version = $paragraph->{'version'}; @@ -380,6 +399,8 @@ sub _parse_pkgs_pg { $paragraph->{'source'} = $1; $paragraph->{'source-version'} = $2; } + # Apply source package blacklist + return if grep { $paragraph->{'source'} eq $_ } @$blacklist; if (not defined($paragraph->{'source-version'})) { $paragraph->{'source-version'} = $paragraph->{'version'}; } @@ -413,9 +434,10 @@ sub _parse_pkgs_pg { # $dists - listref of dists to consider (e.g. ['unstable']) # $components - listref of components to consider (e.g. ['main', 'contrib', 'non-free']) # $archs - listref of archs to consider (e.g. ['i386', 'amd64']) +# $blacklist - listref of source packages to ignore (e.g. ['gcc-8-cross-ports']) # sub local_mirror_manifests { - my ($state, $mirdir, $dists, $components, $archs) = @_; + my ($state, $mirdir, $dists, $components, $archs, $blacklist) = @_; foreach my $dist (@$dists) { foreach my $component (@{$components}) { my $srcs = "$mirdir/dists/$dist/$component/source/Sources"; @@ -434,11 +456,11 @@ sub local_mirror_manifests { = "${dist_path}/debian-installer/binary-$arch/Packages"; my $pkgfd = _open_data_file($pkgs); my $binsub = sub { - _parse_pkgs_pg($state, \%extra_metadata, 'binary', @_); + _parse_pkgs_pg($state, $blacklist, \%extra_metadata, 'binary', @_); }; my $upkgfd; my $udebsub = sub { - _parse_pkgs_pg($state, \%extra_metadata, 'udeb', @_); + _parse_pkgs_pg($state, $blacklist, \%extra_metadata, 'udeb', @_); }; visit_dpkg_paragraph($binsub, $pkgfd); close($pkgfd); @@ -447,7 +469,7 @@ sub local_mirror_manifests { close($upkgfd); } $srcfd = _open_data_file($srcs); - $srcsub = sub { _parse_srcs_pg($state, \%extra_metadata, @_) }; + $srcsub = sub { _parse_srcs_pg($state, $blacklist, \%extra_metadata, @_) }; visit_dpkg_paragraph($srcsub, $srcfd); close($srcfd); } diff --git a/reporting/config.yaml b/reporting/config.yaml index 8d878eefd..a0c912eec 100644 --- a/reporting/config.yaml +++ b/reporting/config.yaml @@ -25,6 +25,8 @@ archives: distributions: - unstable - experimental + blacklist: + - gcc-8-cross-ports debian-debug: tracefile: ftp-master.debian.org base-dir: /srv/mirrors/debian-debug