App::DocKnot::Spin::Versions(3pm)

App::DocKnot::Spin::Versions3pm

Parse package release information for spin

Usage

    use App::DocKnot::Spin::Versions;
    my $versions = App::DocKnot::Spin::Versions('/path/to/.versions');
    my $version = $versions->version('some-package');
    my $release_date = $versions->release_date('some-package');
    my $timestamp = $versions->latest_release('some/file/index.th');

Requirements

Perl 5.24 or later and the Path::Tiny module, available from CPAN.

Overview

App::DocKnot::Spin supports a database of release information for packages that may be referenced in the generated web site. This is stored as the file named .versions at the top of the source tree. This module parses that file and provides an API to the information it contains.

The file should consist of lines (except for continuation lines, see below) in the form:

    <package>  <version>  <date>  <time>  <files>

starting in the first column. Each field is separated by one or more spaces except the last, <files>, which is all remaining space-separated words of the line. Blank lines and lines starting with "#" in the first column are ignored.

The fields are:

<package>

The name of a package.

<version>

The version number of the latest release of that package.

<date>

The date of the latest release of that package in YYYY-MM-DD format in the local time zone.

<time>

The time of the latest release of that package in HH:MM:SS format in the local time zone.

<files>

Any number of thread input files affected by this release, separated by spaces. The file names should be relative to the top of the source tree for the web site.

The <files> field can be continued on the following line by starting the line with whitespace. Each whitespace-separated word in a continuation line is taken as an additional affected file for the previous line.

This information is used for the "\version" and "\release" thread commands and to force regeneration of files affected by a release with a timestamp newer than the timestamp of the corresponding output file.

Class methods

new(PATH)

Create a new App::DocKnot::Spin::Versions object for the .versions file specified by PATH.

Instance methods

latest_release(PATH)

Return the timestamp (in seconds since epoch) for the latest release affecting PATH, or 0 if no releases affect that file.

release_date(PACKAGE)

Return the release date of the latest release of PACKAGE (in UTC), or "undef" if there is no release information for PACKAGE.

update_version(PACKAGE, VERSION, TIMESTAMP)

Given a new VERSION and TIMESTAMP (in seconds since epoch) for a release of PACKAGE, update the release information in the .versions file for that package accordingly. If the .versions file is at the root of a Git repository, this change will be staged with "git add".

version(PACKAGE)

Return the version of the latest release of PACKAGE, or "undef" if there is no release information for PACKAGE.

Releases

2 releases since Debian 12 (Bookworm); the text changed 1 time.

  1. 12
  2. 13

Author

Russ Allbery <[email protected]>

From docknot 8.0.1-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.