diff options
author | Dominique Dumont <dod@debian.org> | 2021-06-07 19:03:28 +0200 |
---|---|---|
committer | Dominique Dumont <dod@debian.org> | 2021-06-07 19:14:00 +0200 |
commit | df7b9ec75cc77a0a30c71175078eeef4f9d4b7a2 (patch) | |
tree | c2b27f4676abf93102cae63871aa1de08cc76da3 | |
parent | c711f29961a9fb15714a138dc0c6d85bd0c872b2 (diff) |
feat (Dpkg backend): handles <pkg>.examples files
-rw-r--r-- | lib/Config/Model/Backend/Dpkg.pm | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/Config/Model/Backend/Dpkg.pm b/lib/Config/Model/Backend/Dpkg.pm index e5e196d5..e6af49f9 100644 --- a/lib/Config/Model/Backend/Dpkg.pm +++ b/lib/Config/Model/Backend/Dpkg.pm @@ -22,6 +22,7 @@ my $user_logger = get_logger('User'); my %hash_dispatch = ( patches => \&read_patch_series, install => \&read_install_files, + examples => \&read_examples_files, 'lintian-overrides' => \&read_lintian_overrides, ); around read_hash => sub ( $orig, $self, $obj, $elt, $file, $check, $args ) { @@ -34,6 +35,21 @@ around read_hash => sub ( $orig, $self, $obj, $elt, $file, $check, $args ) { $self->$method( $obj, $elt, $check, $args ); }; +sub read_examples_files ( $self, $hash, $elt, $check, $args ) { + my $dir = $self->get_tuned_config_dir(%$args); + + return unless $dir->exists; + + $logger->info("Checking $elt directory ($dir) for ".$hash->location ); + foreach my $file ($dir->children(qr/\.examples$/)) { + my $pkg = $file->basename(qr/\.examples$/); + $logger->info("examples: found $pkg examples file"); + # Just create the element. The read backend will kick in by itself + $hash->fetch_with_id($pkg); + } + return; +} + sub read_install_files ( $self, $hash, $elt, $check, $args ) { my $dir = $self->get_tuned_config_dir(%$args); |