pbtools /

Filename Size Date modified Message
37 B
3.3 KB

These tools allow me to work with packages, analyzing PKGBUILDs from each package
in order to see, for example, the dependencies between package in a repository. I
find this helpful when maintaining my own packages. These tools are experimentation
with using the UNIX programming environment. Think of these tools as more of a
static analysis of packages before they are built.


Tools under the vars/ directory are used for extracting and expanding the PKGBUILD
fields from PKGBUILDS.

vars/pbvars	This finds any bash variables defined in the PKGBUILD
		and prints each one. The name is printed on a line, with
		the value (or values) printed on the lines after it.
vars/expvars	This expands the variables that are printed out
		by pbvars in a manner similar to how bash would do it.


Scripts under the graph/ directory are used to analyze collections of packages
inside or across repositories as well as their inter-dependencies. This is
useful for viewing the network of dependencies in a graph using graphviz.

graph/reposrc	Downloads abs tarballs from the official repository. An abs tree for
		each repository is extracted to the current directory. By default
		core, extra, and community are fetched. You can specify the repo
		as arguments.
graph/mkvars	For each PKGBUILD in the fetched repository, scan it with pbvars/expvars
		and save the result to a PKGDATA file in the same directory.
graph/repodeps	Scan each PKGDATA file found under a given repo dir and print repo name,
		package name, dependencies, and provides to standard output.
graph/mkdeps	Loop through the standard repos (core, extra, community) running repodeps
		on each repo dir and outputting each repo's deps to a file named $repo.deps.
graph/resdeps	Resolve dependencies from their symbolic package name to repository/name
		pairs. This avoid ambiguity. Dependencies on provided virtual packages
		are also translated into the package name of the provide-ing package.
		(Order matters, packages coming later in standard input override earlier
graph/depgrep	Print dependencies of a provided package, recursing for each dependency.
		You can limit the depth of recursion with the -d option. Pass the output of
		resdeps as standard input. Useful to look at a dep graph of a package.
graph/depdot	Convert our dep graph format to a GraphViz dot formatted file.
		Reads our internal format from stdin and writes dot format to stdout.
graph/mkpkgpng	Given a package as an argument, and a resolved dep graph as standard input,
		creates a .dot graph file and pipes it to "dot", writing to a .png named
		after the package. Uses depsdot and depgrep internally and takes the same
		-d option as depgrep.
graph/revdeps	Reverses or inverts dependencies. This simply changes the direction of each
		edge of the directed graph. Handy for finding dependencies upon a given package.
		Reverse the dep graph, depgrep for the package, and reverse the output.


# Creates core.deps extra.deps and community.deps
./fetchabs && ./mkvars && ./mkdeps

# Draws a graph to perl-libwww.png
cat core.deps extra.deps community.deps | ./resdeps | ./mkpkgpng -d 3 extra/perl-libwww

Justin Davis
jrcd83 at gmail dot com