Commit Graph

35 Commits

Author SHA1 Message Date
Austin Seipp
76b05b1630 releaseTools: add {clang,coverity}Analysis tools
These two expressions greatly simplify using the clang-analyzer or
Coverity static analyzer on your C/C++ projects. In fact, they are
identical to nixBuild in every way out of the box, and should 'Just
Work' providing your code can be compiled with Clang already.

The trick is that when running 'make', we actually just alias it to the
appropriate scan build tool, and add a post-build hook that will bundle
up the results appropriately and unalias it.

For Clang, we put the results in $out/analysis and add an 'analysis'
report to $out/nix-support/hydra-build-products pointing to the result
HTML - this means that if the analyzer finds any bugs, the HTML results
will automatically show up Hydra for easy viewing.

For Coverity, it's slightly different. Instead we run the build tool and
after we're done, we tar up the results in a format that Coverity Scan's
service understands. We put the tarball in $out/tarballs under the name
'foo-cov-int.xz' and add an entry for the file to hydra-build-products
as well for easy viewing.

Of course for Coverity you must then upload the build. A Hydra plugin to
do this is on the way, and it will automatically pick up the
cov-int.tar.xz for uploading.

Note that coverityAnalysis requires allowUnfree = true;, as well as the
cov-build tools, which you can download from https://scan.coverity.com -
they're not linked to your account or anything, it's just an annoying
registration wall.

