[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Packaging issue: rake uses the installed library instead of the packaged one leading to FTBFS



On Sat, Nov 23, 2019 at 02:55:23PM +0100, Daniel Leidert wrote:
> Hi,
> 
> I recently ran into a strange issue. I tried to package ruby-jekyll-feed
> 0.13.0, a plugin for Jekyll. This new upstream releases introduces a new
> feature, which allows to exclude some content in the resulting feed. It also
> comes with a test to test this feature.
> 
> Trying to build the package fails, because some of the new feature tests fail
> [1]. The reason is that tests use the already packaged version of ruby-jekyll-
> feed, which is installed on the build system because jekyll depends on it and
> jekyll is a necessary build-dependency. I already opened #945334 [2] and
> requested to downgrade jekyll's dependencies on its plugins to suggestions. So
> a clean build environment would not contain ruby-jekyll-feed.
> 
> But I'm still thinking that one should be able to force ruby (rake, rspec) to
> put the packaged plugin (0.13.0) before the installed one (0.12.1). The command
> called is:
>  
> > RUBYLIB=/builds/ruby-team/ruby-jekyll-feed/debian/output/ruby-jekyll-feed-
> > 0.13.0/debian/ruby-jekyll-feed/usr/lib/ruby/vendor_ruby:.
> > GEM_PATH=debian/ruby-jekyll-feed/usr/share/rubygems-
> > integration/all:/var/lib/gems/2.5.0:/usr/lib/ruby/gems/2.5.0:/usr/share/rubyg
> > ems-integration/2.5.0:/usr/share/rubygems-integration/all:/usr/lib/x86_64-
> > linux-gnu/rubygems-integration/2.5.0 ruby2.5 -S rake -f debian/ruby-
> > tests.rake
> 
> So in both the RUBYLIB and the GEM_PATH variables the build location is put on
> top. Why is the installed plugin version used instead?
> 
> [1] https://salsa.debian.org/ruby-team/ruby-jekyll-feed/-/jobs/420659
> [2] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=945334

Both jekyll and colorator do this horrible thing of manipulate $LOAD_PATH. This
is more or less innocuous if they are installed using the rubygems layout, but
when they are installed to vendor_ruby, then it causes issues like this.

$ ruby -e 'def $LOAD_PATH.unshift(c); raise "BOOM"; end; require "jekyll"'
Traceback (most recent call last):
	4: from -e:1:in `<main>'
	3: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
	2: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
	1: from /usr/lib/ruby/vendor_ruby/jekyll.rb:3:in `<top (required)>'
-e:1:in `unshift': BOOM (RuntimeError)

$ head -n 3 /usr/lib/ruby/vendor_ruby/jekyll.rb
# frozen_string_literal: true

$LOAD_PATH.unshift __dir__ # For use/testing when no gem is installed

Attachment: signature.asc
Description: PGP signature


Reply to: