panamax-rs / panamax

Mirror rustup and crates.io repositories, for offline Rust and cargo usage.
Apache License 2.0
427 stars 45 forks source link

Creating a new mirror with historical stable releases? #134

Open 9numbernine9 opened 2 weeks ago

9numbernine9 commented 2 weeks ago

Hello!

I'm trying to set up a new Panamax mirror and I want to include the last several stable Rust toolchains as part of the mirroring process; at the time of this writing 1.79.0 is the most recent Rust stable release, but I'd also like my mirror to have the stable releases going back to 1.77.0 (i.e. 1.79.0, 1.78.0, 1.77.2, 1.77.1, 1.77.0). In my mirror.toml file I've set the following:

keep_latest_stables = 5

... But it seems like this does quite what I'm expecting. Under the dist/ directory I see that a channel-rust-stable.toml file was created that correctly points to the current stable release, but there's no other .toml files that point to any of the older stable releases (e.g. channel-rust-1.78.toml). Looking through the code I don't see very many references to the rustup.keep_latest_stables symbol so I'm not quite sure how this feature is supposed to work. What I was expecting to see is a .toml file for each stable release being kept by Panamax, and each of those files would contain the necessary URLs to download those versions.

Is it possible to bootstrap a new Panamax mirror in this way?

k3d3 commented 2 weeks ago

Unfortunately not at the moment, but funny enough I've run into this same thing as well, wanting to "backfill" old stable releases.

I'd like to officially support this at some point, where keep_latest_stables = 5 will actually download the 5 latest releases.

In the meantime, there's also functionality to "pin" old versions. Try pinning those old versions (1.77.0, 1.78.0, 1.79.0, etc) in the mirror.toml file, and then remove the pins. There's a chance those versions will stay there, but I'm not completely certain.

9numbernine9 commented 2 weeks ago

In the meantime, there's also functionality to "pin" old versions. Try pinning those old versions (1.77.0, 1.78.0, 1.79.0, etc) in the mirror.toml file, and then remove the pins. There's a chance those versions will stay there, but I'm not completely certain.

I tried this out and it does seem to work as a workaround! It is a bit of a pain for the person maintaining the mirror (i.e. edit the pins whenever a new Rust version is released), but it does indeed work. :smile:

k3d3 commented 2 weeks ago

Great, glad to know that works! Now, if you remove that version from the pins, (while having keep_latest_stables set properly), do the files stay or do they get deleted?

If they get deleted, I believe that's technically an edge case bug.

9numbernine9 commented 2 weeks ago

Great, glad to know that works! Now, if you remove that version from the pins, (while having keep_latest_stables set properly), do the files stay or do they get deleted?

After pinning a couple versions and syncing, then commenting out the pinned_rust_versions while leaving keep_latest_stables = 5 and syncing again, the version specific files (e..g channel-rust-1.79.toml) still remain. :+1: