Add dependency handler for package installation
Created by: AgostonSzepessy
This is for #10. This commit implements dependency handling for the installation of packages. Dependency handling for uninstallation will come later.
There is a new struct called Database
, which is used to calculate dependencies. Database
depends on a directory, /etc/pkg.d/pkglist/
, to contain the meta data for every package that can be installed. It uses those to calculate the dependency for each package to be installed. A dependency graph is built and then a topological sort is performed on the graph. The results are put into an OrderMap
so that if multiple packages need to have their dependencies calculated, duplicates can be easily found.
Then the packages are downloaded and installed.
There will also have to be a way to download the meta data for all the packages and place them into /etc/pkg.d/pkglist
. I think the easiest way to do that would be to add a command like refresh
or something which downloads a tarball and extracts it there.