June 27, 2007


So, it is Hackweek. Hundreds of Novell engineers working on the things they are passionate about. A full week of fully innovation and cooperation.

You can see the flickr photos here. The ideas collected (more than 300, with a hundred in progress).

So what am I doing?
There are a few ideas for YaST. YaST needs new light to evolve somewhere, and most of the ideas bring a step in this direction: Making it accessible from web services, other languages support, UI independence from the ycp language, etc.

YaST already has perl bindings and there are some modules written in Perl.

My project is bidirectional ruby support for YaST, and it works already.

So, in Ruby you could write:

module Foo
  def self.multiply_by_eight(a)
    return 8*a

  def self.sum(a,b)
    return a+b;

And then in a .ycp file:

    import "Foo";
    integer result = (integer) Foo::sum(2,3);
         `Label(sformat("%1", result)),

It works!!!!:

Now, we can do YaST in Ruby too, using the “yast” module for Ruby, lets try the Arch module from YaST (which is ycp code)

require 'yast'

m = YaST::Module.new("Arch")
puts m.sparc32
puts m.arch_short
puts m.is_xen

The output is:


What about something more complex. The Storage module is a C++ library. In order to bind it easily with YaST and being able to use SWIG, YaST developers access it using the YaST perl-bindings to access the generated SWIG perl-bindings from the C++ library, so calling this from Ruby code would go from Ruby, to YCP, to Perl, to C++:

m = YaST::Module.new("Storage")
dp = m.GetDiskPartition("/dev/sda1")
dp.each do | key, value |
  puts "#{key} #{value}"

The output is:

nr 1
disk /dev/sda

I also tried to access the UI, but it does not work. Martin Vidner told me he is working on getting rid of this limitation. SCR access should be doable but I haven’t look at it yet.

I will decide tomorrow if I tune the code or I spend my 2 days left (I travel to aKademy on Friday) researching other stuff (probably I will spend it on YaST too).