diff options
author | Victor Lowther <victor.lowther@gmail.com> | 2010-03-14 23:11:39 -0500 |
---|---|---|
committer | Victor Lowther <victor.lowther@gmail.com> | 2010-03-16 22:00:23 -0500 |
commit | 0ed2f3950e4797c592d89dcbe9d2bc194e560a2c (patch) | |
tree | 9546a983988b756ffc9cc52d85ef1432b04b7ad3 | |
parent | ff649497ad05fc7a7e7a2d33f7e91174f61da5ac (diff) |
Fix import-fdi-quirkdb
Magic foo_outof regex munging code was not working due to a deplorable lack of extglob.
Compaq biosen have some truly hideous identifiers.
Hmmm... lenovo fdi file seems to use slightly looser XML.
-rw-r--r-- | src/import-fdi-quirkdb.in | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/src/import-fdi-quirkdb.in b/src/import-fdi-quirkdb.in index f344304..ff11ffe 100644 --- a/src/import-fdi-quirkdb.in +++ b/src/import-fdi-quirkdb.in @@ -19,11 +19,12 @@ # into the native ones at $2. . "@PM-UTILS-LIBDIR@/pm-functions" +shopt -s extglob -begin_match='<match key="([a-z._]+)" ([a-z_]+)="([^"]+)">' +begin_match='<match key *= *"([a-z._]+)" ([a-z_]+) *= *"([^"]+)">' end_match='</match>' -merge='<merge key="([^"]+)" type="bool">true</merge>' -remove='<remove key="([^"]+)"></remove>' +merge='<merge key *= *"([^"]+)" type *= *"bool">true</merge>' +remove='<remove key *= *"([^"]+)"></remove>' begin_comment='<!--' end_comment='-->' in_comment=0 @@ -53,10 +54,10 @@ escape_match() { lit="${lit//\\/\\\\}" lit="${lit//./\\.}" lit="${lit//^/\\^}" - lit="${lit//[/\\\[}" - lit="${lit//]/\\\]}" - lit="${lit//(/\\\(}" - lit="${lit//)/\\\)}" + lit="${lit//[/\\[}" + lit="${lit//]/\\]}" + lit="${lit//\(/\\(}" + lit="${lit//)/\\)}" lit="${lit//\*/\\\*}" lit="${lit//\+/\\\+}" lit="${lit//\?/\\\?}" @@ -64,20 +65,17 @@ escape_match() { lit="${lit//\}/\\\}}" lit="${lit//\|/\\\|}" lit="${lit//\$/\\\$}" - # nuke leading and trailing spaces, they just confuse things. - lit="${lit%%+( )}" - lit="${lit##+( )}" # second, handle the various comparison cases, munging them into # extended regular expressions that bash understands. case $1 in string) lit="^${lit}\$" ;; int|uint64) fun=numeric_compare_eq ;; - string_outof) lit="${lit%;}"; lit="^(${lit//@(*( );*( ))/|})\$" ;; + string_outof) lit="${lit%;}"; lit="^(${lit//;/|})\$" ;; int_outof) fun=numeric_compare_eq_list ;; contains) ;; - contains_outof) lit="${lit%;}"; lit="${lit//@(*( );*( ))/|}" ;; + contains_outof) lit="${lit%;}"; lit="${lit//;/|}" ;; prefix) lit="^${lit}" ;; - prefix_outof) lit="${lit%;}"; lit="^(${lit//@(*( );*( ))/|})" ;; + prefix_outof) lit="${lit%;}"; lit="^(${lit//;/|})" ;; suffix) lit="${lit}\$" ;; contains_ncase) fun=regex_ncase ;; contains_not) fun=regex_inverse ;; |