Sort rulesets when building sqlite DB.

Makes builds more deterministic.
Merge pull request #534 from jsha/sort-input

Sort rulesets when building sqlite DB.