Skip to content

2020 Metadata format migration

Alejandro R Mosteo edited this page Sep 7, 2020 · 5 revisions

Overview

Metadata storage has been simplified with the objective of making some processes simpler and provide better workflows for users of Alire.

A rationale for the changes can be found at https://github.com/alire-project/alire/blob/1bc699922d1fa83e64d5cd36f2870a9ed7fd6a25/doc/AEPs/aep-0002.md

In short, now you are expected to keep the manifest file (alire.toml) and companion lock file (alire.lock) at the root of your project under version control. The manifest is to be updated as needed to reflect your project needs (dependencies, project files, etc.) and will need only minimal modifications for publishing (adding the origin table describing how to obtain the sources).

Summary of changes

  • The ./alire/crate_name.toml file is moved to ./alire.toml (always named alire.toml).
  • The contents of the file, described in https://github.com/alire-project/alire/blob/master/doc/catalog-format-spec.md, suffer the following main changes:
    • The [general] and [x.x.x] tables are merged and its contents moved to the top-level table of the file (no [ ] nested table).
    • The origin related fields cannot longer appear in a workspace manifest.
    • The origin related fields are now under an [origin] table in the index manifest.
    • New name and version fields are mandatory at the top level. Its type is string and its contents the crate name and semantic version, respectively.
    • Dependencies are no longer inside a table, but inside one or more [[depends-on]] array entries.
  • The ./alire/config file is renamed to ./alire/config.toml

How to migrate an old manifest to the new format

If your project is simple you may find easier to just reinitialize the workspace and re-fill your information in the new manifest. Otherwise, follow these steps:

  1. Move and rename ./alire/<crate_name>.toml to ./alire.toml
  2. Edit ./alire.toml:
    1. Add a name = "<crate name>" field at the top (using your actual crate name).
    2. Add a version = "x.x.x" field at the top (use an actual numeric version).
    3. Replace any [depends-on] table with a [[depends-on]] array of tables entry.
    4. Remove the [general] line.
    5. Remove any ['x.x.x'] line (your file will contain an actual version, possibly 0.0.0).
    6. Remove any general and 'x.x.x' prefixes from the rest of fields/tables, if any.
    7. Remove any origin-related fields (origin, origin-hashes, archive-name).
  3. If ./alire/config exists, rename it as ./alire/config.toml
Clone this wiki locally