Skip to content
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

Make multirust-rs work with both v1 and v2 manifests #69

Merged
merged 9 commits into from
Feb 25, 2016
Merged

Make multirust-rs work with both v1 and v2 manifests #69

merged 9 commits into from
Feb 25, 2016

Conversation

brson
Copy link
Contributor

@brson brson commented Feb 19, 2016

This wires the cli to the new installer code for both v1 and v2
distribution manifests. v1 installations are upgraded to v2
automatically.

I copied test cases from multirust.sh into tests/cli-v1.rs,
tests/cli-v2.rs and tests/cli-misc.rs. Many of them unrelated to
getting installation from the distribution server working are still
unported and marked #[ignore]. There is a lot of setup necessary for
these tests and they are quite slow. I've been testing with --release.

The metadata format is sloppy right now.

  • rustlib/rust-installer-version - Still the same as rust-installer
  • rustlib/components - Components has its own component list that is
    the same as rust-installer, and I think needed for v1 manifest
    compatibility
  • rustlib/manifest-$component - The component manifest, per rust-installer
  • rustlib/multirust-config.toml - The multirust distribution
    configuration, which currently contains its own component/target
    list per the v2 manifests, and is versioned.
  • rustlib/multirust-channel-manifest.toml - A stored copy of the
    distribution manifest.

This does a metadata version bump, but doesn't add the upgrade code yet.

Next steps are probably:

  • Port remaining tests
  • Add upgrade code
  • Add a MULTIRUST_ENABLE_EXPERIMENTAL env var that is required before installing from a v2 manifest. This is so that we can merge the v2 code back into master without worrying about whether it really works with the live manifests.
  • Merge into master

At that point we've got feature parity with master, but with an entirely new backend.

After that

  • Turn on v2 manifests when they are live.
  • Do some refactoring to clean up the messes I've made. Remove old install code that's now unused.
  • Add extension installation to the cli.
  • Review the UI and installation experience. Make sure error cases work as expected.
  • Move bins to $CARGO_HOME with upgrade.
  • Rebrand to rustup and publish www.rustup.rs. Leave compatible multurust command for a while.

@brson
Copy link
Contributor Author

brson commented Feb 19, 2016

cc @Diggsey @alexcrichton

This ensures than any mentioned component actually has a package
to download. Just a defensive measure against backend mistakes.
This wires the cli to the new installer code for both v1 and v2
distribution manifests. v1 installations are upgraded to v2
automatically.

I copied test cases from multirust.sh into tests/cli-v1.rs,
tests/cli-v2.rs and tests/cli-misc.rs. Many of them unrelated to
getting installation from the distribution server working are still
unported and marked #[ignore]. There is a lot of setup necessary for
these tests and they are quite slow. I've been testing with --release.

The metadata format is sloppy right now.

* rustlib/rust-installer-version - Still the same as rust-installer
* rustlib/components - Components has its own component list that is
  the same as rust-installer, and I think needed for v1 manifest
  compatibility
* rustlib/manifest-$component - The component manifest, per rust-installer
* rustlib/multirust-config.toml - The multirust distribution
  configuration, which currently contains its own component/target
  list per the v2 manifests, and is versioned.
* rustlib/multirust-channel-manifest.toml - A stored copy of the
  distribution manifest.
The format of the installed toolchains has changed.

The big jump is to leave room for multirust.sh to leave room
for multirust.sh to make its own diverging versions.
@aturon
Copy link
Member

aturon commented Feb 19, 2016

\o/

let _g = LOCK.lock();
let cwd = env::current_dir().unwrap();
env::set_current_dir(path).unwrap();
let _g = scopeguard::guard((), move |_| env::set_current_dir(&cwd).unwrap());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd personally feel that defining a shim here with a Drop implementation would be easier than pulling in a whole crate to do this job, but either way's probably fine.

If this function stays it may also be best to return an RAII guard instead of taking a closure (helps indentation, etc)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think turning this into a guard will help readability - the indentation actually is good for readability because it indicates that within a particular block the directory is different. Without the extra block it's less obvious the environment has changed.

@alexcrichton
Copy link
Member

Nice!

The not-yet-live v2 manifests aren't enabled without this on.
This will let us merge back into master without worry that
multirust will be broken when they do go live.
Like `multirust default 1.0.0`.
return Err(Error::ObsoleteDistManifest);
}

let url = new_manifest.iter().find(|u| u.contains(&self.target_triple));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be specifically looking for target_triple + ".tar.gz" here, otherwise it will just find whichever file happens to be listed first for that target.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(This is what's causing the failures on appveyor)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch.

@Diggsey
Copy link
Contributor

Diggsey commented Feb 20, 2016

Great! If you could just fix the two things causing the CI failures then I'm happy to merge this in - you can treat my other comments as just TODOs before this all gets merged back to master.

@Diggsey Diggsey mentioned this pull request Feb 20, 2016
@kamalmarhubi kamalmarhubi mentioned this pull request Feb 20, 2016
@brson brson mentioned this pull request Feb 24, 2016
@brson
Copy link
Contributor Author

brson commented Feb 24, 2016

I've added a few more commits: the MULTIRUST_ENABLE_EXPERIMENTAL var, making installation from explicit stable versions ("1.0.0") work, and addressing feedback.

The only thing I didn't do was change change_dir per @alexcrichton because I don't think it will be an improvement.

@brson
Copy link
Contributor Author

brson commented Feb 24, 2016

Thanks for the reviews.

@Diggsey
Copy link
Contributor

Diggsey commented Feb 25, 2016

Travis is still failing, but I'll merge this in and try to sort it out on new.

Diggsey added a commit that referenced this pull request Feb 25, 2016
Make multirust-rs work with both v1 and v2 manifests
@Diggsey Diggsey merged commit 33cfa4b into rust-lang:new Feb 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants