Hi all,


as you know we are working on a "YCP-killer" project, which should translate
all YCP files to ruby and then get rid of our specific YCP language.

I found a problem related to reading data YCP files.

The problem is that some modules have data in YCP files
which are read at runtime via these SCR calls:

  SCR::Read(.target.yast2, "foo.ycp")
  SCR::Read(.target.ycp, "bar.ycp")


We can convert that YCP files to ruby with the converter but the
loading mechanism will not not work.

And keeping the data files in YCP format is also not an option.



There are basically two possibilities:

- convert the YCP files to a different format
  (plain text, YML, XML...)

- modify the YCP files so that they can be used
  as an include file (includes are converted to ruby files
  so there is no change needed after the conversion)


Which solution is better depends on the data in the file,
some non-structured data could be simply converted to a plain
text file, converting structured data is usually more complex.

The second solution is easier for structured data as the file itself
can be more or less left untouched, only the loading mechanism needs
to be changed to an include statement.

The disadvantage of the second solution is that the data is loaded
persistently to memory (as it actually becomes code) so for large
data files it might not be a good idea.



As a proof of concept I adapted two YCP modules and changed the data
files to includes, see these pull requests:

https://github.com/yast/yast-ntp-client/pull/5/files
https://github.com/yast/yast-mouse/pull/2/files


The mouse module is little bit tricky as the database contains translations.
And they need to be translated dynamically to reflect possible language
changes during installation proposal, therefore I added a wrapper function
which always returns a fresh instance of the data with the current translations.


Conslusion:

If you have some spare time and want to help us with the ruby translation
you can start removing the YCP data files.

You can look at the pull requests above for a hint how to do that.
Or just ask here or on the IRC.

Thank you!


--

Best Regards

Ladislav Slezák
Yast Developer
------------------------------------------------------------------------
SUSE LINUX, s.r.o.                              e-mail: [email protected]
Lihovarská 1060/12                              tel: +420 284 028 960
190 00 Prague 9                                 fax: +420 284 028 951
Czech Republic                                  http://www.suse.cz/
--
To unsubscribe, e-mail: [email protected]
To contact the owner, e-mail: [email protected]

Reply via email to