Bundle pimsync 0.5.11 in the flake package; enforce it as the version floor
The Nix-packaged calcalist now wraps its PATH with a pinned pimsync 0.5.11 build, so discover works regardless of what else is on the user's PATH. discover's output format is undocumented and changed between 0.5.9 and 0.5.11 in a way the parser doesn't handle; doctor and the NotFound error now enforce 0.5.11 as a floor instead of accepting any 0.5.x patch. README's install instructions and pimsync note are corrected to match. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
47606a64b7
commit
3d701361da
4 changed files with 64 additions and 9 deletions
|
|
@ -18,9 +18,12 @@ pub const BINARY: &str = "pimsync";
|
|||
|
||||
/// The `0.5.x` series this build generates configuration for. pimsync is
|
||||
/// pre-1.0 and its config syntax may change between minor releases, so the
|
||||
/// range is deliberately narrow.
|
||||
/// range is deliberately narrow. The patch floor matters too: `discover`'s
|
||||
/// output format is undocumented and changed between 0.5.9 and 0.5.11, and
|
||||
/// `parse_discovery` only understands the newer shape.
|
||||
pub const SUPPORTED_MAJOR: u64 = 0;
|
||||
pub const SUPPORTED_MINOR: u64 = 5;
|
||||
pub const SUPPORTED_PATCH_MIN: u64 = 11;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub struct Version {
|
||||
|
|
@ -37,7 +40,9 @@ impl fmt::Display for Version {
|
|||
|
||||
impl Version {
|
||||
pub fn is_supported(&self) -> bool {
|
||||
self.major == SUPPORTED_MAJOR && self.minor == SUPPORTED_MINOR
|
||||
self.major == SUPPORTED_MAJOR
|
||||
&& self.minor == SUPPORTED_MINOR
|
||||
&& self.patch >= SUPPORTED_PATCH_MIN
|
||||
}
|
||||
|
||||
/// Parses the `pimsync 0.5.11` line printed by `pimsync version`.
|
||||
|
|
@ -54,7 +59,9 @@ impl Version {
|
|||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum PimsyncError {
|
||||
#[error("`{BINARY}` was not found on PATH; install it (devbox provides {BINARY}@0.5.11)")]
|
||||
#[error(
|
||||
"`{BINARY}` was not found on PATH; install pimsync {SUPPORTED_MAJOR}.{SUPPORTED_MINOR}.{SUPPORTED_PATCH_MIN} or newer"
|
||||
)]
|
||||
NotFound,
|
||||
#[error("could not run `{BINARY}`: {0}")]
|
||||
Spawn(#[source] io::Error),
|
||||
|
|
@ -674,17 +681,29 @@ url_command = "secret-tool lookup service calcalist account gcal-ics"
|
|||
let supported = Version {
|
||||
major: 0,
|
||||
minor: 5,
|
||||
patch: 0,
|
||||
patch: 11,
|
||||
};
|
||||
let next_series = Version {
|
||||
major: 0,
|
||||
minor: 6,
|
||||
patch: 0,
|
||||
patch: 11,
|
||||
};
|
||||
assert!(supported.is_supported());
|
||||
assert!(!next_series.is_supported());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_patch_older_than_the_floor_is_rejected() {
|
||||
// discover's output format changed between 0.5.9 and 0.5.11; older
|
||||
// patches within the otherwise-supported minor series are refused.
|
||||
let too_old = Version {
|
||||
major: 0,
|
||||
minor: 5,
|
||||
patch: 9,
|
||||
};
|
||||
assert!(!too_old.is_supported());
|
||||
}
|
||||
|
||||
/// Established against a real server: everything arrives on stdout, the
|
||||
/// headings are colour-coded even through a pipe, and both storages of the
|
||||
/// pair are reported.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue