[racket] info.rkt `deps` (was: Package fails to compile during 'make in-place' but not 'raco pkg install')

From: Sam Tobin-Hochstadt (samth at cs.indiana.edu)
Date: Fri Dec 20 15:39:12 EST 2013

On Fri, Dec 20, 2013 at 3:18 PM, Greg Hendershott
<greghendershott at gmail.com> wrote:
> Thanks Sam and Matthew for the replies.
>
> So IIUC I need to update the info.rkt deps to include _all_
> collections required among all the package's source files.

It's not collections that need to be specified, just packages. Here
are the missing dependencies for "markdown", for example, as printed
out by `raco setup`:

raco setup: undeclared dependency detected
raco setup:   for package: "markdown"
raco setup:   on packages:
raco setup:    "base"
raco setup:    "sandbox-lib"
raco setup:    "scribble-lib"
raco setup:    "srfi-lite-lib"
raco setup:   on packages for build:
raco setup:    "at-exp-lib"
raco setup:    "html-lib"
raco setup:    "rackunit-lib"
raco setup:    "redex-lib"

For "rackjure", it's:

raco setup: undeclared dependency detected
raco setup:   for package: "rackjure"
raco setup:   on package:
raco setup:    "base"
raco setup:   on package for build:
raco setup:    "rackunit-lib"

> It seems that could be somewhat error-prone and/or tedious.

Fortunately, `raco setup` spits out exactly the needed info.

> Although I haven't tried it, I seem to recall there's a tool to check
> for unnecessary requires? I imagine that tool knows the necessary
> requires, too. I wonder if it could be updated to output that list,
> which would help with this.

There's lots of info that the raco tools `check-requires`,
`show-deps`, and `show-dependencies` provide.

The middle of those is https://github.com/samth/find-pkg-deps, the
other two are provided by the macro debugger.

> In addition to running on just one .rkt file, it would be ideal to
> give it a directory that's a package root, and it goes ahead and
> updates all the *.rkt files (deleting unnecessary requires) and also
> the info.rkt (updating the `deps` list). Then you could `git diff` to
> review, and commit.
>
> Unless someone has already done this (or wants to) I guess I'll take a
> crack at that.

That sounds awesome.

Sam

Posted on the users mailing list.