Reverse dependencies in Hackage
Roel van Dijk
vandijk.roel at gmail.com
Sat Sep 26 06:53:15 EDT 2009
I originally send this mail directly to Ross Paterson but then I
realised it is probably better to send it to this list.
I have written a patch which adds reverse dependencies to
Hackage. I have attached the patch to the relevant
It is implemented roughly as follows:
An executable called pkg-rev-deps calculates the reverse
dependencies of every package. It writes this information to a
file called "revdeps.csv" inside the directory of a package.
The package CGI script is modified to read this file. It will
display the number of reverse dependencies right after the normal
dependencies. The number of reverse dependencies is a link which
will take you to a page containing a listing of all the reverse
dependencies, direct and indirect. This page is rendered by a new
CGI script called "revdeps".
If you do not run pkg-rev-deps to generate the revdeps.csv files
then package and revdeps will simply claim that there are no
I have NOT added pkg-rev-deps to the post-upload-hook script,
because I can't judge if the additional overhead will be to
large. On my system pkg-rev-deps takes about 4.5 times as long as
pkg-list to complete its run. About 60% of this time is spent
parsing all the package descriptions. Memory usage is fairly low:
* RevDepMap.hs -- calculates reverse dependencies
* pkg-rev-deps.hs -- generates revdeps.csv files
* revdeps.hs -- CGI script that lists reverse dependencies
* RevDepsPage.hs -- implementation of the revdeps script
Utils now contains a function to load the revdeps.csv file and
some functions to calculate revdep related URLs. I also updated
the .cabal and Makefile.
I don't know if pkg-rev-deps should be added to the
post-upload-hook. It already takes some time to upload a
package. Perhaps it can be run in a cron-job 4 times a day.
Some feedback would be really appreciated. I think that this is a
feature which will really add some value to hackage. It can help
you when deciding which package to use for you next project. It
is also useful for developers as you get an idea how your
package is being used.
Roel van Dijk
More information about the cabal-devel