Added sort index calculation to sync and upload units

There is a glaring lack of unit tests in this. I can't find one that actually verifies the structure of an RPM being added to the database. In theory, this code won't see a release anyway if the new importer gets included in 2.2 (just these hooks, the rest of the work in this area will stick), so I'm not interested in taking the time to add that test.