Skip to main content

Crate logoxide_import

Crate logoxide_import 

Source
Expand description

logoxide-import: packages from other publishers’ downloads, so a Bible that isn’t a logoxide package can still be installed: its files with a logoxide.toml around them, which a project uses as an import dependency kept in the library (logoxide-app’s importer), or as a path package (or which can be pushed anywhere as a git repository).

  • eBible.org (ebible): a translation’s <id>_usfm.zip, one USFM file per book, with its copyright in copr.htm (the package’s license file)
  • fetch.bible (fetch): a translation’s USX, a file per book, with its attribution in COPYRIGHT.txt
  • CCEL (ccel): a Bible’s ThML, the whole Bible in one file, described by its own head (title, language, rights, version), with its rights in COPYRIGHT.txt
  • Door43 (door43): a Bible’s release, its repository’s archive at the tag, a resource container whose manifest.yaml describes it, its USFM a file per book
  • SWORD (sword): a module’s zip from its repository, read with sword-modules from memory: a Bible’s or commentary’s entries in their own markup (OSIS, ThML, or GBF), a file per book, or a dictionary’s as entries/<module>.xml, with its conf’s copyright and license in COPYRIGHT.txt
  • Bundles (burrito): a Scripture Burrito (metadata.json) or a Digital Bible Library text release bundle (metadata.xml) a translator or publisher hands over, by URL or as a local file or folder, its USX, USFM, or USJ checked by the MD5s its metadata lists

Each publisher’s list is read into a logoxide Catalog (catalog::parse), every entry a CatalogSource::External naming its import (ebible:eng-asv), the download it’s made from, and what to fetch (downloads); build makes the package from the bytes. A bundle has no list: its import names where it is, and named_catalog makes its entry from that. The package manager keeps only that, and knows no publisher.

A new import is version 1.0.0 (IMPORT_VERSION), logoxide’s own: the publisher’s version (an update date, a module’s Version) is kept in [package.upstream], and each update raises the package’s version by what it changes (update::compare_import), so lx add can ask for ^1 and updates cross the publisher’s years.

Re-exports§

pub use update::ImportUpdate;
pub use update::apply_import;
pub use update::compare_import;
pub use update::compare_publisher_versions;
pub use update::import_is_current;
pub use update::import_removals;
pub use update::set_version;

Modules§

burrito
Bundles a translator or publisher hands over, read by the metadata that lists their files: a Scripture Burrito’s metadata.json (burrito:; what Paratext, Scribe, Autographa, and Pankosmia write) or a Digital Bible Library text release bundle’s metadata.xml (dbl:; Burrito’s ancestor, the same fields as XML). Neither publisher has a list to search: an import names where the bundle is, a URL (burrito:https://…/x.zip) or a file or folder (burrito:file:///home/me/x.zip), and the bundle names itself.
catalog
Other publishers’ lists as logoxide catalogs, each entry a CatalogSource::External saying what its import downloads:
ccel
CCEL (the Christian Classics Ethereal Library): its page of Bibles (catalog), its genre indexes (genre_catalog: commentaries, Bibles, and any other genre’s books), and a work’s ThML (import), the whole work in one file (url), described by its own head (title, language, rights, version, and whether it’s a Bible, a commentary, or a book: thml_head), with its rights in COPYRIGHT.txt. Its lists give no versions: an update is found by downloading.
door43
Door43 (unfoldingWord’s Door43 Content Service, git.door43.org): its catalog of Bibles (catalog, the catalog API’s search?subject=Bible&stage=prod) and a Bible’s release (import): the repository’s archive/<tag>.tar.gz, a resource container whose manifest.yaml describes it (dublin_core: title, language, rights, version) and whose .usfm files are its books.
ebible
eBible.org: its list of translations (catalog, translations.csv) and a translation’s <id>_usfm.zip (import), one USFM file per book, with its copyright in copr.htm (the package’s license file). Its versions are update dates, which follow its updates
fetch
fetch.bible: its manifest of translations (catalog, manifest.json) and a translation’s USX (import), a file per book (book_url), with its attribution in COPYRIGHT.txt. Its versions are years, which don’t follow its updates: an update is found by downloading
license
Publishers’ statements read as licenses: a Creative Commons link or name, or the public domain (license_from_text, from eBible.org’s copr.htm), and whether a statement says something is in the public domain without denying it (says_public_domain, for CCEL’s DC.Rights and SWORD’s DistributionLicense). What a license allows (logoxide::license::Rights) is the package manager’s: this only reads the publishers’ words
sword
SWORD repositories: a repository’s list of modules (catalog, its mods.d.tar.gz) and a module’s zip (import, from zip_urls), read with sword-modules from memory: a Bible’s or commentary’s entries in their own markup (OSIS, ThML, or GBF), a file per book, or a dictionary’s as entries/<module>.xml (doc/entries.md), with its conf’s copyright and license in COPYRIGHT.txt. A module’s Version follows its updates.
update
Updating an import: the same import made again from the publisher’s newer download, compared with the one a project has (compare_import), replaced (apply_import), and skipped when the publisher’s own version says it’s current (import_is_current)

Constants§

IMPORT_VERSION
The version a new import has: logoxide’s own, which updates raise by what they change
PREFIXES
Every publisher’s import prefix: what ebible:<id> and fetch:<id> start with

Functions§

build
The package entry’s import makes, written into dest, from the bytes of each of its downloads (by name), whichever publisher it comes from
downloads
What importing entry downloads, so every host fetches the same files the same way: eBible.org’s zip, fetch.bible’s books (each named by its code), CCEL’s ThML, a SWORD module’s zip, or a Door43 release’s archive (its URLs tried in turn). Packages from git or a registry aren’t imported, which is an error
named_catalog
A catalog of the one entry an import names when no publisher’s list is needed to find it: a CCEL work by its author and name (ccel:henry/mhc1), or a bundle by where it is (burrito:https://example.org/web.zip); none for another
unzip
Each file in a .zip, by path (folders left out), within logoxide-text’s limits
upstream
What an import of entry writes as its package’s [package.upstream]: the download it was made from, its import name, and the publisher’s version the entry lists, so an imported package names the catalog entry it came from (Catalog::find_upstream); none for packages that aren’t imported