Rework, split and optimize repo functions.

pkg_repo.c - is a place for generic repo functions
pkg_repo_update.c - is a place for repo update code
pkg_repo_create.c - is a place for repo create functions

- All repo functions now have prefix `pkg_repo`.
- Doubly linked lists are used in repo create to speed up the process