[Top][All Lists]

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

cl-defstruct-based package.el, now with ert tests!

From: Daniel Hackney
Subject: cl-defstruct-based package.el, now with ert tests!
Date: Mon, 11 Mar 2013 21:03:25 -0400

I've mentioned this project on the list before, and I want to update
everyone now that I have more thorough testing.

My aim has been to clean up package.el, primarily by using
`cl-defstruct' to create a `package-desc' structure which is used
throughout the library. This replaces the current situation, in which
package information floats through the library in several different
forms. Sometimes a package is represented as a `cons' of the package
name and a vector of information, sometimes (as in "foo-pkg.el" files),
it is represented more like a list, and sometimes as a name and version
as separate arguments. Moving to a single, uniform representation
simplifies extensibility.

The changes touch most of the code, but the overall structure of the
code has not changed significantly. Some parts of the code which were
questionable in the first place (such as using `tar-mode' to extract tar
archives) have been replaced with simpler alternatives. In the case of
tar, the file is simply downloaded to a temporary directory and
extracted using "tar xaf foo-1.2.3.tar".

This reorganization will make it easier to add features, most notably
the use of compressed archives and signatures, since the code is better
organized and easier to modify.

An important part of the work is that it is fully compatible with the
externally-facing "API" of the current package.el. It produces and
consumes exactly the same "archive-contents" and "*-pkg.el" files as the
current package.el, so none of the existing infrastructure needs to

Finally, I have written a set of tests using ERT to ensure correct
behavior. The file is in "test/automated" and tests:

- single- and multi-file package installation
- installing packages with dependencies
- refreshing archive contents
- displaying the "*Packages*" buffer
- Upgrading packages using `package-menu-mark-upgrades'

All of the tests pass for me.

It is rebased off of the current trunk. My rewrite is here:


Hope you enjoy!

Daniel Hackney

reply via email to

[Prev in Thread] Current Thread [Next in Thread]