Dominique Dumont: Creating a DEP-5 parser with Config::Model
Hello
Following a discussion on #debian-perl IRC channel, I ve proposed to provide a script to parse DEP-5 files. The goal is to be able to parse *and* validate DEP-5 files. DEP-5 is a
proposal to make debian/copyright machine-interpretable. This proposal is driven by Lars Wirzenius. With Config::Model, any evolution of DEP-5 specification will
be easy to include in the DEP-5 model read by Config::Model. What DEP-5 model ? To keep a long story short, let s say that DEP-5 model is a description of DEP-5 syntax and semantic that can be used by Config::Model to perform validation. For more detail on how to create a model, please read this doc. In other word, DEP-5 model is DEP-5 document translated into a special format. First step was to directly edit the doc and munge it into a YAML document describing the structure of DEP-5. Here s a small extract of this YAML file (slightly edited to remove most long descriptions) :
During this YAML file creation step, the problem raised by the License keyword became obvious because of License properties:
- the parse function to load DEP-5 data in a simple data structure
- the read function to load the simple data structure into Config::Model s configuration tree You can view the code on Config::Model repository. Then the model is divided in 3 configuration classes:
And the full model of Dep-5 can be also read on Config::Model repository:
(The models are biggish because they include help text taken from DEP-5 documentation)
Now some explanation is required on how is performed the License validation.
The trick is that each License used must be listed in Dep5 s license parameter which is specified this way (in YAML syntax):
proposal to make debian/copyright machine-interpretable. This proposal is driven by Lars Wirzenius. With Config::Model, any evolution of DEP-5 specification will
be easy to include in the DEP-5 model read by Config::Model. What DEP-5 model ? To keep a long story short, let s say that DEP-5 model is a description of DEP-5 syntax and semantic that can be used by Config::Model to perform validation. For more detail on how to create a model, please read this doc. In other word, DEP-5 model is DEP-5 document translated into a special format. First step was to directly edit the doc and munge it into a YAML document describing the structure of DEP-5. Here s a small extract of this YAML file (slightly edited to remove most long descriptions) :
---
class:
Debian::Dep5:
class_description: >
Machine-readable debian/copyright
accept:
name_match: X-.*
type: leaf
value_type: string
element:
Format-Specification:
mandatory: 1
type: leaf
value_type: uniline
description: >-
URI of the format specification, such as ...
Name:
type: leaf
value_type: uniline
Files:
type: hash
index_type: string
ordered: 1
cargo:
type: node
config_class_name: Debian::Dep5::Content
During this YAML file creation step, the problem raised by the License keyword became obvious because of License properties:
- Limited number of valid License (no problem, let s use an enum)
- License names are not case sensitive (optimism goes somewhat down)
- License names have version number and an optional + suffix (ok, let s use a regular expression with Config::Model s brand new match specification)
- License can be combined with and or or . (uh oh, the match regexp will not be enough. A grammar would be better.)
- License can specify an abbreviation or the full text of the license.
- the parse function to load DEP-5 data in a simple data structure
- the read function to load the simple data structure into Config::Model s configuration tree You can view the code on Config::Model repository. Then the model is divided in 3 configuration classes:
- Debian::Dep5: the root class
- Debian::Dep5::Content: To represent Files specification
- Debian::Dep5::License
And the full model of Dep-5 can be also read on Config::Model repository:
(The models are biggish because they include help text taken from DEP-5 documentation)
Now some explanation is required on how is performed the License validation.
The trick is that each License used must be listed in Dep5 s license parameter which is specified this way (in YAML syntax):
License:
type: hash
index_type: string
allow_keys_matching: '^(?i:Apache Artistic BSD etc... other)[\d\.\-]*\+?$'
cargo:
type: leaf
value_type: string
So this License element contains the list of licenses with their full text and only Licenses whose name matches the regular expression are accepted.
Now, let s explain how the files are tied to the declaredlicenses. The Debian::Dep5::Content class had a License element that represent the relation between the files and the License(s). This bond is represented by Debian::Dep5::License configuration class. The abbrev and full_license elements are fairly obvious.
The abbrev element is another matter. Here s its declaration (minus the description and help):
abbrev: type: leaf value_type: uniline default: otherSo far, so good. Now the meaty part: the validation requirement based on Parse::RecDescent
grammar: "license (oper license)(s?)
oper: 'and' 'or'
license: /[\\w\\-\\.\\+]+/i\n
# PRD action to check if the license text is provided
$return = $arg[0]->grab('! License')->defined($item[0]);
"
This grammar specifies:
- The syntax of the License line itself (hence something like Perl or GPL )
- An action performed when the grammar is matched. Using Config::Model API, this Perl snippet checks that the License abbreviation has a corresponding License declared in Debian::Dep5 License hash
- Implement exception parsing
- Provided DEP-5 writer
- Provide config-edit-dep5 cli
It s finally done. For several
Now that
At some point in the past my bookmarks broke in such a way that I wasn't able anymore to alter in any way the bookmarks, deletions, additions, reorganisation, nothing worked.
Now that Debian s graphical installer flavour has migrated to X11, porting it to GNU/kFreeBSD became a low hanging fruit, so I shamelessly 
It is not as prestigious as
Now that Squeeze is frozen, and release date is approaching, removing unused and buggy packages from the archive is a nice task to save maintenance burden which often involves several people (QA guys and Release Managers, mostly).
A lot of removal bugs are coming to
A lot is being said on how Ruby is packaged in Debian and Ubuntu. In this post, I m trying to go through the most common myths and give my position as a Debian Ruby maintainer. Note that those are my views, not necessarily those of the other Debian Ruby maintainers.
Myth: Ruby is completely outdated in Debian and Ubuntu
There s a culture in the Ruby community of always using the latest bleeding-edge version. There s also a culture (though this one has recessed a bit, I think) that it s perfectly fine to change APIs in incompatible ways if it makes the software slightly better.
In Debian (and Ubuntu) stable releases, we try to provide a rock-solid version of Ruby that won t be allowed to change API during the support lifetime of a release. Bugfixes for important bugs can be applied, but that s basically all. So it s not surprising that Ruby in released versions of Debian and Ubuntu is behind the latest upstream version.
In development branches, we are following the latest upstream versions quite closely. Debian 6.0 squeeze , to be released by the end of the year, includes Ruby 1.8.7-p302, and will include 1.9.2-p0 (the currently of Ruby 1.9.2 in squeeze is currenty a SVN snapshot from beginning of august).
There are people interested in installing a packaged Ruby that just works, and other people interested in installing their own version of Ruby (through RVM and such). People in the Ruby community tend to forget about the first category, and consider that, because they install Ruby from source or with RVM, that should be the solution for everybody.
We need the Ruby community to respect that different people have different ways of using Ruby, and to stop recommending that everyone using Debian and Ubuntu should install Ruby from source.
We also need to leverage the backports services for both Debian and Ubuntu to provide a way to install the latest upstream version on stable releases. The only reason why we are not doing it yet is lack of time.
Myth: Ruby is split into a myriad of packages in Debian
In the past (pre-2005), a decision was made to split some libraries from the standard library into separate packages. This was motivated by:






* I was thinking to move out of as many as non-free (FaiF) web services after reading
Emdebian Grip 1.0.1 (based on Debian GNU/Linux 5.0.6) is now available.