Hi, (sorry for top-posting) Unfortunately, reading is not the only operation with the data - YaST also writes them quite extensively. I don't really know what exactly the problem (internally) is, anyway, I have one suggstion: Does reading/writing of the AutoYaST profiles, installation workflow definition and similar files work? If it does, I don't see any reason not to use this YaST-specific XML. It can hold any YCP structures and also the conversion of existing data should be rather simple. Would this suggestion help? Jiri On 04/25/2013 12:18 PM, Ladislav Slezak wrote:
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: lslezak@suse.cz Lihovarská 1060/12 tel: +420 284 028 960 190 00 Prague 9 fax: +420 284 028 951 Czech Republic http://www.suse.cz/
-- Regards, Jiri Srain Project Manager --------------------------------------------------------------------- SUSE LINUX, s.r.o. e-mail: jsrain@suse.com Lihovarska 1060/12 tel: +420 284 084 659 190 00 Praha 9 fax: +420 284 084 001 Czech Republic http://www.suse.com -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org To contact the owner, e-mail: yast-devel+owner@opensuse.org