-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Finish spacetimedb-update functionality #2126
base: master
Are you sure you want to change the base?
Conversation
621fba2
to
59ec2a0
Compare
(It looks like this currently isn't passing CI, so I'm holding off on review) |
59ec2a0
to
35e5488
Compare
Review notes:
|
crates/cli/src/subcommands/start.rs
Outdated
let status = cmd | ||
.status() | ||
.with_context(|| format!("exec failed for {}", bin_path.display()))?; | ||
let status = result.with_context(|| format!("exec failed for {}", bin_path.display()))?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe these changes are to address #2133.
Given that that issue has a different purpose and surface area for testing than the update functionality, I would like to suggest addressing it in a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Split out into #2200.
Note to self: I still need to:
|
35e5488
to
030c9b3
Compare
I removed the rm-core-as-dep-of-cli commit from this branch, I'll do it as a follow-up PR. |
030c9b3
to
80940cc
Compare
}; | ||
#[cfg(windows)] | ||
let result = { | ||
cmd.env("SPACETIMEDB_UPDATE_MULTICALL_APPLET", applet); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this needed because the args[0]
behavior is different on windows than on linux e.g. if going via a shortcut/symlink?
What's the advantage of doing this differently on windows vs unix than just always doing this env-based approach?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ultimately this is a hack to get behavior like argv0 on windows. In the future, there'll hopefully be a function akin to argv0 on windows, but for now this is the best approximation. rust-lang/rust#66510
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense. I think my question remains though: if the "hack" is good enough for windows, why not just use it on both platforms and have less surface area for edge cases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I probably don't have an answer for that besides "that feels icky". would you like me to change it?
(I merged in |
let args = args.collect::<Vec<_>>(); | ||
if args.first().is_some_and(|s| s == "version") { | ||
// if the first arg is unambiguously `version`, go straight to `spacetime version` | ||
spacetimedb_update_main() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Q: is this case necessary for some reason? Won't the CLI end up delegating back to spacetimedb-update
anyway?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but there's no perfect way for the cli to find the update binary again. If you're running via cargo run or something, it'll find cli_bin_path
in ~/.local
, but then spacetime version
will delegate to a different binary. It all sucks, but I feel this avoids the most bad edge cases.
90089f7
to
05186de
Compare
05186de
to
7f72ea7
Compare
#[clap(allow_hyphen_values = true)] | ||
args: Vec<OsString>, | ||
}, | ||
SelfInstall { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this subcommand is new since my last review? What motivated this?
fn main() { | ||
let target = std::env::var("TARGET").unwrap(); | ||
println!("cargo::rustc-env=BUILD_TARGET={target}"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not very familiar with massaging the build process - what's this for?
|
||
/// Set a local installation of SpacetimeDB as a custom version. | ||
#[derive(clap::Args)] | ||
pub(super) struct Link { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is new since my last review - why did we add this in here? It does seem convenient but it's whole extra bit of surface area that I think we could add in a backwards-compatible way later. Was it part of some spec somewhere or did Tyler request it or something?
Description of Changes
based off #2011
Adds implementations to all the subcommands of
spacetime version
.Expected github release artifact structure:
spacetime-{rustc-target-triple}.{ext}
ext = if windows { "zip" } else { "tar.gz" }
spacetimedb-cli[.exe]
,spacetimedb-standalone[.exe]
,spacetimedb-update[.exe]
cc @clockworklabs/devops - feedback on this^^ would be nice. I kept the edge cases since that's how it already was and I figured that might make it easier in the release workflow, but honestly I'd prefer if it was justImplemented in #2193.spacetime-{rustc-target-triple}.{ext}
if possible. Not sure where the release flow is or if it's even automated.Expected complexity level and risk
3 - a complex bit of code that's implementing a theoretically perpetual contract between
spacetimedb-update
, github release artifacts, and the directory structure.Testing
spacetime version install
works