split database query in publish_step into multiple smaller ones

For large numbers of available packages this step breaks with an assertion in mongodb (assertion 13385 combinatorial limit of $in partitioning of result set exceeded).
I fixed it with running the database query multiple times for smaller subsets of our available units.