packager: refactorized duplicated code (wip)
packager: refactorized duplicated code (wip)

Former-commit-id: 1acb32f5136f5c3e3342e117aebf5ca8d31cef62 [formerly dc2830211598eba6f24735222bcefe3e31bc2574]
Former-commit-id: c9adbf4b5ba5d930a043de245b20026705cfd21a
gem/oq-engine,gem/oq-engine,gem/oq-engine,gem/oq-engine,gem/oq-engine