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

Bug#535139: lintian: false positive on ruby-script-but-no-ruby-dep




* Russ Allbery <rra@debian.org> [2009-06-29 23:53-0400]:
> Micah Anderson <micah@debian.org> writes:
> 
> > Lintian is complaining:
> >
> > E: facter: ruby-script-but-no-ruby-dep ./usr/bin/facter
> >
> > Although it can clearly be seen in the control file:
> >
> > Depends: ruby (>= 1.8), net-tools, host | bind9-host, pciutils, libopenssl-ruby1.8, ${misc:Depends}
> >
> > Perhaps it is saying this because there is a versioned depends on Ruby
> > >= 1.8 and it should be listed as ruby1.8, ruby1.9 or just plain ruby
> > if there is no version specific criteria? If that is true, then the
> > description doesn't clearly indicate that.
> 
> There may be a bug, but the way that this is *supposed* to work is that
> scripts that explicitly give a Ruby version on the #! line
> (/usr/bin/ruby1.8, for instance) have to depend on the ruby1.8 package,
> whereas scripts that use #!/usr/bin/ruby have to depend on the ruby
> package.  Depending on ruby (>= 1.8) is not correct if you use
> #!/usr/bin/ruby1.8, sice ruby 1.9 may not provide that path.
> 
> Does that fit what the package is doing?

In fact it does... facter uses install.rb which seems to want to alter
the shebang to use 1.8 specifically. I've solved that, and am closing
the bug, if you are interested in that solution, read on:

# Install file(s) from ./bin to Config::CONFIG['bindir']. Patch it on the way
# to insert a #! line; on a Unix install, the command is named as expected
# (e.g., bin/rdoc becomes rdoc); the shebang line handles running it.
...

    ruby = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name'])

    File.open(from) do |ip|
        File.open(tmp_file, "w") do |op|
            ruby = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name'])
            op.puts "#!#{ruby}"
            contents = ip.readlines
            if contents[0] =~ /^#!/
                contents.shift
            end
            op.write contents.join()
        end
    end

Which takes a perfectly fine shebang in the source:

#!/usr/bin/env ruby

it looks at whatever /usr/bin/ruby is (on my build system ruby1.8), and
then munges that line into:

#!/usr/bin/ruby1.8

during build time. 

In the case of puppet, the work hasn't finished to get it to work
properly with ruby1.9, so that seems fine, but facter has had that work
done so both ruby1.8 and ruby1.9 work fine. 

I'm not well versed in the differences between install.rb and setup.rb,
the two most common ruby scripts used for doing installations, but from
a brief look around, it seems like setup.rb replaced install.rb some
years ago (by the same author), and setup.rb has the more configurable
option of doing:

--shebang=(all|ruby|never)

    Shenbang line (#!) rewriting mode.

    all: replace all shebang lines.

    ruby: replace shebang lines which invokes ruby.

    never: never rewrite shebang.

So... since facter can support both ruby1.8 and ruby1.9, I'm switching
the package to use the Debian Ruby standardized CDBS classes that
provide a functioning setup.rb which allows me to override this problem
in build-time, thus solving this lintian error.

Micah

Attachment: signature.asc
Description: Digital signature


Reply to: