Home Home > 2008 > 07 > 15 > YaST module the C++ way
Sign up | Login

YaST module the C++ way

July 15th, 2008 by

From May 30th to July 4th we had a YaST workshop in Nuremberg. The workshop was basically a hackshop as we wanted to work on cool and new things for YaST during this week.

There is one big change in YaST in openSUSE 11.0 – yea, we found out that there are even more colors than gray, ok – but there is one that is not really visible to the end-user. Stefan Hundhammer, maintainer our YaST UI, completely separated the UI from the rest of the YaST infrastructure. This now makes it possible to use the UI directly, from anywhere, independent from our YaST-own-language YCP. So with a team of four hackers we wanted to prove that we can write a YaST module in plain C++ using the new modularized UI directly. And here is the outcome:

We went for rewriting the registration module (well, we chose it because I know it well, as I am the maintainer, and it will change anyhow for the next release). This module is not that integrated in the overall YCP world, so it should be feasible. First we had to find an alternative way to access system configuration files, as this is done by so-called SCR agents in YCP. To make life easier (and future development faster) we had to look for a replacement of our YCP Wizard Seqencer. And of course we redesigned all dialogs to make them more intuitive.

We solved all the issues and now have

  • a wrapper class for accessing different configuration files (currently only ini files)
  • an automatic wizard sequencer equivalent (using the advantages of an object oriented language, btw YCP is not)
  • three clear and intuitive dialogs, every user should understand

And as everybody wants to see screenshots, here they are:

Configure Update Source Send Hardware Information Register for Installation Support

The code is just a proof of concept and not yet reusable for new YaST modules but everything we wanted to show works great. We will continue to work on such kind of modules and in that process move the generic parts out into single libraries so that they can be reused and even may be exposed to scripting languages.

Writing YaST module this way has lots of advantages

  • YaST modules evolved into the object oriented world and can make use of it (the automatic sequencer is the first benefit)
  • the code is reusable
  • a huge bunch of documentation and lots of tools exist for C++
  • its a compiled language and has a better performance than an interpreted one
  • we can bind automatically to the most important scripting languages and give them access to the modules logic

If you are interested in the source code, have a look at my svn repo and if you want to help join the team and contact us on our mailinglist.

Both comments and pings are currently closed.

4 Responses to “YaST module the C++ way”

  1. nobody

    Yea, it´s time to change color of YaST.It would be great.

  2. ryan

    The “System and Hardware Information” is a nice addition on the testing side. Will it also report successful or failed hardware installations to SUSE, or provide the user with options if a piece of hardware fails to install?

    • J. Daniel Schmidt

      Just a note: This module is not meant to be a “test all my hardware and its drivers and report any issues” module :)

      The “System and Hardware Information” is no addition – it is already in the current registration module. But it never showed the data that would be sent. We just seprarated the workflow into 3 steps to make it more intuitive and in order to show the user, what actions will be performed.

      The hardware data is basically the output of “hwinfo” – just go to your current registration module (aka. “Online Update Configuration”) and click on “Details” to see, what commands would be run if you wanted to send hardware data. There are no tests if a piece of hardware is failing or a driver is missing, we just collect the data that hwinfo outputs.
      The data is used for statistics so we get an idea what hardware is important to support in future releases.