From owner-freebsd-ruby@freebsd.org Fri Aug 4 12:52:00 2017 Return-Path: Delivered-To: freebsd-ruby@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 32B92DD802F for ; Fri, 4 Aug 2017 12:52:00 +0000 (UTC) (envelope-from tz@FreeBSD.org) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 1E99566F28 for ; Fri, 4 Aug 2017 12:52:00 +0000 (UTC) (envelope-from tz@FreeBSD.org) Received: by mailman.ysv.freebsd.org (Postfix) id 1A69DDD802E; Fri, 4 Aug 2017 12:52:00 +0000 (UTC) Delivered-To: ruby@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1A0B6DD802D for ; Fri, 4 Aug 2017 12:52:00 +0000 (UTC) (envelope-from tz@FreeBSD.org) Received: from toco-domains.de (mail.toco-domains.de [IPv6:2a01:4f8:150:50a5::6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DB03266F25; Fri, 4 Aug 2017 12:51:59 +0000 (UTC) (envelope-from tz@FreeBSD.org) Received: from [0.0.0.0] (mail.toco-domains.de [IPv6:2a01:4f8:150:50a5::6]) by toco-domains.de (Postfix) with ESMTPA id 0FF0B1AAF058; Fri, 4 Aug 2017 14:51:57 +0200 (CEST) To: ruby@freebsd.org Cc: lifanov@freebsd.org, Matthias Fechner From: Torsten Zuehlsdorff Subject: [Stage-QA] Gemfile-Check - WIP Message-ID: <5a229e15-44b8-a941-7aa1-d6df667b744f@FreeBSD.org> Date: Fri, 4 Aug 2017 14:51:51 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------C2E47CC7BE21E9883AC22F68" Content-Language: en-US X-BeenThere: freebsd-ruby@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: FreeBSD-specific Ruby discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Aug 2017 12:52:00 -0000 This is a multi-part message in MIME format. --------------C2E47CC7BE21E9883AC22F68 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Aloha, inspired by lifanov and his work in PR 220605 to add a check for .gemspec of rubygems i tried myself with Gemfile. Background is, that checking the actual Gemfile of non rubygem-* ports is often very time-consuming. When building Gitlab, Redmine or others, everything is fine. But when executing they fail - because the Gemfile is not satisfied. Its WIP and my first try for an stage-qa script, so every comment is appreciated. It adds a stage-qa stage for every non rubygem- port. When executed i (intent) to scan for Gemfiles and checking every file with bundle check. If bundle fails, the stage-qa fails. It worked for simple test. If no Gemfile was present the test was skipped. If it is, bundle is executed. When removing a needed dependency it is found. Its also found when the dependency is indirect (not in Gemfile itself, but a dependency of an dependency listed there). But it don't work for net-im/mikutter for example and i don't know why. So any feedback would be fine! :) Greetings, Torsten -- Support me at: https://www.patreon.com/TorstenZuehlsdorff --------------C2E47CC7BE21E9883AC22F68 Content-Type: text/x-patch; name="gemfile-deps.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="gemfile-deps.diff" Index: Mk/Scripts/qa.sh =================================================================== --- Mk/Scripts/qa.sh (Revision 447112) +++ Mk/Scripts/qa.sh (Arbeitskopie) @@ -822,10 +822,41 @@ return $rc } +# If an non rubygem-port has a 'Gemfile' file +# it is checked with bundle to be sure +# all dependencies are satisfied. +# Without the check missing/wrong dependencies +# are just found when executing the applicationx +gemfiledeps() +{ + # check is only done for non rubygem-* ports + if [ "${PKGBASE%%-*}" != "rubygem" ]; then + # locate the Gemfile(s) + while read -r Gemfile; do + + # if there is none everything is fine - stop here + ! [ -f "${Gemfile}" ] && return 0; + + # use bundle to check if Gemfile is satisfied + bundle check --dry-run --gemfile ${Gemfile} + + # if bundle returns 1 the Gemfile is not satisfied + # and so stage-qa isn't also + if [ $? -eq 1 ]; then + return 1; + fi + + done <<-EOF + $(find ${STAGEDIR} -name Gemfile) + EOF + fi + return 0 +} + checks="shebang symlinks paths stripped desktopfileutils sharedmimeinfo" checks="$checks suidfiles libtool libperl prefixvar baselibs terminfo" -checks="$checks proxydeps sonames perlcore no_arch" +checks="$checks proxydeps sonames perlcore no_arch gemfiledeps" ret=0 cd ${STAGEDIR} --------------C2E47CC7BE21E9883AC22F68--