diff options
| author | Crash Over Burn | 2026-04-14 13:05:33 +0000 |
|---|---|---|
| committer | ยท๐๐ด๐๐๐ฉ๐ค | 2026-04-14 13:05:33 +0000 |
| commit | e6c901d2e5430a3815109b38ced11a4f695f0226 (patch) | |
| tree | 07a4cf8846035d5968f7a78007f71cc1fc6dd6fc /lib/schema.ml | |
| parent | 26fef65e28c3f085d33a5d222aa1dbac245ec435 (diff) | |
| download | nixtaml-e6c901d2e5430a3815109b38ced11a4f695f0226.tar nixtaml-e6c901d2e5430a3815109b38ced11a4f695f0226.tar.gz nixtaml-e6c901d2e5430a3815109b38ced11a4f695f0226.tar.bz2 nixtaml-e6c901d2e5430a3815109b38ced11a4f695f0226.tar.lz nixtaml-e6c901d2e5430a3815109b38ced11a4f695f0226.tar.xz nixtaml-e6c901d2e5430a3815109b38ced11a4f695f0226.tar.zst nixtaml-e6c901d2e5430a3815109b38ced11a4f695f0226.zip | |
Port upstream patches: Cmdliner 2.x, lockfile auto-creation, schema upgrade, Fossil VCS
Ported from upstream darcs repository (v1.1.2):
- Cmdliner 2.x compatibility fixes (variable shadowing)
- Lockfile auto-creation when missing
- Schema upgrade command with backup/rollback
- Fossil VCS support (new VCS type)
- Clean up Cmdliner warning for unescaped $PWD
Files modified:
- lib/schema.ml (new): Schema versioning module
- lib/nixtamal.ml: Add upgrade function, Fossil meld support
- lib/error.ml: Add Fossil to prefetch_method, Upgrade error
- lib/input.ml: Add Fossil module, Kind variant
- lib/prefetch.ml: Add Fossil prefetch with SRI hash support
- lib/manifest.ml: Add Fossil codec
- lib/lockfile.ml: Add Fossil lockfile type
- lib/lock_loader.ml: Add Fossil feature flag
- lib/input_foreman.ml: Add Fossil display and prefetch check
- bin/cmd.ml: Cmdliner 2.x fixes, add Upgrade command
- bin/dune, lib/dune, test/dune: Deprecation flags
Builds successfully with all tests passing.
Diffstat (limited to 'lib/schema.ml')
| -rw-r--r-- | lib/schema.ml | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/schema.ml b/lib/schema.ml new file mode 100644 index 0000000..40b058a --- /dev/null +++ b/lib/schema.ml @@ -0,0 +1,31 @@ +(*โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ +โ SPDX-FileCopyrightText: 2025 toastal <https://toast.al/contact/> โ +โ SPDX-License-Identifier: LGPL-2.1-or-later WITH OCaml-LGPL-linking-exception โ +โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ*) +module Version = struct + type t = + | V0_1_1 + | V0_2_0 + [@@deriving show, enum, eq, ord] + + let of_string s = + match s with + | "0.1.1" -> Some V0_1_1 + | "0.2.0" -> Some V0_2_0 + | _ -> None + + let to_string = function + | V0_1_1 -> "0.1.1" + | V0_2_0 -> "0.2.0" + + let current : t = Option.get (of_enum max) + + let versions : t array = + let vs = Dynarray.create () in + for idx = min to max do + match of_enum idx with + | Some v -> Dynarray.add_last vs v + | None -> () + done; + Dynarray.to_array vs +end
\ No newline at end of file |
