Move package fetching logic inside fetch-packages script.