Metanorma: Aequitate Verum

Managing Metanorma versions on Linux using Snap

Author’s picture Alexander Bobrikovich Author’s picture Ronald Tse on 19 Nov 2023

Introduction

There are occasions where a user may want to switch between multiple Metanorma versions, for example:

  • publishing a document of older schema no longer supported by newer Metanorma versions

  • verifying older documents using old schema

  • (the unfortunate) case that a document fails to compile by newer Metanorma versions

On Linux, users typically use Metanorma through Docker containers or the "metanorma" Snap package.

This article describes how to easily manage Metanorma versions through Snap, just with a few commands.

Snap packages

Snapcraft is a universal Linux packaging system, originally developed by Canonical of Ubuntu Linux fame, that allows developers to package their applications and dependencies, making it easy to distribute and install software across various Linux distributions.

Snaps (a "Snap package") are self-contained, sandboxed, and come with all the necessary dependencies, providing a consistent experience across different Linux distributions.

Installing Snap

On a Linux system, make sure you have the snapd service installed. snapd is the "snap daemon", which is needed to install and utilize snap packages.

snapd can be installed it using the following commands on Ubuntu systems:

Installing snapd
sudo apt update
sudo apt install snapd

Installing the Metanorma snap package

The Metanorma snap package is aptly named metanorma.

To install the latest version of snap metanorma, run the following command in your shell:

Installing the metanorma snap package
sudo snap install metanorma

This command will download and install the latest package from the Snap Store.

Downgrading the Metanorma snap package

In some cases, you might need to downgrade to a specific version of metanorma.

Snapcraft makes this process straightforward.

List installed versions

First, list the available versions of the metanorma snap package using the following command:

Command to list installed versions of the metanorma snap package
sudo snap list metanorma --all

If you have several metanorma versions installed before you will get an output similar to this:

Listing installed versions of the metanorma snap package
Name       Version  Rev  Tracking       Publisher   Notes
metanorma  1.7.3    212  latest/stable  metanorma  disabled,classic
metanorma  1.8.1    216  latest/stable  metanorma  classic

Revert to a previous version

Reverting the metanorma snap package to a previous version
sudo snap revert metanorma

Revert to a specific previous version

Reverting the metanorma snap package to a specific previous version
sudo snap revert metanorma --revision 212

List available versions

Listing available version of the metanorma snap package
snap info metanorma

Uninstall

To uninstall the metanorma snap package from your system, use the following command:

Uninstall the metanorma snap package
sudo snap remove metanorma

Conclusion

When using the Snap version of metanorma on Linux, the benefits of the Snapcraft approach are evident — simplified installation, version management, and distribution of software.

While the downgrade process may not be the most straightforward, it is never further than a couple command presses!