summaryrefslogtreecommitdiff
path: root/dgit
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2019-09-05 12:59:16 +0100
committerIan Jackson <ijackson@chiark.greenend.org.uk>2019-09-05 13:07:45 +0100
commit8dc465a4eb4bf7045c6cffa9cd50e217f3337589 (patch)
tree8a2c5465f87f455b76506bbf5630d330deab5224 /dgit
parent0d2411f56a406a373ac04631e50efb30803513dc (diff)
dgit: Use distro-info-data to resolve unknown suites to distros
Closes: #931212 Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Diffstat (limited to 'dgit')
-rwxr-xr-xdgit17
1 files changed, 17 insertions, 0 deletions
diff --git a/dgit b/dgit
index fde8d61..962bca1 100755
--- a/dgit
+++ b/dgit
@@ -46,6 +46,7 @@ use Digest::SHA;
use Digest::MD5;
use List::MoreUtils qw(pairwise);
use Text::Glob qw(match_glob);
+use Text::CSV;
use Fcntl qw(:DEFAULT :flock);
use Carp;
@@ -867,6 +868,22 @@ sub access_basedistro__noalias () {
return $kl->{$k};
}
}
+ foreach my $csvf (</usr/share/distro-info/*.csv>) {
+ my $csv_distro =
+ $csvf =~ m{/(\w+)\.csv$} ? $1 : do {
+ printdebug "skipping $csvf\n";
+ next;
+ };
+ my $csv = Text::CSV->new({ binary => 1, auto_diag => 2 }) or die;
+ my $fh = new IO::File $csvf, "<:encoding(utf8)"
+ or die "open $csvf: $!";
+ while (my $cols = $csv->getline($fh)) {
+ next unless $cols->[2] eq $isuite;
+ return $csv_distro;
+ }
+ die "$csvf $!" if $fh->error;
+ close $fh;
+ }
return cfg("dgit.default.distro");
}
}