Quantcast
Channel: nthykier
Viewing all articles
Browse latest Browse all 86

Improvements to IntelliJ/PyCharm support for Debian packaging files

$
0
0

I have updated my debpkg plugin for IDEA (e.g. IntelliJ, PyCharm, Android Studios) to v0.0.8. Here are some of the changes since last time I wrote about the plugin.

New file types supported

  • .dsc (as a generic deb822 file)
  • .buildinfo and .changes (as a generic deb822 provided the base name looks like it follows the “package_version_arch” pattern)
  • debian/copyright (as a DEP-5 / machine-readable copyright file if the Format field exists).

Links for URLs and bug closes

There are often links in deb822 files or the debian/changelog and as of v0.0.8, the plugin will now highlight them and able you to easily open them via your browser. In the deb822 case, they generally appear in the Homepage field, the Vcs-* fields or the Format field of the debian/copyright field. For the changelog file, they often appear in the form of bug Closes statements – such as the #123456 in “Closes: #123456”, which is a reference to https://bugs.debian.org/123456.

Improvements to debian/control

The dependency validator now has “per-field” knowledge. This enables it to flag dependency relations in the Provides field that uses operators other than “=” (which is the only operator that is supported in that field). It also knows which fields support build-profile restrictions. It in theory also do Architecture restrictions, but I have not added it – among other because it gets a bit spicy around binary packages. (Fun fact, you can have “Depends: foo [amd64]” but only for arch:any packages.)

The plugin now suggests adding a Rules-Requires-Root field to the Source stanza along with a “quick fix” for adding the field. Admittedly, it was mostly done as exercise for me to learn how to do that kind of feature.

Support for machine-readable debian/copyright

The plugin now has a dedicated file type for debian/copyright that follows the machine-readable format. It should auto-detect it automatically based on the presence of the “Format” field being set to https://www.debian.org/doc/packaging-manuals/copyright-format/1.0. Sadly, I have not found the detection reliable in all cases, so you may have to apply it manually.

With the copyright format, the plugin now scans the “Files” fields for common issues like pointing on non-existing paths and invalid escape sequences. When the plugin discovers a path that does not match anything, it highlights the part of the path that cannot be found. As an example, consider the pattern “src/foo/data.c” and that “src/foo” exist but “data.c” does not exist, then the plugin will only flag the “data.c” part of “src/foo/data.c” as invalid.

The plugin will also suggest a quick fix if you a directory into the Files field to replace it with a directory wildcard (e.g. “src/foo” -> “src/foo/*”), which is how the spec wants you to reference every file beneath a given directory.

Finally, when the plugin can identify part of the path, then it will turn it into a link (reference in IDEA lingo). This means that you can CTRL + click on it to jump to the file. As a side-effect, it also provides refactoring assistance for renaming files, where renaming a file will often be automatically reflected in debian/copyright. This use case is admittedly mostly relevant people, who are both upstream and downstream maintainer.

Folding support improvement for .dsc/.changes/.buildinfo files

The new field types appeared with two cases, where I decided to improve the folding support logic.

The first was the GPG signature (if present), which consists of two parts. The top part with is mostly a single line marker but often followed by a GPG armor header (e.g. “Hash: SHA512”) and then the signature blob with related marker lines around it. Both cases are folded into a single marker line by default to reduce their impact on content in the editor view.

The second case was the following special-case pattern:

Files:
 <md5> <size> filename
Checksums-Sha256:
 <sha256> <size> filename

In the above example, where there is exactly on file name, those fields will by default now be folded into:

Files: <md5> <size> filename
Checksums-Sha256: <sha256> <size> filename

For all other multi-line fields, the plugin still falls back to a list of known fields to fold by default as in previous versions.

Spellchecking improvements

The plugin already supported selective spell checking in v0.0.3, where it often omitted spell checking for fields (in deb822 files) where it did not make sense. The spell check feature has been improved by providing a list of known packaging terms/jargo used by many contributors (so “autopkgtests” is no longer considered a typo). This applies to all file types (probably also those not handled by the plugin as it is just a dictionary).

Furthermore, the plugin also attempts discover common patterns (e.g. file names or command arguments) and exempt these from spell checking in the debian/changelog. This also includes manpage references such as “foo.1” or “foo(1)”. It is far from perfect and relies on common patterns to exclude spell checking. Nonetheless, it should reduce the number of false positive considerably.

Feedback welcome

Please let me know if you run into bugs or would like a particular feature implemented. You can submit bug reports and feature requests in the issue tracker on github.


Viewing all articles
Browse latest Browse all 86

Latest Images

Trending Articles





Latest Images