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

Produce source package in rust-installer format #34366

Merged
merged 2 commits into from
Aug 14, 2016

Conversation

Diggsey
Copy link
Contributor

@Diggsey Diggsey commented Jun 19, 2016

See rust-lang-deprecated/rust-buildbot#102

There may be a better way to do this, wasn't sure how to clean-up the rust-src-image directory when it's used by multiple make rules.

@rust-highfive
Copy link
Collaborator

r? @brson

(rust_highfive has picked a reviewer for you, use r? to override)

@alexcrichton
Copy link
Member

Thanks! Could you also update src/bootstrap/build/dist.rs with a rule for this as well?

@Diggsey
Copy link
Contributor Author

Diggsey commented Jun 19, 2016

The rustbuild system doesn't seem to produce a source tarball at all right now - should I make it produce the vanilla tarball in addition to the rust-installer package?

@alexcrichton
Copy link
Member

Oh whoops! Eh it's fine to not do that as part of this PR if you'd prefer, but if you wanna throw it in I'm also fine with that!

$(Q)$(S)src/rust-installer/gen-installer.sh \
--product-name=Rust \
--rel-manifest-dir=rustlib \
--success-message=Awesome-Source. \
Copy link
Contributor

Choose a reason for hiding this comment

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

lol

@brson
Copy link
Contributor

brson commented Jun 20, 2016

cc #19535

@brson
Copy link
Contributor

brson commented Jun 20, 2016

So after installation of the rust-src package the full Rust source will be at lib/rustlib/rust-src meaning the source to std will be at lib/rustlib/rust-src/src/libstd.

We've also discussed about the potential to need other source installations, but without concrete use cases. You might imagine that rust-src gets split into rust-src, rust-core-src, rustc-src etc. or we add a cargo-src. Should we consider making the scheme for storing the source expandable by putting this at e.g. lib/rust/lib/src/rust/?

cc @phildawes @alexreg @MarkSwanson this PR is deciding the scheme for storing the installed Rust source on disk. Once we deploy it it will be very hard to change.

cc brson/multirust#77

@brson
Copy link
Contributor

brson commented Jun 20, 2016

It might also be worth considering the impact on side-by-side installation. Right now it's in theory vaguely possible to install multiple Rust's right on top of each other because of the disambiguated crate names, though in practice there are artifacts in rustlib that are not disambiguated. Putting a single copy of the source at a known location in rustlib means that only one can exist at a time. This is fine for rustup, but not fine for e.g. Linux distros.

I think I'm kinda fine just saying that every rustlib belongs to a single Rust installation, but it does put a nail in the coffin of any hope of treating rustlib as a more general 'global assembly cache'.

@brson
Copy link
Contributor

brson commented Jun 21, 2016

