libarchive/libarchive — pull request #92 by jymigeon (2014-11-05 13:55:50+00:00)
Title: archive_match(3) logic sets (most importantly, default (gtar) and mtree (~fnmatch(3))

This small patch adds a few registrations routines (archive_match_set_logic_...() ) that dynamically set the matching logic used by the archive_match engine in libarchive. The design is close to other APIs already found in libarchive, like set_format or set_filter.

Libarchive uses some kind of gtar convention for path matching, however other tools (in my case: mtree(1)) use different pattern definitions, namely globbing (fnmatch(3)).

This patchset leaves the default logic as gtar, but adds a few callbacks and set_logic routines that permits declaring other rules. In the current form the patch keeps priority in the form of "exclusion over inclusion", e.g. that a pattern found both in exclusion and inclusion lists will be considered as "exclude". This is not necessarily the case all the time, tools may prefer using "specificity" as priority rather than exclusion/inclusion. Adding this requires more profound tweaks in archive_match struct -- something it does not really require ATM.

If the current code is OK'd I will add a few regress tests for mtree match callbacks to the branch. Please review first though.