Note this is a first draft. In particular, scan-build fixes the C/C++
compiler to be Clang, and it's perfectly reasonable to want to use Clang
for the analyzer but have scan-build invoke GCC instead.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2014-05-02 14:07:37 -05:00
Eelco Dolstra
497997cc38 Move generation of coverage reports from nixos/lib/testing to releaseTools
Also, turn some stdenv adapters into setup hooks.
2014-03-03 13:57:08 +01:00
Eelco Dolstra
6b613f285c Fix nixBuild 2014-02-06 12:30:26 +01:00
Eelco Dolstra
80647127a3 Turn the coverage analysis stdenv adapters into setup hooks
Stdenv adapters are kinda weird and un-idiomatic (especially when they
don't actually change stdenv).  It's more idiomatic to say

  buildInputs = [ makeCoverageAnalysisReport ];
2014-02-05 19:18:33 +01:00
Peter Simons
fd76a89bcb pkgs/build-support/release/nix-build.nix: unconfuse syntax highlighting 2013-04-18 12:18:39 +02:00
Eelco Dolstra
a1c5d6642b build-support/release: Simplify meta.description
Phrases like "Build of a ..." are redundant because everything is a
build.
2013-03-01 12:50:29 +01:00
Eelco Dolstra
19ab71ff7a releaseTools.nixBuild: Put hydra-build-products in each output
Putting a single hydra-build-products in $out can cause $out to have
unnecessary dependencies on other outputs.
2013-02-18 13:57:02 +01:00
Eelco Dolstra
a0a6f0edfd releaseTools.nixBuild: Support builds with multiple outputs 2013-02-13 13:54:32 +01:00
Petr Rockai
ce77a5ceec Factor out repeated scriptlets from build-support/release/*.nix. 2012-07-23 20:33:04 +02:00
Eelco Dolstra
c3072a8df8 * When doing coverage builds, set useTempPrefix (in case we're doing
an "installcheck").

svn path=/nixpkgs/trunk/; revision=33261
2012-03-19 16:05:29 +00:00
Eelco Dolstra
ebd19ec705 * For "nix-build --run-env" it's desirable that $stdenv/setup (and by
extension postHook) does nothing else than set up the environment.
  It shouldn't touch $out because there may not be a $out.  So move
  the "imperative" bits of postHook into a separate phase.

svn path=/nixpkgs/trunk/; revision=33249
2012-03-19 03:45:36 +00:00
Eelco Dolstra
06d28ca8f1 * Support setting postPhases.
svn path=/nixpkgs/trunk/; revision=33247
2012-03-19 02:45:52 +00:00
Yury G. Kudryashov
0210e20b5a svn merge ^/nixpkgs/trunk
svn path=/nixpkgs/branches/stdenv-updates/; revision=32713
2012-03-01 07:04:39 +00:00
Ludovic Courtès
bd68cc6f5b nix-build: Honor user-provided `failureHook'.
svn path=/nixpkgs/trunk/; revision=32680
2012-02-28 17:10:50 +00:00
Eelco Dolstra
c556a6ea46 * "ensureDir" -> "mkdir -p". "ensureDir" is a rather pointless
function, so obsolete it.

svn path=/nixpkgs/branches/stdenv-updates/; revision=31644
2012-01-18 20:16:00 +00:00
Rob Vermaas
0d62f0418c nix-build.nix: also recognize xz tarballs
svn path=/nixpkgs/trunk/; revision=29760
2011-10-11 14:47:56 +00:00
Rob Vermaas
2bd4d50f0d nix-build.nix/source-tarball.nix: remove -v flag when copying build directory, to avoid polluting the log
svn path=/nixpkgs/trunk/; revision=25404
2011-01-05 09:06:53 +00:00
Rob Vermaas
6016038097 nixBuild: add failurehook that saves build dir when succeedOnFailure = true and keepBuildDirectory = true
svn path=/nixpkgs/trunk/; revision=25243
2010-12-22 14:57:18 +00:00
Ludovic Courtès
193799ec3d nixBuild: Add `buildOutOfSourceTree' option.
svn path=/nixpkgs/trunk/; revision=23717
2010-09-10 12:39:57 +00:00
Ludovic Courtès
7a491b54fa releaseTools.coverageAnalysis: Add `lcovExtraTraceFiles' parameter.
svn path=/nixpkgs/trunk/; revision=21743
2010-05-12 12:22:44 +00:00
Rob Vermaas
41698cf72c obviously just c/p'ing without testing should result in taking away commit rights...
svn path=/nixpkgs/trunk/; revision=19208
2010-01-04 13:37:49 +00:00
Rob Vermaas
db6f4ee89c * nix-build.nix: omit phases and define postPhases, suggested by eelco
svn path=/nixpkgs/trunk/; revision=19203
2010-01-04 12:44:34 +00:00
Rob Vermaas
67d7f430e2 * removed wrong order of phases from nixbuild, for now make check after install for strategoxt packages
svn path=/nixpkgs/trunk/; revision=19202
2010-01-04 12:07:05 +00:00
Rob Vermaas
d55c6d8404 revert change from ludo rev. 18634. for now this order is needed for the stratego packages in the buildfarm, and the order should matter as normally nothing gets built in check phase that is needed for install phase
svn path=/nixpkgs/trunk/; revision=18637
2009-11-26 06:52:13 +00:00
Ludovic Courtès
f5236b1e0d releaseTools.nixBuild: Perform checkPhase' before installPhase'.
svn path=/nixpkgs/trunk/; revision=18634
2009-11-25 23:15:18 +00:00
Eelco Dolstra
086dd25510 * Use --coverage, which is identical to -fprofile-arcs -ftest-coverage.
svn path=/nixpkgs/trunk/; revision=16903
2009-08-31 15:02:27 +00:00
Rob Vermaas
cd2c0b26ad moved finalPhase so it is possible to override through args
svn path=/nixpkgs/trunk/; revision=15977
2009-06-17 07:02:59 +00:00
Eelco Dolstra
f30fe65b3e * makeSourceTarball -> sourceTarball.
* Added a function binaryTarball to do a DESTDIR build into
  /usr/local.  Useful for making statically linked binaries.  However,
  it may be better to do this in a VM (since if you do it in a Nix
  build environment, you can still end up with a lot of Nix
  dependencies in your binaries, even if you do static linking).

svn path=/nixpkgs/trunk/; revision=14726
2009-03-26 14:11:59 +00:00
Eelco Dolstra
d0691bf1d7 * We don't need all that src.outPath / src.path hackery anymore.
svn path=/nixpkgs/trunk/; revision=14419
2009-03-06 16:53:44 +00:00
Eelco Dolstra
6bb95494e7 * Use the version attribute if available.
svn path=/nixpkgs/trunk/; revision=14297
2009-03-02 14:33:33 +00:00
Eelco Dolstra
45081f330d * Append the version to the "name" attribute to make the store paths
of Hydra builds more distinct (e.g. "patchelf-build-0.5pre1234"
  instead of just "patchelf-build").  If the version isn't known,
  append at least the revision.

* Propagate the release name of the source tarball to Nix builds.
  Useful to provide sensible package names in channels.

svn path=/nixpkgs/trunk/; revision=14294
2009-03-02 13:45:48 +00:00
Eelco Dolstra
2b2bb11f32 * Always include "/nix/store/*" in lcovFilter.
svn path=/nixpkgs/trunk/; revision=13583
2008-12-04 15:32:30 +00:00
Eelco Dolstra
79072e871f * Preserve meta attributes from the caller.
svn path=/nixpkgs/trunk/; revision=13433
2008-11-26 14:34:29 +00:00
Eelco Dolstra
8cc8ee244a svn path=/nixpkgs/trunk/; revision=13414 2008-11-25 15:54:05 +00:00
Eelco Dolstra
01acea6bbc * Start moving the Nix expressions that support the build farm
(e.g. making source tarballs, doing coverage analysis) to the
  Nixpkgs tree.  This makes it easier to run build farm jobs locally
  since you don't need to check out the "release" tree separately.
  Also it means one less input to declare for build farm jobs.

* Removed succeedOnFailure and separate logging of phases.  Hydra
  doesn't need that.

svn path=/nixpkgs/trunk/; revision=13388
2008-11-24 15:10:06 +00:00