move specfile scripting into separate files
This makes the specfile more readable and makes it easier to sync the
more complex parts across branches.
This also refactors the license install logic.
(cherry picked from commit 282053d3e1ce474df30b8b9e03f57429c2fb8fd3)