[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

DEP5 CANDIDATE parser/editor/validator/migrator is released in libconfig-model-perl



Hello

The new version of libconfig-model-perl  1.229 is now available in Sid. This 
new version provides a model of DEP-5 updated according to the CANDIDATE 
version. (Among other features [1], like editor/validator for debian/control).

The DEP-5 editor must be run in the source package directory (I'll provide an 
example below) with the following command:

  config-edit -application dpkg-copyright <options>

Features:
* check copyright file (with option "-ui none")
* migrate from old format to new format ( with option "-ui none -save")
* graphical editor (no option, but libconfig-model-tkui-perl must be installed)

Known issues:
- some keywords from older versions of DEP-5 specs may have been missed. 
  In this case, feel free to send a mail to config-model-users mailing 
  list or to log a bug in BTS.
- the update of the content of the format string is silent. This behavior 
  is a bit cavalier. This will change in the next version.

Example:

The copyright file of libconfig-model-backend-augeas-perl need to be updated:

Here's the original copyright file (slightly edited to protect my mail box 
and save electrons) :

  $ cat debian/copyright 
  Format-Specification:
    http://wiki.debian.org/Proposals/CopyrightFormat?action=recall&rev=196
  Upstream-Maintainer: Dominique Dumont (ddumont at cpan.org)
  Upstream-Source: http://search.cpan.org/dist/Config-Model-Backend-Augeas/
  Upstream-Name: Config-Model-Backend-Augeas

  Copyright: 2008-2009, Dominique Dumont (ddumont at cpan.org)
  License: LGPL-2+

  Files: debian/*
  Copyright: 2009, Dominique Dumont <dominique.dumont at hp.com>
  License: LGPL-2+

  License: LGPL-2+
    This program is free software; you can redistribute it and/or
	[snip]

First, let's just check issues:

  $ config-edit -application dpkg-copyright -ui none
  Element 'Upstream-Maintainer' of node 'Debian::Dpkg::Copyright' is deprecated
  Element 'Upstream-Source' of node 'Debian::Dpkg::Copyright' is deprecated
  Element 'Upstream-Name' of node 'Debian::Dpkg::Copyright' is deprecated
  Missing 'Files:' specification at top of section number 2. Adding 'Files: *' spec

Then, let's see what's config-edit can fix all by itself:

  $ config-edit -application dpkg-copyright -ui none -save
  [ same warnings displayed ]

Let's check the result of the migration:

  $ config-edit -application dpkg-copyright -ui none
  [ good: no more warnings ]

And here's the content of the upgraded file (drum rolls, please):

  $ cat debian/copyright
  Format: http://dep.debian.net/deps/dep5/
  Upstream-Name: Config-Model-Backend-Augeas
  Upstream-Contact: Dominique Dumont (ddumont at cpan.org)
  Source: http://search.cpan.org/dist/Config-Model-Backend-Augeas/

  Files: *
  Copyright: 2008-2009, Dominique Dumont (ddumont at cpan.org)
  License: LGPL-2+

  Files: debian/*
  Copyright: 2009, Dominique Dumont <dominique.dumont at hp.com>
  License: LGPL-2+

  License: LGPL-2+
    This program is free software; you can redistribute it and/or
    [snip]

You can see that:
- keywords were changed while keeping the correct content
- Format: was updated with the right URL
- "Files: *" line was added in the right place


Please provide feedback!
If you have problem migrating DEP5 files, yell, and we'll fix them. 
If this migration works fine, don't be shy, please say so.


Under the hood:

Most of the migration work is specified in DEP-5 model [2]. Using 
config-model's GUI [3] to update DEP-5 model, about one hour was
spent to:

- flag old parameters as deprecated
- introduce new parameters from candidate version (mostly done by
  cut'n'paste old parameters into their new name, done within the 
  model editor GUI )  
- cut'n'paste the doc bits from the web page into the model editor GUI
- specify migrate_from instruction to copy semantic content from old 
  parameters to new ones. (*)

This shows one important feature of Config::Model: maintenance and evolution 
of a model is not a huge task. Even though copyright files are not configuration
files, the same approach can be used to specify model and migration of other 
configuration files.

Now comes the question of the migration as seen by the user. Well, it's your turn now. 
Try it and tell us how it works!

Hopefully, encouraged by your feedback, other people will apply config-model to other 
specifications or other configuration.

All the best


[1] http://cpansearch.perl.org/src/DDUMONT/Config-Model-1.229/ChangeLog
[2] http://cpansearch.perl.org/src/DDUMONT/Config-Model-1.229/lib/Config/Model/models/Debian/Dpkg/Copyright.pl
[3] config-model-edit -model Debian::Dpkg::Copyright provided by libconfig-model-iteslf-perl
    http://freshmeat.net/projects/config-model-itself/

(*) E.g, in the text format produced by the model editor GUI:
   'Upstream-Contact',
   {
     'value_type' => 'string',
     'migrate_from' => {
       'formula' => '$old_maintainer',
       'variables' => {
          'old_maintainer' => '- Maintainer'
       }
     },
   'type' => 'leaf',
   'description' => '* Syntax: line based list [snip]'
   },


Dominique
--
http://config-model.wiki.sourceforge.net/ -o- http://search.cpan.org/~ddumont/
http://www.ohloh.net/accounts/ddumont     -o- http://ddumont.wordpress.com/


Reply to: