From 07ea8fd5b6a5b9a9b9f1bf17df7086d7a66ee7db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Tue, 24 Jul 2012 10:56:22 +0200 Subject: [PATCH] Introduce cc/c++/gcc/g++ wrappers to catch CC/CXX ignorance. This introduces a 'gcc' wrapper and three symlinks which catch (unacceptable) direct calls to gcc and friends (which imply that packages does not use tc-getCC or a similar function). The code uses lockfiles to ensure that for each executable name the warning is output only once. Additionally, flock secures use in parallel builds. Fixes: https://bugs.gentoo.org/show_bug.cgi?id=427672 --- bin/ebuild-helpers/c++ | 1 + bin/ebuild-helpers/cc | 1 + bin/ebuild-helpers/g++ | 1 + bin/ebuild-helpers/gcc | 25 +++++++++++++++++++++++++ 4 files changed, 28 insertions(+) create mode 120000 bin/ebuild-helpers/c++ create mode 120000 bin/ebuild-helpers/cc create mode 120000 bin/ebuild-helpers/g++ create mode 100755 bin/ebuild-helpers/gcc diff --git a/bin/ebuild-helpers/c++ b/bin/ebuild-helpers/c++ new file mode 120000 index 0000000..b08d5af --- /dev/null +++ b/bin/ebuild-helpers/c++ @@ -0,0 +1 @@ +gcc \ No newline at end of file diff --git a/bin/ebuild-helpers/cc b/bin/ebuild-helpers/cc new file mode 120000 index 0000000..b08d5af --- /dev/null +++ b/bin/ebuild-helpers/cc @@ -0,0 +1 @@ +gcc \ No newline at end of file diff --git a/bin/ebuild-helpers/g++ b/bin/ebuild-helpers/g++ new file mode 120000 index 0000000..b08d5af --- /dev/null +++ b/bin/ebuild-helpers/g++ @@ -0,0 +1 @@ +gcc \ No newline at end of file diff --git a/bin/ebuild-helpers/gcc b/bin/ebuild-helpers/gcc new file mode 100755 index 0000000..90c7ee1 --- /dev/null +++ b/bin/ebuild-helpers/gcc @@ -0,0 +1,25 @@ +#!/bin/bash +# Copyright 1999-2009 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +self=${0##*/} +lock=${T}/.portage-warned-${self}-use + +if [[ ! -e ${lock} ]]; then + exec 10> "${lock}" + + if flock -n -x 10; then + case "${self}" in + cc|gcc) var=CC;; + c++|g++) var=CXX;; + *) var='(unknown)';; + esac + + eqawarn "QA warning: package does not respect ${var} variable" + eqawarn " (detected direct call to ${self})" + fi +fi + +nextbin=$(which -a "${self}" | head -n 2 | tail -n 1) + +exec "${nextbin}" "${@}" -- 1.7.11.1