Re: debugging ports issues, use introspection

2012-04-30 Thread LEVAI Daniel

On 28.04.2012 16:24, Marc Espie wrote:

When things fail while building a port, remember you can almost
always check what is really going on.

[...]

Thanks for this cool write-up, again!
I like these informative lectures from time-to-time.
When in trouble creating or building ports, I just
look up the archived ones.


Daniel



debugging ports issues, use introspection

2012-04-28 Thread Marc Espie
When things fail while building a port, remember you can almost
always check what is really going on.

(Comparing to system admin, inspecting /etc/rc.d and checking inetd.conf
is no match for verifying stuff really runs in ps and checking running
servers with netstat).

- you have access to any variable using
make show=VAR

- most useful variables do show up in
make dump-vars

- some of them just exist to let you check things
make show=PKGNAMES
will handle REVISION, EPOCH, and whatever tweaks for you.

- what pkg_create does to PLISTs, it can do for you, on demand
make print-plist
will show you the current subpackage's plist.

- print-plist-with-depends will supplement that with dependency information,
as built by print-package-args

(note that stuff such as register-plist or pkglocatedb use those mechanisms
internally, there's just ONE way to generate that info, so there can be
no bugs).

- pkg_create is actually invoked with _PKG_ARGS-sub
even though it's not a visible variable, it comes in handy from time
to time when figuring out hairy flavor fragments combinations...
(I should probably rename it to make it visible ?)

- when you need to figure out where something comes from, remember about
the pkglocatedb package.

- when you need to know where something is used, the sqlports package is
much more efficient than grepping through INDEX.

Also, both sqlports and pkglocatedb contain MORE than the INDEX: the sqlports
build script keeps going after scanning the ports tree, to secure the 
information for dependencies and dependencies of dependencies (technical
term is transitive closure).

- build-dir-depends, run-dir-depends, all-dir-depends
show you the exact dependency relationships a port depens on.