cfengine/masterfiles — pull request #3 by tzz (2013-09-04 01:11:20+00:00)
Title: Redhat and Debian factoring out of common regexes.

The biggest problem right now is that there are three distinct RPM query formats and regular expressions to extract package data:

```
# used with rpm format 'i | repos | %{name} | %{version}-%{release} | %{arch}\n'

"rpm_name_regex" string => "[^|]+\|[^|]+\|\s+([^\s|]+).*";
"rpm_version_regex" string => "[^|]+\|[^|]+\|[^|]+\|\s+([^\s|]+).*";
"rpm_arch_regex" string => "[^|]+\|[^|]+\|[^|]+\|[^|]+\|\s+([^\s]+).*";

# used with rpm format '%{name} %{version}-%{release} %{arch}\n'

"rpm2_name_regex" string => "^(\S+?)\s\S+?\s\S+$";
"rpm2_version_regex" string => "^\S+?\s(\S+?)\s\S+$";
"rpm2_arch_regex" string => "^\S+?\s\S+?\s(\S+)$";

# used with rpm format '%{name}.%{arch} %{version}-%{release}\n'

"rpm3_name_regex" string => "([^.]+).*";
"rpm3_version_regex" string => "[^\s]\s+([^\s]+).*";
"rpm3_arch_regex" string => "[^.]+\.([^\s]+).*";
```

I'd like some opinions from @teroka @phnakarin @nickanderson @trondham @kacfengine and anyone else interested. I know we've discussed these topics before, so let's try to bring it all together here in this big factoring PR to reduce the redundancy throughout our packages.