+sub flavour {
+ my $etc = '/etc';
+
+ if (@_) {
+ croak "do not pass a directory, it's for testing only"
+ unless $ENV{HARNESS_ACTIVE};
+ $etc = shift;
+ }
+
+ if (open(my $f, '<', "$etc/os-release")) {
+ local $_ = join '', <$f>;
+ my ($id) = /^ID="?(.*?)"?\s*$/m;
+ my $version = /^VERSION_ID="?(.*?)"?\s*$/m ? $1 : '';
+ return "$id$version";
+ }
+
+ if (open(my $f, '<', "$etc/debian_version")) {
+ chomp(local $_ = <$f>);
+ $_ = int $_;
+ return "debian$_";
+ }
+
+ undef;
+}
+
+sub flavours {
+ my %h = map { /\.(\S+)$/, 1 }
+ glob('stdout/*.*'), glob('stderr/*.*');
+ return sort keys %h;
+}