Dpkg: edit debian/control description without worrying about leading ‘.’ and ‘ ‘
Hello
In Debian package, the debian/control file has a specific syntax where each line must begin with a space and paragraphs are separated by a single ‘.’. If you want to follow DEP-5 syntax for debian/copyright files, you have a similar problem when comes the time to fill the license text for creative-common license: it’s easy to miss a space or a dot.
Let’s say I want to add a new section in the description of my package. Here’s the current description:
Description: module to automate definition of a DBIx::Class::Schema DBIx::Class::Schema::Loader is an extension to DBIx::Class that automates the definition of a DBIx::Class::Schema by scanning table schemas and setting up columns and primary keys appropriately. It supports MySQL, PostgreSQL, SQLite and DB2. . Bare table definitions are fairly straightforward, but relationship creation is somewhat heuristic, especially with respect to choosing relationship types and names, as well as join types. The relationships generated by this module will probably never be as well-defined as hand-generated ones.
I want to add “This package is awesome” but I don’t want to be bothered by leading dots and white spaces.
First, I go in the package directory, then check the syntax with cme:
$ cme check dpkg
Then create a loop directory, where the dpkg content will be mapped to a fuse directory:
$ mkdir loop $ cme fusefs dpkg -fuse-dir loop/ Mounting config on loop/ in background. Use command 'fusermount -u loop/' to unmount $ cat loop/control/binary/libdbix-class-schema-loader-perl/Description DBIx::Class::Schema::Loader is an extension to DBIx::Class that automates the definition of a DBIx::Class::Schema by scanning table schemas and setting up columns and primary keys appropriately. It supports MySQL, PostgreSQL, SQLite and DB2. Bare table definitions are fairly straightforward, but relationship creation is somewhat heuristic, especially with respect to choosing relationship types and names, as well as join types. The relationships generated by this module will probably never be as well-defined as hand-generated ones.
Then edit loop/control/binary/libdbix-class-schema-loader-perl/Description with your favorite editor.
For the sake of this blog, I will use echo to edit this file:
$ echo -e "\nThis module is awesome" >> loop/control/binary/libdbix-class-schema-loader-perl/Description
Now umount the loop (note that the actual debian/control is not changed before this step):
fusermount -u loop
Now the result:
$ cat debian/control [...] Description: module to automate definition of a DBIx::Class::Schema DBIx::Class::Schema::Loader is an extension to DBIx::Class that automates the definition of a DBIx::Class::Schema by scanning table schemas and setting up columns and primary keys appropriately. It supports MySQL, PostgreSQL, SQLite and DB2. . Bare table definitions are fairly straightforward, but relationship creation is somewhat heuristic, especially with respect to choosing relationship types and names, as well as join types. The relationships generated by this module will probably never be as well-defined as hand-generated ones. . This module is awesome
Here’s another example to fill the license text for a license while respecting DEP-5 syntax, (done after the cme command):
# creating this dir will create a new DEP-5
# standalone license section with name CC-BY-30
mkdir loop/copyright/License/CC-BY-30
# fill the text part of the license
wget http://creativecommons.org/licenses/by/3.0/legalcode -O - \
| html2text -style pretty > loop/copyright/License/CC-BY-30/text
$ fusermount -u loop
$ cat debian/copyright
[...]
License: CC-BY-30
.
.
.
Creative_Commons
.
.
Creative Commons Legal Code
.
.
Attribution 3.0 Unported
[...]
And that’s it. (note that cme command is new and is available only from version 2.004 of Config::Model)
Of course, there’s more than a awy to do it: you can also run cme edit dpkg and add or edit license text in the GUI (or in an editor launched by the GUI). cme will take care of the syntax details.
All the best