I’m working on a way to build installer packages from formulae I’ve installed on a machine.
I see that I can get a list of what seems to be a complete set of installed files using
brew ls --verbose <formula>, and that I can also use
brew info --json=v1 <formula> to get additional metadata. Is there some way I could also pull an easily parseable list of symlinked files?
One potential hack seems to be that I could do:
brew unlink <formula>; brew link --dry-run <formula> and parse the output, but it starts getting trickier when directories are involved and it lists
mkdir -p statements, etc. I could also just walk the prefix path myself and mark any symlinks which link to a path including
/usr/local/Cellar, but I was wondering if there’s a way I could use brew’s built-in tools or a method or two within the Homebrew Ruby library to do this in a more robust way.
I also notice that this doesn’t list
post_install items which might, for example, have been installed in
/usr/local/var/<formula>, but those I can potentially deal with as a separate issue.
Any ideas would be very welcome!