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

Bump crates version from the latest crates.io version #12

Merged
merged 6 commits into from
May 31, 2023

Conversation

lexnv
Copy link
Contributor

@lexnv lexnv commented May 30, 2023

This PR guarantees that when preparing for publication on crates.io, the latest version of the crate is obtained directly from crates.io.

By doing so, any differences in versions between the local repository, which might contain an outdated version and the versions on crates.io are avoided.

While at it, fixed clippy and applied cargo fmt

Testing Done

cargo run --release prepare-for-publish --path /home/lexnv/workspace/substrate -c "sp-core" -c "sp-core-hashing" -c "sp-runtime" -c "sp-keyring" -c "sp-version"                                                                                               16:52:34
   Compiling subpub v0.1.0 (/home/lexnv/workspace/subpub)
    Finished release [optimized] target(s) in 1.42s
     Running `target/release/subpub prepare-for-publish --path /home/lexnv/workspace/substrate -c sp-core -c sp-core-hashing -c sp-runtime -c sp-keyring -c sp-version`
Crate 'sp-debug-derive' version 6.0.0 does not match crates.io version 7.0.0
Crate 'sp-std' version 6.0.0 does not match crates.io version 7.0.0
Crate 'sp-storage' version 8.0.0 does not match crates.io version 12.0.0
Crate 'sp-wasm-interface' version 8.0.0 does not match crates.io version 13.0.0
Crate 'sp-externalities' version 0.14.0 does not match crates.io version 0.18.0
Crate 'sp-runtime-interface-proc-macro' version 7.0.0 does not match crates.io version 10.0.0
Crate 'sp-tracing' version 7.0.0 does not match crates.io version 9.0.0
Crate 'sp-runtime-interface' version 8.0.0 does not match crates.io version 16.0.0
Crate 'sp-core-hashing' version 6.0.0 does not match crates.io version 8.0.0
Crate 'sp-core' version 8.0.0 does not match crates.io version 20.0.0
Crate 'sp-trie' version 8.0.0 does not match crates.io version 21.0.0
Crate 'sp-panic-handler' version 6.0.0 does not match crates.io version 7.0.0
Crate 'sp-keystore' version 0.14.0 does not match crates.io version 0.26.0
Crate 'sp-state-machine' version 0.14.0 does not match crates.io version 0.27.0
Crate 'sp-arithmetic' version 7.0.0 does not match crates.io version 15.0.0
Crate 'sp-io' version 8.0.0 does not match crates.io version 22.0.0
Crate 'sp-weights' version 5.0.0 does not match crates.io version 19.0.0
Crate 'sp-application-crypto' version 8.0.0 does not match crates.io version 22.0.0
Crate 'sp-core-hashing-proc-macro' version 6.0.0 does not match crates.io version 8.0.0
Crate 'sp-version-proc-macro' version 4.0.0 does not match crates.io version 7.0.0
Crate 'sp-runtime' version 8.0.0 does not match crates.io version 23.0.0
Crate 'sp-version' version 6.0.0 does not match crates.io version 21.0.0
Crate 'sp-keyring' version 8.0.0 does not match crates.io version 23.0.0
    Updating crates.io index
    Updating sp-keyring v8.0.0 (/home/lexnv/workspace/substrate/primitives/keyring) -> v24.0.0
    Updating sp-runtime v8.0.0 (/home/lexnv/workspace/substrate/primitives/runtime) -> v24.0.0
    Updating sp-version v6.0.0 (/home/lexnv/workspace/substrate/primitives/version) -> v22.0.0

You've said you'd like to publish these crates:

  sp-core
  sp-core-hashing
  sp-runtime
  sp-keyring
  sp-version

The following crates need publishing (in this order) in order to do this:

  sp-debug-derive
  sp-std
  sp-storage
  sp-wasm-interface
  sp-externalities
  sp-runtime-interface-proc-macro
  sp-tracing
  sp-runtime-interface
  sp-core-hashing
  sp-core
  sp-trie
  sp-panic-handler
  sp-keystore
  sp-state-machine
  sp-arithmetic
  sp-io
  sp-weights
  sp-application-crypto
  sp-core-hashing-proc-macro
  sp-version-proc-macro
  sp-runtime
  sp-version
  sp-keyring

I'm bumping the following crate versions to accomodate this:

  sp-debug-derive: 6.0.0 -> 8.0.0
  sp-std: 6.0.0 -> 8.0.0
  sp-storage: 8.0.0 -> 13.0.0
  sp-wasm-interface: 8.0.0 -> 14.0.0
  sp-externalities: 0.14.0 -> 0.19.0
  sp-runtime-interface-proc-macro: 7.0.0 -> 11.0.0
  sp-tracing: 7.0.0 -> 10.0.0
  sp-runtime-interface: 8.0.0 -> 17.0.0
  sp-core-hashing: 6.0.0 -> 9.0.0
  sp-core: 8.0.0 -> 21.0.0
  sp-trie: 8.0.0 -> 22.0.0
  sp-panic-handler: 6.0.0 -> 8.0.0
  sp-keystore: 0.14.0 -> 0.27.0
  sp-state-machine: 0.14.0 -> 0.28.0
  sp-arithmetic: 7.0.0 -> 16.0.0
  sp-io: 8.0.0 -> 23.0.0
  sp-weights: 5.0.0 -> 20.0.0
  sp-application-crypto: 8.0.0 -> 23.0.0
  sp-core-hashing-proc-macro: 6.0.0 -> 9.0.0
  sp-version-proc-macro: 4.0.0 -> 8.0.0
  sp-runtime: 8.0.0 -> 24.0.0
  sp-version: 6.0.0 -> 22.0.0
  sp-keyring: 8.0.0 -> 24.0.0

Now, you can create a release PR to have these version bumps merged

// @paritytech/subxt-team

lexnv added 4 commits May 30, 2023 15:43
Signed-off-by: Alexandru Vasile <[email protected]>
Signed-off-by: Alexandru Vasile <[email protected]>
Signed-off-by: Alexandru Vasile <[email protected]>
}

// Does the current version of this crate exist on crates.io?
// If so, we need to bump the current version.
let known_versions = external::crates_io::get_known_crate_versions(&self.name)?;
Ok(known_versions.contains(&self.version))
self.known_versions = external::crates_io::get_known_crate_versions(&self.name)?;
Copy link
Collaborator

@jsdw jsdw May 30, 2023

Choose a reason for hiding this comment

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

Personally I'd prob just call this in CrateDetails::load, prob just with a little interface like:

pub struct CrateVersions {
    name: String
    versions: RefCell<Option<HashSet<Version>>>
}

impl CrateVersions {
    pub fn new(crate_name: String) -> Self { ... }
    pub fn get(&self) -> &HashSet<Versions> {
        // get from cache or load from crates.io if not obtained yet)
    }
}

That way the bump version function isn't dependant on this one running first or whatever in order to work properly :)

@jsdw
Copy link
Collaborator

jsdw commented May 30, 2023

Looks great to me; just a wee suggestion for tidiness so that the order that we call functions in doesn't matter :)

src/crates.rs Outdated Show resolved Hide resolved
@lexnv lexnv merged commit e7eff30 into main May 31, 2023
@lexnv lexnv deleted the lexnv/bump-from-cratesio branch May 31, 2023 14:16
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.

3 participants