Skip to content

Debian copyright DEP5 parser/editor/validator/migrator is released

January 13, 2011

Hello

The new version of libconfig-model-perl 1.229 is now available in Debian/Sid. This new version provides a model of Debian’s DEP-5 copyright file specification updated according to the CANDIDATE version. (Among other features, 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

[ update: you can also run config-edit -application dpkg to edit more files in debian directory, like debian/control ]

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 needs 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
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
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

(*) 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]'
},

About these ads

From → Debian, packaging

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: