view · edit · sidebar · attach · print · history

Index>

20160426-ydim-html-ruby-2-3

Summary

  • Port ydim-html to Ruby 2.3

Commits

Index

Keep in Mind for work to do
  • Fix dojo error http://www.sitepen.com/blog/2012/10/31/debugging-dojo-common-error-messages/#forgot-dom-ready
  • I removed on May-27 tests for ix_registrationss, fix_sequences, fix_compositions, fix_packages from test/test_plugin/swissmedic.rb,as he could not find any references for them in the src code. Did I erroneously remove stuff when cleaning up the swissmedic import earlier?
  • The whole test for older/newer Packages must be adapted to xlsx. One must compare the rows (e.g. by creating csv files) and do the same stuff in xlsx!
  • creat gem: task: input=file with ean-codes, standard output show ean-codes + atc-code. Source is Swissmedic Packungen.xlsx or XML.
  • Import via data/medreg_companies.yaml
  • Fix problem with radioactivatum 99m-technetio when parsing Wirkstoffe
  • Fix galenic_forms when parsing swissmedic.xlsx
  • Cleanup generic_type. Replace it everywhere by sl_generic_type and adapt code accordingly.
  • Get updated ATC-codes from EPha for oddb.org, too.
  • Use refdatabase for oddb.org, too.
  • Check whether we should revert the part which touche src/plugin/text_info.rb of commit 17af82ba4d76a5838683411b260de265531f9e74. We should improve test/stub/oddbapp.rb to work similar for update/pointer as the real oddbapp. In this case we would have a good Stub for plugins. May we need a different stub when working with plugins (which create/modify/destroy ODDB-Objects), when in most other cases a very simple stub is sufficient.
  • When a logged in admin user changes an atc_code of a product, the corresponding atc_class must update its sequences, too.
  • Order of entering search type and value should not matter. Both should show long URL with search
  • Remove parser for minifi (but keep the minifi)
  • BSV-Plugin does not send mail. Is it sending two mails at once?
  • remove obsolete pdf_patinfo in model, admin/views

Port ydim-html to Ruby 2.3

Must find the proper way on howto start a HTTP-server (Hannes used webrick) and connect it to ydim (flexmock) server.

This is tricky. Therefore trying, whether my changes work on oddb-ci2 in the real setup.

Pushed some minor cleanups:

Now starting ydim using sudo -u apache /usr/local/bin/ruby230 /home/niklaus/git/ydim/bin/ydimd

To ensure that my bundles get started correctly I used the following steps

  • cd/home/niklaus/git/ruby-dbi && /usr/local/bin/gem230 build dbi.gemspec && sudo /usr/local/bin/gem230 install pkg/dbi-0.4.6.gem
  • cd/home/niklaus/git/sbsm && /usr/local/bin/gem230 build sbsm.gemspec && sudo /usr/local/bin/gem230 install sbsm-1.2.5.gem
  • cd/home/niklaus/git/htmlgrid && /usr/local/bin/gem230 build htmlgrid.gemspec && sudo /usr/local/bin/gem230 install htmlgrid-1.0.8.gem
  • cd/home/niklaus/git/ydim && /usr/local/bin/gem230 build ydim.gemspec && sudo /usr/local/bin/gem230 install *.gem
  • git checkout https://github.com/ngiger/ydim-html.git /var/www/ydim.ywesee.com
  • cd /var/www/ydim.ywesee.com
  • sudo -u apache /usr/local/bin/bundle install --system
  • sudo -u apache /usr/local/bin/bundle exec bin/ydim-htmld config=/etc/ydim/ydimd.yml

When looking at all the dependent gems I see, that we still use rmail in ydim, whereas we have moved to mail everywhere else. But as there are newer version of rmail which support Ruby 2.x I will leave it for the moment being.

When I start it, I get now a (probably very significant error)

niklaus@oddb-ci2 /v/w/ydim.ywesee.com> sudo -u apache /usr/local/bin/ruby230 bin/ydim-htmld config=/etc/ydim/ydimd.yml 
/usr/local/lib/ruby/gems/2.3.0/gems/needle-1.3.0/lib/needle/definition-context.rb:36: warning: undefining `initialize' may cause serious problems
/usr/local/lib/ruby/gems/2.3.0/gems/needle-1.3.0/lib/needle/definition-context.rb:36: warning: undefining `object_id' may cause serious problems
/usr/local/lib/ruby/gems/2.3.0/gems/needle-1.3.0/lib/needle/definition-context.rb:36: warning: undefining `__send__' may cause serious problems
/usr/local/lib/ruby/site_ruby/2.3.0/x86_64-linux/ydim/server.rb:65: warning: already initialized constant YDIM::Server::CONFIG
/usr/local/lib/ruby/gems/2.3.0/gems/ydim-1.0.1/lib/ydim/server.rb:65: warning: previous definition of CONFIG was here
/usr/local/lib/ruby/site_ruby/2.3.0/x86_64-linux/ydim/server.rb:66: warning: already initialized constant YDIM::Server::SECONDS_IN_DAY
/usr/local/lib/ruby/gems/2.3.0/gems/ydim-1.0.1/lib/ydim/server.rb:66: warning: previous definition of SECONDS_IN_DAY was here
/usr/local/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- iconv (LoadError)
        from /usr/local/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/local/lib/ruby/gems/2.3.0/gems/htmlgrid-1.0.8/lib/htmlgrid/component.rb:29:in `<top (required)>'

Grepping to iconv shows, that is is used in directly somewhere in ext/htmlgrid. The last few commits were

git log -2 ext
commit 4b8fc8de457647705f277cd001680bc3517d3de9
Author: Masaomi Hatakeyama <mhatakeyama@ywesee.com>
Date:   Fri Dec 23 18:01:33 2011 +0100

    patch grid.c for Ruby 1.9.3

