This module simplifies the file list of package. It makes it better human readable.
Module requires for init: filelist
Module requires for running: package
Module defines phase: filelist_simplify before filelist_finish
Module uses phase: filelist_simplify before filelist_finish
Filelist inspector, which simplifies file lists by globbing.
function: callback function
Add Callback for pre-creating pattern guesses.
Callback argument is file name to be simplified. You can define variables, which can be later used for creating patterns.
See filelist_simplify_dotsep_callback for example.
pattern: pattern to be checked
Add a preferred pattern to list of pattern guesses in simplification process. Shell variables used in those patterns are expanded each time they are used (it allows co-ordination with filelist_simplify_add_callback).
Preferred patterns: Patterns are used, even if * is valid.
NOTE: Empty patterns are allowed and ignored.
pattern: pattern to be checked
Add an unpreferred pattern to list of pattern guesses in simplification process. Shell variables used in those patterns are expanded each time they are used (it allows co-ordination with filelist_simplify_add_callback).
Unpreferred patterns: Those are used, only if * is not valid.
Preferred patterns: Patterns are used, even if * is valid.
NOTE: Empty patterns are allowed and ignored.
filename: file name
pattern: pattern to be checked
returns: 0: matches, 1: does not match
Checks, whether filename matches filename pattern.
NOTE: "case" and string replacement in Bash uses different pattern matching (it's only filename-like expansion, because it does not take '/' as special character).
pattern: pattern to be checked
returns $filelist_simplify_compare_file_pattern_pregen: pregenerated pattern
Generate extglob pattern for file checking. Re-implemetation of filelist_simplify_compare_file_pattern in two parts increases efficiency of comparing many files with the same pattern.
filename: file name
uses $filelist_simplify_compare_file_pattern_pregen: pregenerated pattern
Checks, whether filename matches filename pattern. Re-implemetation of filelist_simplify_compare_file_pattern in two parts increases efficiency of comparing many files with the same pattern.
WARNING: This function must be run in extglob mode!
filename: file name to be simplified
Using standard filelist_simplify functions, define on-fly simplification guess for file.ext: *.ext. Active by default.
Code example (simplified):
shopt -s extglob function filelist_simplify_dotsep_callback { local basename="${1##*/}" local ext="${basename##*.}" if ! test "$ext" = "$basename" ; then filelist_simplify_dotsep_pattern="*.$ext" else filelist_simplify_dotsep_pattern= fi } shopt -u extglob filelist_simplify_add_callback filelist_simplify_dotsep_callback filelist_simplify_add_fallback_pattern '$filelist_simplify_dotsep_pattern'