[PATCH modular] Add hooks to run a static analysis tool.

Trevor Woerner twoerner at gmail.com
Tue Dec 21 21:35:56 PST 2010

On Wed, Dec 22, 2010 at 12:19 AM, Peter Hutterer
<peter.hutterer at who-t.net> wrote:
> why not make --cmd to perform arbitrary commands instead of limiting it
> to git and make? Was there a discussion on this before? I just went
> through my email archive and only found ones that focused on git and
> make, not on just running an arbitrary command.

For my first iteration of this patch I had started by trying to add
another allowed command to --cmd but it didn't work; it got too messy.

--cmd doesn't allow any arbitrary command (it only allows 'git',
'make', and 'gmake') because the timing of when to run a git command
is different than the timing of when to run a make (or gmake) command.
If the user wants to run a git command the script will 'cd' into the
source directory and then can run the git command and move on to the
next module/component (without building). If the user wants to specify
an arbitrary make command the script switches to the source directory,
optionally runs the -p option, optionally switches to a build
directory (which is different than the source directory), optionally
configures the module/component, and then runs the arbitrary make

In other words, the --cmd option has to know whether the arbitrary
command is a git command (in which case it is run at one point) or a
make command (so it is run at a different point in the build). If
--cmd allowed any arbitrary command to be used the build.sh script
would have no idea when to run it.

When I first tried to wedge the static analysis into --cmd it was
messy because the static analysis option requires the user to specify
where to place the reports (I think it makes sense to place them
somewhere outside of the PREFIX directory because otherwise 'make
clean' operations wouldn't know to clean them up, causing distchecks
and whatnot to fail). Plus I tried to make this option generic enough
to run any static analysis tool, which would require the user to
specify options to that other tool... all of which didn't fit into
--cmd's git or make assumptions.

More information about the xorg-devel mailing list