cc @jauhien @vadimcn @sylvestre packaging people. This PR is trying to finalize the storage location for the Rust source code (#19535), for use by various tools, and I want to check what impact it might have on packagers. In rustup it'll be an optional package called rust-src, and tentatively installed to lib/rustlib/rust-src.

The concern I have regarding distro packaging is the impact on side-by-side installation. In particular, if SxS is achieved by just installing multiple revisions of Rust directly on top of each other then this src location doesn't work because multiple revisions will want to put the source there.

From previous conversations with @jauhien my impression was that at least Gentoo had a more sophisticated SxS installation scheme of their own. What I would like to do for simplicity is abandon any pretense that rustlib is shared by multiple versions of Rust. Let distros deal with SxS installation their own way and reexamine how it impacts us when the time comes.

Of course distros may not want to use our scheme for installing the source at all, but then they are going to have to deal with the integration with tools separately.

@Diggsey
Copy link
Contributor Author

Diggsey commented Jun 21, 2016

I've updated rustbuild to produce the two source distributions, and fixed the typo in rustlib.

@@ -287,6 +289,97 @@ pub fn std(build: &Build, compiler: &Compiler, target: &str) {
t!(fs::remove_dir_all(&image));
}

/// Creates the `rust-std` installer component as compiled by `compiler` for the
/// target `target`.
Copy link
Contributor

Choose a reason for hiding this comment

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

copy-pasted comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops

@alexcrichton
Copy link
Member

I'd personally lean a bit towards rustlib/src/rust instead of rustlib/rust-src just to allow for Cargo one day (and perhaps other tools like rustfmt), but I don't think we'll go too far in the directon of rustlib/rust-core-src as it'd basically just be a space optimization.

@MarkSwanson
Copy link

I'm glad this is being worked on!
I like rustlib/src/rust.
I like making it easy to perhaps add the sources for cargo / rustfmt etc. Maybe llvm headers. clippy? etc.

@brson
Copy link
Contributor

brson commented Jun 23, 2016

Let's go with rustlib/src/rust and keep pressing forward.

@sylvestre
Copy link
Contributor

Sorry for the dumb question but what is SxS ?
Besides that, we don't ship the sources as a package in Debian. We are using the tag from github to get the tarball.

@sorear
Copy link
Contributor

sorear commented Jun 25, 2016

@sylvestre side-by-side installation, in other words having more than one version of rust (e.g. nightly and stable) installed and usable on the same machine at the same time

@bors
Copy link
Contributor

bors commented Jul 2, 2016

☔ The latest upstream changes (presumably #34611) made this pull request unmergeable. Please resolve the merge conflicts.

@brson
Copy link
Contributor

brson commented Jul 8, 2016

Something to consider re the std-aware cargo RFC: in order to teach cargo how to build std, we're most likely going to end up having cargo look in the sysroot for the source - that is, the source we're packaging in this PR.

So far we've not made any particular commitments about what the 'shape' of that source will like, we're just dumping the source tree into rustlib/src/rust. ISTM though that Cargo might want a deterministic scheme for finding crates with a specific name, so that if it learns that e.g. collections is part of the crate tag, it knows to look in a specific directory for a Cargo.toml corresponding to the collections package.

ISTM there's also some overlap here with the idea of 'local crates.io mirrors' as well. @alexcrichton does it make sense for Cargo to treat part of the sysroot as a standard local crates.io mirror?

I guess I see a few options here:

  • we can go forward with this 'dump' of the raw source into the sysroot and expect tools to just kinda do there best (I imagine they would have a two stage lookup: first, use hardcoded knowledge of the official Rust source tree to find a crate; second walk the tree looking for Cargo.toml files)
  • we can instead plan a more structured layout for source in the sysroot where tools know exactly how to find the source to a specific crate
  • we can go ahead with the current patch but plan on adding the additional structure later.
  • a combination of the above, but structuring the source in the sysroot to fit Cargo's hypothetical 'local registry' layout.

For the sake of expediency I think I'm inclined to just keep going forward with this patch and force tools like Cargo to do their bust to locate the crates in the source tree.

cc @Ericson2314

@brson
Copy link
Contributor

brson commented Jul 8, 2016

@Diggsey what are the prospects for whipping this patch back into shape?

@Diggsey
Copy link
Contributor Author

Diggsey commented Jul 8, 2016

Just need to fix the merge conflicts then in that case.

@eternaleye
Copy link
Contributor

@brson: Personally, I'd prefer option 3 - roll this out as is, but plan on adding structure.

In the end, that results in the same two-phase lookup being written into tools, but rather than privileging rustc (and making every other compiler implementation take a perf hit unless they mimic a historical accident, and one that may change in the future if rustc's repo changes anything), it makes the fallback less and less frequently-hit over time.

It's just as expedient for Rust (no extra work before rollout), more expedient for Cargo (implement only the "look for Cargo.toml" path now), and doesn't privilege rustc over future implementations (at least one is already being written as mrustc.)

@alexcrichton
Copy link
Member

@brson this is basically already in the shape of a "path source" that Cargo expects today (or a git repository), so it should interoperate regardless. If we want to work with a local registry or vendored directory then we'd probably want more structure, but as you say I'm fine adding that later.

@Diggsey
Copy link
Contributor Author

Diggsey commented Jul 9, 2016

Fixed conflicts.

@Diggsey
Copy link
Contributor Author

Diggsey commented Aug 9, 2016

Failure looks to be spurious, and was caused by remove_dir_all being broken on windows (#29497)

@brson
Copy link
Contributor

brson commented Aug 10, 2016

@bors retry

@bors
Copy link
Contributor

bors commented Aug 10, 2016

⌛ Testing commit 777bd6f with merge 0eefd73...

@bors
Copy link
Contributor

bors commented Aug 10, 2016

💔 Test failed - auto-mac-64-opt-rustbuild

@Diggsey
Copy link
Contributor Author

Diggsey commented Aug 11, 2016

Ugh... That should fix it for mac. 🍎 🔫

@brson
Copy link
Contributor

brson commented Aug 11, 2016

@bors r+

@bors
Copy link
Contributor

bors commented Aug 11, 2016

📌 Commit 511c0d1 has been approved by brson

@bors
Copy link
Contributor

bors commented Aug 11, 2016

⌛ Testing commit 511c0d1 with merge 7f6705d...

@bors
Copy link
Contributor

bors commented Aug 11, 2016

💔 Test failed - auto-mac-64-opt-rustbuild

@alexcrichton
Copy link
Member

@bors: retry

@bors
Copy link
Contributor

bors commented Aug 12, 2016

⌛ Testing commit 511c0d1 with merge 1447527...

@bors
Copy link
Contributor

bors commented Aug 12, 2016

💔 Test failed - auto-mac-64-opt-rustbuild

…a tarball

Copy source files from rust code

Add missing wildcard

Remove unused function

Remove use of tar --transform
@Diggsey
Copy link
Contributor Author

Diggsey commented Aug 12, 2016

I think this is caused by the addition of the metadata section and package checksums to the Cargo.lock format in new versions of cargo, but I have no idea why other PRs aren't affected, or why a different version of cargo would be being used.

@Mark-Simulacrum
Copy link
Member

Other PRs wouldn't be affected if they didn't change Cargo.toml as far as I know; I think this is true of most PRs.

@alexcrichton
Copy link
Member

Lots of Cargo.lock exists that shouldn't in those logs, for example libpanic_unwind/Cargo.lock shouldn't ever exist. I wonder how they're being created?

The Cargo in use to generate these is pinned, it's downloaded as part of the bootstrap process

@Diggsey
Copy link
Contributor Author

Diggsey commented Aug 13, 2016

@alexcrichton Those files exist in the repository...

@Diggsey
Copy link
Contributor Author

Diggsey commented Aug 13, 2016

This should fix the tidy check.

There were two problems:

  1. This specific check did not work on windows. msys's git diff-index ignores filenames with backslashes in, so the files would always show as unchanged. I fixed this by replacing backslashes with forward slashes before passing it to git.
  2. git diff-index produces false positives after running make dist. I still haven't figured out why this happens, but using git diff instead fixes the problem.

@alexcrichton
Copy link
Member

@bors: r=brson b3908d0

@bors
Copy link
Contributor

bors commented Aug 14, 2016

⌛ Testing commit b3908d0 with merge 92ae4ce...

bors added a commit that referenced this pull request Aug 14, 2016
Produce source package in rust-installer format

See rust-lang-deprecated/rust-buildbot#102

There may be a better way to do this, wasn't sure how to clean-up the `rust-src-image` directory when it's used by multiple make rules.
@bors bors merged commit b3908d0 into rust-lang:master Aug 14, 2016
@Diggsey
Copy link
Contributor Author

Diggsey commented Aug 14, 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.