Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Aug 2017 14:51:51 +0200
From:      Torsten Zuehlsdorff <tz@FreeBSD.org>
To:        ruby@freebsd.org
Cc:        lifanov@freebsd.org, Matthias Fechner <idefix@fechner.net>
Subject:   [Stage-QA] Gemfile-Check - WIP
Message-ID:  <5a229e15-44b8-a941-7aa1-d6df667b744f@FreeBSD.org>

next in thread | raw e-mail | index | archive | help
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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5a229e15-44b8-a941-7aa1-d6df667b744f>