commit 6a57dbb4f57cc407462101129eeaf9fe3fee8045
Author: Hannes Wyss <hwyss@ywesee.com>
Date:   Thu Jul 30 13:29:05 2009 +0200

    HtmlGrid is now Ruby 1.9 compatible

But the problem was caused, that I had not a clean checkout. Removing and reinstalling helped. Now I get another problem with incompatible libraries of hpricot and ydim-html

udo -u apache /usr/local/bin/ruby230 bin/ydim-htmld config=/etc/ydim/ydimd.yml 
/usr/local/lib/ruby/gems/2.3.0/gems/needle-1.3.0/lib/needle/definition-context.rb:36: warning: undefining `initialize' may cause serious problems
/usr/local/lib/ruby/gems/2.3.0/gems/needle-1.3.0/lib/needle/definition-context.rb:36: warning: undefining `object_id' may cause serious problems
/usr/local/lib/ruby/gems/2.3.0/gems/needle-1.3.0/lib/needle/definition-context.rb:36: warning: undefining `__send__' may cause serious problems
/usr/local/lib/ruby/site_ruby/2.3.0/x86_64-linux/ydim/server.rb:65: warning: already initialized constant YDIM::Server::CONFIG
/usr/local/lib/ruby/gems/2.3.0/gems/ydim-1.0.1/lib/ydim/server.rb:65: warning: previous definition of CONFIG was here
/usr/local/lib/ruby/site_ruby/2.3.0/x86_64-linux/ydim/server.rb:66: warning: already initialized constant YDIM::Server::SECONDS_IN_DAY
/usr/local/lib/ruby/gems/2.3.0/gems/ydim-1.0.1/lib/ydim/server.rb:66: warning: previous definition of SECONDS_IN_DAY was here
could not find htmlgrid.so, falling back to pure-ruby class
/var/www/ydim.ywesee.com/lib/ydim/html/view/htmlgrid.rb:16: warning: already initialized constant HtmlGrid::Component::HTTP_HEADERS
/usr/local/lib/ruby/gems/2.3.0/gems/htmlgrid-1.0.8/lib/htmlgrid/component.rb:38: warning: previous definition of HTTP_HEADERS was here
/var/www/ydim.ywesee.com/lib/ydim/html/view/htmlgrid.rb:81: warning: already initialized constant HtmlGrid::List::STRIPED_BG
/usr/local/lib/ruby/gems/2.3.0/gems/htmlgrid-1.0.8/lib/htmlgrid/list.rb:46: warning: previous definition of STRIPED_BG was here
/usr/local/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': incompatible library version - /usr/local/lib/ruby/gems/2.3.0/gems/hpricot-0.8.6/lib/hpricot_scan.so (LoadError)
        from /usr/local/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/local/lib/ruby/gems/2.3.0/gems/hpricot-0.8.6/lib/hpricot.rb:20:in `<top (required)>'
        from /usr/local/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/local/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/local/lib/ruby/gems/2.3.0/gems/sbsm-1.2.5/lib/sbsm/validator.rb:32:in `<top (required)>'
        from /usr/local/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/local/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /var/www/ydim.ywesee.com/lib/ydim/html/util/validator.rb:5:in `<top (required)>'
        from /usr/local/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/local/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /var/www/ydim.ywesee.com/lib/ydim/html/util/server.rb:8:in `<top (required)>'
        from /usr/local/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /usr/local/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from bin/ydim-htmld:11:in `<main>'

Looks like a conflict between shared an static libraries, as I found the following occurrences

find /usr/local/lib64/ruby/gems/2.3.0/ -name hpricot_scan.so | xargs ls -lrt
-rwxr-xr-x 1 root root 526863 20. Apr 11:43 /usr/local/lib64/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0-static/hpricot-0.8.6/hpricot_scan.so
-rwxr-xr-x 1 root root 526911 26. Apr 11:25 /usr/local/lib64/ruby/gems/2.3.0/extensions/x86_64-linux/2.3.0/hpricot-0.8.6/hpricot_scan.so
-rwxr-xr-x 1 root root 526911 26. Apr 11:25 /usr/local/lib64/ruby/gems/2.3.0/gems/hpricot-0.8.6/lib/hpricot_scan.so
-rwxr-xr-x 1 root root 526911 26. Apr 11:25 /usr/local/lib64/ruby/gems/2.3.0/gems/hpricot-0.8.6/ext/hpricot_scan/hpricot_scan.so

Tried creating local gem ruby-dbi and dbd-pg in version 0.5.0.

But I think somehow the gems are not built correctly. Narrowed it it down by adding

def local_gems
   Gem::Specification.sort_by{ |g| [g.name.downcase, g.version] }.group_by{ |g| g.name }
end
puts local_gems['dbd-pg']
puts local_gems['pry']
require 'pry'; binding.pry

to bin/ydimd which gives mit the following output

#<Gem::Specification name=dbd-pg version=0.5.0>
#<Gem::Specification name=pry version=0.10.3>
/usr/local/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': incompatible library version - /usr/local/lib/ruby/gems/2.3.0/gems/byebug-8.2.4/lib/byebug/byebug.so (LoadError)
        from /usr/local/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'

Recompiling ruby 2.3.0 without --enable-shared. This helped. Installing again version 0.4.6 of dbi and 0.3.9 of dbd-pg.

Now I am again able to start ydim and ydim-html. I however do not get farther than the login dialog. Also dropping into pry from ydim-html works fine.

Adding some debug statements to ydim and ydim-html it looks like the drb objects don't get passed correctly. Debugging tomorrow.

view · edit · sidebar · attach · print · history
Page last modified on April 26, 2016, at 05:23 PM