Add package conflicts
Packages can declare conflicts in orbit.json. The solver keeps them apart, and a global install offers to replace the installed ones in the way. Rollback now checks for clashes before it unlinks anything. Planning: 8m9kt Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6d35f207fd
commit
cc47acb3e2
9 files changed
+831
-28
No files matched your search
@@ -12,6 +12,7 @@ A small package manager written in MoonBit that uses any OCI registry (Gitea, GH
|
||||
- **Version constraints:** `1.2.3`, `=1.2.3`, `==1.2.3`, `1.2`, `1.2.*`, `^1.2.0`, `~1.2.0`, `>=1.2`, `<=2.0`, `>1.0`, `<2.0`, `!=1.3.0`, `*`, and comma-separated ranges (`>=1.2.0, <2.0.0`). Prereleases match only when the constraint mentions a `-`.
|
||||
- **Content-addressed store:** packages unpack into `~/.orbit/store/<name>/<digest>/`, and their binaries are symlinked into `~/.orbit/bin/` (global) or `<project>/.orbit/bin/` (project).
|
||||
- **File ownership:** two packages can't provide the same binary.
|
||||
- **Conflicts:** packages can declare that they can't be installed together, and a global install offers to replace the one in the way.
|
||||
- **Upgrade and rollback:** global installs keep the previous two builds, and `orbit rollback <name>` switches back instantly with no network.
|
||||
- **Remove:** `orbit remove` refuses to delete what other global packages need and autoremoves orphaned dependencies; in projects it updates `orbit.toml` and `orbit.lock`.
|
||||
- **gc** deletes store builds that are neither globally current nor kept for rollback.
|
||||
@@ -44,6 +45,30 @@ In a channel this becomes `<channel url>/mytool:1.4.0`, plus the `latest` tag. T
|
||||
| config | `application/vnd.latha.orbit.config.v1+json` (`orbit.json`, with OCI labels for package-page metadata) |
|
||||
| layer `pkg.tar.gz` | `application/vnd.latha.orbit.layer.v1.tar+gzip` |
|
||||
|
||||
### Conflicts
|
||||
|
||||
`conflicts` names packages that can't be installed beside this one, with the
|
||||
versions it applies to (`*` for all):
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "mytool-nightly",
|
||||
"version": "1.5.0",
|
||||
"bin": ["bin/mytool"],
|
||||
"conflicts": { "mytool": "*", "oldplugin": "<2.0.0" }
|
||||
}
|
||||
```
|
||||
|
||||
- Only one of the two packages has to declare it, and the named package need not exist.
|
||||
- Unlike dependencies, a conflict covers prereleases without naming one. It applies to a package name in any channel.
|
||||
- The solver looks for versions that don't conflict, and explains the conflict if there are none.
|
||||
- If a global `orbit install` can't be satisfied beside the installed packages, it asks before removing the ones it conflicts with. Without a terminal it fails unless you pass `--replace`. It never removes a package that another one needs, and downloads everything before removing anything.
|
||||
- `orbit upgrade` and project commands never replace packages. In a project, `orbit remove` the old one first.
|
||||
- `orbit rollback` refuses a build that conflicts with an installed package.
|
||||
- Orbit versions from before this field ignore it, and can't read an `orbit.lock` that contains it.
|
||||
|
||||
### Registry details
|
||||
|
||||
The optional `description` and `documentation` fields supply Gitea's **About**
|
||||
text and **Documentation** link. Use a public or otherwise accessible HTTP(S)
|
||||
URL for the link. Gitea does not render a bundled README inline, but you can
|
||||
@@ -255,6 +280,7 @@ src/main/
|
||||
solver.mbt lazy Resolvo-style CDCL SAT solver & UNSAT explainer (+ tests)
|
||||
ops.mbt SAT-backed global install/upgrade, remove/rollback/gc/search
|
||||
project.mbt orbit.toml, orbit.lock, .orbit/ environments, project CLI (+ tests)
|
||||
conflicts.mbt declared conflicts, replacing installed packages (+ tests)
|
||||
channels.mbt config.toml, channel priority and lookup (+ tests)
|
||||
main.mbt CLI
|
||||
registry_wbtest.mbt mock-OCI registry, SAT global, and project workflow tests
|
||||
|
||||
Reference in new issue
Block a user