# - Package configuration access
#
-=item @keyrings = directory_keyrings ( $directory )
+=item @files = directory_configuration_files ( $file, $directory )
-Return list of keyrings present in package configuration and applicable to
-DIRECTORY, which is a relative name beginning with the appropriate package.
+Return list of FILEs applicable to DIRECTORY. The rule used is that each
+FILE applies to its own directory and is inherited by all subdirectories.
=cut
-sub directory_keyrings {
+sub directory_configuration_files {
+ my $file = shift;
my $directory = shift;
- my @keyrings;
my @candidates;
for (my @directory = File::Spec::Unix->splitdir($directory);
@directory;
pop @directory)
{ push @candidates, File::Spec->catfile
- ($package_config_base, @directory, 'pubring.gpg') }
- push @candidates, File::Spec->catfile($package_config_base, 'pubring.gpg');
+ ($package_config_base, @directory, $file) }
+ push @candidates, File::Spec->catfile($package_config_base, $file);
- foreach my $keyring (@candidates) {
- if (-f $keyring) {
- ftp_syslog('debug', "DEBUG: found keyring $keyring") if DEBUG;
- push @keyrings, $keyring;
- }
+ return grep -f $_ && -r _ && -s _, @candidates;
+}
+
+=item @keyrings = directory_keyrings ( $directory )
+
+Return list of keyrings present in package configuration and applicable to
+DIRECTORY, which is a relative name beginning with the appropriate package.
+
+=cut
+
+sub directory_keyrings {
+ my $directory = shift;
+
+ my @keyrings = directory_configuration_files('pubring.gpg', $directory);
+
+ if (DEBUG) {
+ ftp_syslog('debug', "DEBUG: found keyring $_") for @keyrings;
}
return @keyrings;