allow filtering in the variable RPM_NAME

This required moving some stuff around (we need the segment variables
for instance) and preliminary filtering. We can't wait till the end to
filter because we require the name of the RPM asap.