about summary refs log tree commit diff
path: root/pkgs/development/tools/build-managers/bear
diff options
context:
space:
mode:
authorPavel Chuprikov <pschuprikov@gmail.com>2016-11-03 15:27:03 +0100
committerVladimír Čunát <vcunat@gmail.com>2016-11-03 15:27:03 +0100
commit6693e3b06c733ed26719eebda87e53e56b9df24b (patch)
tree67476f203e06b636d81bc16c619adae0451ef2c4 /pkgs/development/tools/build-managers/bear
parent662c5095a83599506266e09cc5fd067b47d1b2b5 (diff)
downloadnixlib-6693e3b06c733ed26719eebda87e53e56b9df24b.tar
nixlib-6693e3b06c733ed26719eebda87e53e56b9df24b.tar.gz
nixlib-6693e3b06c733ed26719eebda87e53e56b9df24b.tar.bz2
nixlib-6693e3b06c733ed26719eebda87e53e56b9df24b.tar.lz
nixlib-6693e3b06c733ed26719eebda87e53e56b9df24b.tar.xz
nixlib-6693e3b06c733ed26719eebda87e53e56b9df24b.tar.zst
nixlib-6693e3b06c733ed26719eebda87e53e56b9df24b.zip
bear: ignore wrapper calls (#20070)
Fixes #20056
Diffstat (limited to 'pkgs/development/tools/build-managers/bear')
-rw-r--r--pkgs/development/tools/build-managers/bear/default.nix2
-rw-r--r--pkgs/development/tools/build-managers/bear/ignore_wrapper.patch31
2 files changed, 33 insertions, 0 deletions
diff --git a/pkgs/development/tools/build-managers/bear/default.nix b/pkgs/development/tools/build-managers/bear/default.nix
index 0f0ee5979206..2bfec89aa660 100644
--- a/pkgs/development/tools/build-managers/bear/default.nix
+++ b/pkgs/development/tools/build-managers/bear/default.nix
@@ -16,6 +16,8 @@ stdenv.mkDerivation rec {
 
   doCheck = false; # all fail
 
+  patches = [ ./ignore_wrapper.patch ];
+
   meta = with stdenv.lib; {
     description = "Tool that generates a compilation database for clang tooling";
     longDescription = ''
diff --git a/pkgs/development/tools/build-managers/bear/ignore_wrapper.patch b/pkgs/development/tools/build-managers/bear/ignore_wrapper.patch
new file mode 100644
index 000000000000..16d7a9bfd3e4
--- /dev/null
+++ b/pkgs/development/tools/build-managers/bear/ignore_wrapper.patch
@@ -0,0 +1,31 @@
+--- Bear-2.2.1-src/bear/main.py.in	1970-01-01 01:00:01.000000000 +0100
++++ Bear-2.2.1-src-patch/bear/main.py.in	2016-11-02 20:23:38.050134984 +0100
+@@ -48,6 +48,7 @@
+ import shutil
+ import contextlib
+ import logging
++from distutils.spawn import find_executable
+ 
+ # Ignored compiler options map for compilation database creation.
+ # The map is used in `split_command` method. (Which does ignore and classify
+@@ -447,7 +448,6 @@
+     # do extra check on number of source files
+     return result if result.files else None
+ 
+-
+ def split_compiler(command):
+     """ A predicate to decide the command is a compiler call or not.
+ 
+@@ -467,7 +467,11 @@
+                    for pattern in COMPILER_CPP_PATTERNS)
+ 
+     if command:  # not empty list will allow to index '0' and '1:'
+-        executable = os.path.basename(command[0])
++        absolute_executable = os.path.realpath(find_executable(command[0]))
++        if 'wrapper' in absolute_executable:
++            return None
++
++        executable = os.path.basename(absolute_executable)
+         parameters = command[1:]
+         # 'wrapper' 'parameters' and
+         # 'wrapper' 'compiler' 'parameters' are valid.