From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id C2F261396D0 for ; Tue, 15 Aug 2017 09:16:15 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 2CB801FC051; Tue, 15 Aug 2017 09:16:15 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 0D3CE1FC051 for ; Tue, 15 Aug 2017 09:16:15 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 444E834182B for ; Tue, 15 Aug 2017 09:16:14 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id DD4AA7842 for ; Tue, 15 Aug 2017 09:16:12 +0000 (UTC) From: "Andreas Sturmlechner" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Andreas Sturmlechner" Message-ID: <1502746170.f3bd66dffa477b017a66bea1dbb32afc022860f8.asturm@gentoo> Subject: [gentoo-commits] proj/kde:master commit in: eclass/ X-VCS-Repository: proj/kde X-VCS-Files: eclass/kde5.eclass X-VCS-Directories: eclass/ X-VCS-Committer: asturm X-VCS-Committer-Name: Andreas Sturmlechner X-VCS-Revision: f3bd66dffa477b017a66bea1dbb32afc022860f8 X-VCS-Branch: master Date: Tue, 15 Aug 2017 09:16:12 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: e7454286-c37e-410c-90d9-41dd101c01c4 X-Archives-Hash: ec224960e7a5c8495dae34d2159517fc commit: f3bd66dffa477b017a66bea1dbb32afc022860f8 Author: Andreas Sturmlechner gentoo org> AuthorDate: Mon Aug 14 21:29:30 2017 +0000 Commit: Andreas Sturmlechner gentoo org> CommitDate: Mon Aug 14 21:29:30 2017 +0000 URL: https://gitweb.gentoo.org/proj/kde.git/commit/?id=f3bd66df kde5.eclass: KDE_TEST=forceoptional-recursive reloaded Searches for test subdirectory pattern in CMakeLists.txt recursively, enclose it with BUILD_TESTING conditional. Creates unified diff to easily pick up for cosmetics and submission upstream. eclass/kde5.eclass | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/eclass/kde5.eclass b/eclass/kde5.eclass index e34dcc7f33..251026233d 100644 --- a/eclass/kde5.eclass +++ b/eclass/kde5.eclass @@ -90,6 +90,13 @@ else : ${KDE_QTHELP:=false} fi +# @ECLASS-VARIABLE: KDE_TESTPATTERN +# @DESCRIPTION: +# DANGER: Only touch it if you know what you are doing. +# By default, matches autotest(s), unittest(s) and test(s) pattern inside +# cmake add_subdirectory calls. +: ${KDE_TESTPATTERN:="\(auto|unit\)\?tests\?"} + # @ECLASS-VARIABLE: KDE_TEST # @DESCRIPTION: # If set to "false", do nothing. @@ -628,13 +635,24 @@ kde5_src_prepare() { cmake_comment_add_subdirectory autotests test tests elif [[ ${KDE_TEST} = forceoptional-recursive ]] ; then punt_bogus_dep Qt5 Test - local d - for d in $(find . -type d -name "autotests" -or -name "tests" -or -name "test" -or -name "unittests"); do - pushd ${d%/*} > /dev/null || die + local f pf="${T}/${P}"-tests-optional.patch + touch ${pf} || die "Failed to touch patch file" + for f in $(find . -type f -name "CMakeLists.txt" -exec \ + grep -l "^\s*add_subdirectory\s*\(\s*.*${KDE_TESTPATTERN}\s*)\s*\)" {} \;); do + cp ${f} ${f}.old || die "Failed to prepare patch origfile" + pushd ${f%/*} > /dev/null || die punt_bogus_dep Qt5 Test - cmake_comment_add_subdirectory autotests test tests + sed -i CMakeLists.txt -e \ + "/^#/! s/add_subdirectory\s*\(\s*.*${KDE_TESTPATTERN}\s*)\s*\)/if(BUILD_TESTING)\n&\nendif()/" \ + || die popd > /dev/null || die + diff -Naur ${f}.old ${f} 1>>${pf} + rm ${f}.old || die "Failed to clean up" done + einfo "Build system was modified by KDE_TEST=forceoptional-recursive." + einfo "Unified diff file ready for pickup in:" + einfo " ${pf}" + einfo "Push it upstream to make this message go away." elif [[ ${CATEGORY} = kde-frameworks || ${CATEGORY} = kde-plasma || ${CATEGORY} = kde-apps ]] ; then cmake_comment_add_subdirectory autotests test tests fi