Repository: conda/conda-build

Issue:
--quiet switch on conda-build leads to unexpected overlinking errors
### Actual Behavior
Building a simple recipe, adding the `--quiet` switch to conda-build leads to overlinking errors, e.g.
```
  ERROR (foo,bin/p): did not find - or even know where to look for: libm.so.6
  ERROR (foo,bin/p): lib/libgfortran.so.4 not found in any packages
  ERROR (foo,bin/p): lib/libquadmath.so.0 not found in any packages
  ERROR (foo,bin/p): lib/libgcc_s.so.1 not found in any packages
  ERROR (foo,bin/p): did not find - or even know where to look for: libc.so.6
```
### Expected Behavior
When `--quiet` is left off, conda-build output shows e.g.
```
   INFO (foo,bin/p): Needed DSO lib/libquadmath.so.0 found in defaults::libgcc-ng-7.2.0-hdf63c60_3
   INFO (foo,bin/p): Needed DSO x86_64-conda_cos6-linux-gnu/sysroot/lib/libm.so.6 found in CDT/compiler package defaults::gcc_impl_linux-64-7.2.0-habb00fd_3
   INFO (foo,bin/p): Needed DSO lib/libgcc_s.so.1 found in defaults::libgcc-ng-7.2.0-hdf63c60_3
   INFO (foo,bin/p): Needed DSO lib/libgfortran.so.4 found in defaults::libgfortran-ng-7.2.0-hdf63c60_3
   INFO (foo,bin/p): Needed DSO x86_64-conda_cos6-linux-gnu/sysroot/lib/libc.so.6 found in CDT/compiler package defaults::gcc_impl_linux-64-7.2.0-habb00fd_3
```
### Steps to Reproduce
```
% cat meta.yaml
package:
  name: foo
  version: 0.0.1

source:
  path: src

requirements:
  build:
    - {{ compiler("fortran") }}
    - make

build:
  script: make

% cat src/Makefile
EXE = $(PREFIX)/bin/p

$(EXE): p.f90
	$(GFORTRAN) -o $@ $^

% cat src/p.f90 
program p
  print *,'p'
end program p

% conda build -c defaults --override-channels --error-overlinking --quiet .
```
Leave off the `--quiet` switch and notice the difference.

##### `Output of conda info`
```
     active environment : None
            shell level : 0
       user config file : /home/pm/.condarc
 populated config files : 
          conda version : 4.5.4
    conda-build version : 3.10.9
         python version : 3.6.6.final.0
       base environment : /home/pm/miniconda  (writable)
           channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/free/linux-64
                          https://repo.anaconda.com/pkgs/free/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/pro/linux-64
                          https://repo.anaconda.com/pkgs/pro/noarch
          package cache : /home/pm/miniconda/pkgs
                          /home/pm/.conda/pkgs
       envs directories : /home/pm/miniconda/envs
                          /home/pm/.conda/envs
               platform : linux-64
             user-agent : conda/4.5.4 requests/2.19.1 CPython/3.6.6 Linux/4.15.0-24-generic ubuntu/16.04 glibc/2.23
                UID:GID : 1000:1000
             netrc file : None
           offline mode : False
```



Discussion:

Resolving patch:
diff --git a/conda_build/post.py b/conda_build/post.py
--- a/conda_build/post.py
+++ b/conda_build/post.py
@@ -420,13 +420,13 @@ def assert_relative_osx(path, prefix):
         assert not name.startswith(prefix), path
 
 
-def print_msg(errors, text):
-    if text.startswith("  ERROR"):
-        errors.append(text)
-    print(text)
-
-
 def check_overlinking(m, files):
+    def print_msg(errors, text):
+        if text.startswith("  ERROR"):
+            errors.append(text)
+        if m.config.verbose:
+            print(text)
+
     pkg_name = m.get_value('package/name')
 
     errors = []
@@ -511,7 +511,7 @@ def check_overlinking(m, files):
                 if in_whitelist:
                     print_msg(errors, '{}: {} found in the whitelist'.
                               format(info_prelude, n_dso_p))
-                elif len(in_pkgs_in_run_reqs) == 1 and m.config.verbose:
+                elif len(in_pkgs_in_run_reqs) == 1:
                     print_msg(errors, '{}: {} found in {}{}'.format(info_prelude,
                                                                     n_dso_p,
                                                                     in_pkgs_in_run_reqs[0],
@@ -534,7 +534,7 @@ def check_overlinking(m, files):
                     if in_prefix_dso not in files:
                         print_msg(errors, '{}: {} not found in any packages'.format(msg_prelude,
                                                                                     in_prefix_dso))
-                    elif m.config.verbose:
+                    else:
                         print_msg(errors, '{}: {} found in this package'.format(info_prelude,
                                                                                 in_prefix_dso))
             elif needed_dso.startswith(m.config.build_prefix):
@@ -551,7 +551,7 @@ def check_overlinking(m, files):
                     n_dso_p = "Needed DSO {}".format(needed_dso)
                     print_msg(errors, '{}: {} found in the whitelist'.
                               format(info_prelude, n_dso_p))
-                elif m.config.verbose and len(sysroots):
+                elif len(sysroots):
                     # Check id we have a CDT package.
                     dso_fname = os.path.basename(needed_dso)
                     sysroot_files = []


Test patch: