From 651fb06f4610b525c97d9e8b847d86fe9fa46075 Mon Sep 17 00:00:00 2001 From: Tomo <68489118+tomodachi94@users.noreply.github.com> Date: Sat, 4 Nov 2023 17:21:42 +0000 Subject: [PATCH] New remote spec --- src/v1.1.0/package-remotes.md | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/src/v1.1.0/package-remotes.md b/src/v1.1.0/package-remotes.md index 0442eba..2e9af54 100644 --- a/src/v1.1.0/package-remotes.md +++ b/src/v1.1.0/package-remotes.md @@ -1,18 +1,33 @@ -**Package remotes** are a feature in unicornpkg that allow you to download package tables semi-automatically. +**Package remotes** are a feature in unicornpkg that allow you to download package tables semi-automatically from a server. ## Specification ### Remote -The remote is a simple HTTPS server. It's usually a GitHub repository, but other hosts should work fine. +The remote must be a simple HTTPS server. HTTP is allowed, but discouraged. Remotes may also be folders located anywhere in the filesystem. Write access to these filesystem-based remotes is not guaranteed, as some might be located in `/rom`. -Each package should be a file on the package remote ending in `.lua`. +Each package should be a file on the package remote ending in `.lua`. Each package should return the `text/lua` or `text/plain` MIME types. -All packages on the remote should return valid package tables. +All packages on the remote, when evaluated, should return valid package tables. + +All packages and their versions should be listed in a JSON file (the "manifest") available at `/unicornpkg.remote.json` on the remote. The JSON file should look like this: + +```jsonc +{ + spec: "unicornpkg-1.1.0", + packages: { + "somepackage": "1.0.1", + "examplepackage": "1.2.3", + "anotherexamplepackage": null // No version available for this package; always specify a version where possible + } +} +``` + +This file should return the `application/json` MIME type. Manifests should be automatically updated by a script where possible. ### Retrieval on the client -The client will have a folder called `/etc/unicorn/remotes/` that will contain one serialised file per remote. Each serialised file should contain a `url` keyword specifiying the full HTTP path to the remote, as well as a `packages` table that contains known packages from that remote. +The client will have a folder called `/etc/unicorn/remotes/` that will contain one serialised file per remote. Each serialised file should contain a `url` keyword specifiying the full HTTPS path to the remote. -`unicorn.hoof.update()` should parse each file in `/etc/unicorn/remotes` and update the `packages` table. +`unicorn.hoof.update()` should parse each file in `/etc/unicorn/remotes` and check for validity. It should download each remote's manifest into `/var/unicorn/remotes/remotename.json`. -`unicorn.hoof.get()` should parse each file in `/etc/unicorn/remotes/` and download the requested file to `/tmp/unicorn/{package_name}.lua`, and then `unicorn.install()` should install said file. +`unicorn.hoof.get()` should parse each manifest in `/var/unicorn/remotes/`. It should evaluate the version strings, find the newest version for a package across all remotes, and then download and install the package table from the remote.