"ext Marius Gedminas" <[EMAIL PROTECTED]> writes:

>> I managed to sneak a bit of Lisp into the Application Manager, but I
>> kept it enterprise ready by hiding it behind XML.  So while the new
>> way of writing .install files looks quite verbose, it is really quite
>> simple.
>
> Now I'm worried.

:-)

>> ### Basic syntax
>> 
> ...
>> It is important to distinguish empty lists from empty texts.  An empty
>> list is written as
>> 
>>     <empty/>
>> 
>> while an empty text is written as
>> 
>>     <empty></empty>
>
> According to the XML spec, these two are exactly equivalent.  -1 for
> insisting for different spellings in different contexts.

Yeah, I was afraid of that.  I am going to fix this.

>> All text must be encoded in UTF-8.
> ...
>> ### Example
>> 
>> The following X-expression is a installation script to install the
>> maemofoo package from the Foobar repository.
>> 
>>     <install-instructions>
>>      <update-catalogues>
>>       <catalogue>
>>        <tag>com.foobar.repository.automatic</tag>
>>        <version>0</version>
>>        <name>
>>         <en_GB>Foobar Catalogue</en_GB>
>>         <de_DE>Foobar Katalog</de_DE>
>>        </name>
>>        <uri>http://example.com/</uri>
>>        <dist><automatic/></dist>
>>        <components>main</components>
>>       </catalogue>
>>      </update-catalogues>
>>      <install-packages>
>>       <pkg>maemofoo</pkg>
>>      </install-packages>
>>     <install-instructions>
>
> Compare this to a hyphotetical .ini-based format like the one used by
> GNOME/Freedesktop .desktop files
>
>     [install]
>     repo_name = Foobar Catalogue
>     repo_name[de_DE] = Foobar Katalog
>     repo_deb = http://example.com/ mistral main
>     repo_deb_3 = http://example.com/ bora main
>     package = maemofoo

(You are missing the tag, version, the en_GB translation, and the
automatic distribution thing.)

I myself prefer the S-expression approach:

   (install-instructions
     (update-catalogues
       (catalogue
         (tag "com.foobar.repository.automatic")
         (version 0)
         (name (en_GB "Foobar Catalogue")
               (de_DE "Foobar Katalog"))
         (uri "http://example.com/";)
         (dist automatic)
         (components "main")))
     (install-packages
       (pkg "maemo-foo")))

which can be shortened to

   (install-instructions
     (update-catalogues
       ((tag "com.foobar.repository.automatic" 0)
        (name (en_GB "Foobar Catalogue")
              (de_DE "Foobar Katalog"))
        (deb "http://example.com/"; automatic "main")))
     (install-packages "maemo-foo"))

Maybe I go with this approach if XML turns out to be too unwieldy.

The .ini-based formats are not expressive or extensible enough, in my
opinion.  When you have multiple repositories each with their own set
of localized names, you are stretching the format quite a bit already.

Essentialy, .ini files don't lead to nice recursive in-core data
structures.  The idea with X-expressions is that they have a simple
mapping to an internal data structure and your program actually works
with that data structure directly.

For example, to get the tag of a catalogue, the code currently does
'xexp_aref_text (cat, "tag")'.  There are no special purpose
conversion functions for catalogues from/to XML, there is just
xexp_read and xexp_write.  This makes not only the file format
extensible, but also gives you code that can be follow when you do it.

With this approach, it is quite trivial to load, store and let the
user modify catalogues.  I no longer want to encode all information
about a catalogue in sources.list, and while we could store this
information in the form of .ini files, I would rather not.

> I think the XML-ish format is harder to write, harder to read,

I agree.

> and provides too many features that I do not see any need for.

Most of the features are needed for new features of the Application
Manager.  But the fundemantal idea still is that we need something
more expressive and extensible for the future.

> Let me try...
>
>     [install]
>     temporary_file_relative_repo_deb = .repository/mistral mistral
>     temporary_file_relative_repo_deb_3 = .repository/bora bora
>     package = frozen-bubble crazy-parking
>     repo_name = Foobar Games
>     repo_name[de_DE] = Foobar Spiele
>     repo_deb = http://foobar.com/ mistral main
>     repo_deb_3 = http://foobar.com/ bora main

(Again it's not exactly the same, and keys like
"temporary_file_relative_repo_deb" really don't look like the way to
go for me.  In the end, you will encode arbitrary tree structures in
key names, with sequence numbers and levels, etc...)

>> The old GKeyFile format used by IT OS 2007 is still supported.  You
>> can embed a X-expression in it as comments like so:
>> 
>>     # <install-instructions>
>>     #  ...
>>     # </install-instructions>
>
> Ouch.  Comments that are not really comments.  I can't say I like it.

Me neither.  It's a compatibility hack.

> Summary: I would prefer a straightforward extension of the current
> .ini-based file format.

We have that currently in the code, and it is not pretty (sorry Jose).
I would like to improve upon it.  Maybe XML is the wrong choice, but I
wanted to experiment with it a bit.
_______________________________________________
maemo-developers mailing list
maemo-developers@maemo.org
https://maemo.org/mailman/listinfo/maemo-developers

Reply via email to