mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-19 21:41:02 +00:00
fix substrate-node-template generation (#2050)
# Description This PR updates the node-template-release generation binary as well as the `node-template-release.sh` file so that we can automatically push updates to the [substrate-node-template repository](https://github.com/substrate-developer-hub/substrate-node-template). I assume this part was not updated after the substrate project has been moved into the polkadot-sdk mono repo. # Adjustments - extend the `node-template-release.sh` to support the substrate child-folder - update the `SUBSTRATE_GIT_URL` - fix the Cargo.toml filter (so that it does not include any non-relevant .toml files) - set the workspace-edition to 2021 # Note In order to auto-generate the artifacts [this line](https://github.com/paritytech/polkadot-sdk/blob/master/.gitlab/pipeline/build.yml#L320C15-L320C15) needs to be included in the build.yml script again. Since I do not have access to the (probably) internal gitlab environment I hope that someone with actual access can introduce that change. I also do not know how the auto-publish feature works so that would be another thing to add later on. --------- Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
@@ -3,7 +3,9 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
export TERM=xterm
|
export TERM=xterm
|
||||||
PROJECT_ROOT=`git rev-parse --show-toplevel`
|
SUBSTRATE_FOLDER="/substrate"
|
||||||
|
GIT_ROOT=`git rev-parse --show-toplevel`
|
||||||
|
PROJECT_ROOT=${GIT_ROOT}${SUBSTRATE_FOLDER}
|
||||||
|
|
||||||
if [ "$#" -ne 1 ]; then
|
if [ "$#" -ne 1 ]; then
|
||||||
echo "node-template-release.sh path_to_target_archive"
|
echo "node-template-release.sh path_to_target_archive"
|
||||||
@@ -11,6 +13,6 @@ if [ "$#" -ne 1 ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
PATH_TO_ARCHIVE=$1
|
PATH_TO_ARCHIVE=$1
|
||||||
cd $PROJECT_ROOT/scripts/ci/node-template-release
|
|
||||||
|
|
||||||
|
cd $PROJECT_ROOT/scripts/ci/node-template-release
|
||||||
cargo run $PROJECT_ROOT/bin/node-template $PROJECT_ROOT/$PATH_TO_ARCHIVE
|
cargo run $PROJECT_ROOT/bin/node-template $PROJECT_ROOT/$PATH_TO_ARCHIVE
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ use tar;
|
|||||||
use tempfile;
|
use tempfile;
|
||||||
use toml_edit::{self, value, Array, Item, Table};
|
use toml_edit::{self, value, Array, Item, Table};
|
||||||
|
|
||||||
const SUBSTRATE_GIT_URL: &str = "https://github.com/paritytech/substrate.git";
|
const SUBSTRATE_GIT_URL: &str = "https://github.com/paritytech/polkadot-sdk.git";
|
||||||
|
|
||||||
type CargoToml = toml_edit::Document;
|
type CargoToml = toml_edit::Document;
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@ fn copy_node_template(node_template: &Path, dest_path: &Path) {
|
|||||||
|
|
||||||
/// Find all `Cargo.toml` files in the given path.
|
/// Find all `Cargo.toml` files in the given path.
|
||||||
fn find_cargo_tomls(path: &PathBuf) -> Vec<PathBuf> {
|
fn find_cargo_tomls(path: &PathBuf) -> Vec<PathBuf> {
|
||||||
let path = format!("{}/**/*.toml", path.display());
|
let path = format!("{}/**/Cargo.toml", path.display());
|
||||||
|
|
||||||
let glob = glob::glob(&path).expect("Generates globbing pattern");
|
let glob = glob::glob(&path).expect("Generates globbing pattern");
|
||||||
|
|
||||||
@@ -196,7 +196,6 @@ fn update_root_cargo_toml(
|
|||||||
) {
|
) {
|
||||||
let mut workspace = Table::new();
|
let mut workspace = Table::new();
|
||||||
workspace.insert("members", value(Array::from_iter(members.iter())));
|
workspace.insert("members", value(Array::from_iter(members.iter())));
|
||||||
|
|
||||||
let mut workspace_dependencies = Table::new();
|
let mut workspace_dependencies = Table::new();
|
||||||
deps.values()
|
deps.values()
|
||||||
.flatten()
|
.flatten()
|
||||||
@@ -212,6 +211,10 @@ fn update_root_cargo_toml(
|
|||||||
workspace_dependencies[name]["rev"] = value(commit_id);
|
workspace_dependencies[name]["rev"] = value(commit_id);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let mut package = Table::new();
|
||||||
|
package.insert("edition", value("2021"));
|
||||||
|
workspace.insert("package", Item::Table(package));
|
||||||
|
|
||||||
workspace.insert("dependencies", Item::Table(workspace_dependencies));
|
workspace.insert("dependencies", Item::Table(workspace_dependencies));
|
||||||
cargo_toml.insert("workspace", Item::Table(workspace));
|
cargo_toml.insert("workspace", Item::Table(workspace));
|
||||||
|
|
||||||
@@ -428,9 +431,12 @@ frame-system = { workspace = true }
|
|||||||
let expected_toml = r#"[workspace]
|
let expected_toml = r#"[workspace]
|
||||||
members = ["node", "pallets/template", "runtime"]
|
members = ["node", "pallets/template", "runtime"]
|
||||||
|
|
||||||
|
[workspace.package]
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
frame-system = { version = "4.0.0-dev", default-features = true, git = "https://github.com/paritytech/substrate.git", rev = "commit_id" }
|
frame-system = { version = "4.0.0-dev", default-features = true, git = "https://github.com/paritytech/polkadot-sdk.git", rev = "commit_id" }
|
||||||
sp-io = { version = "7.0.0", git = "https://github.com/paritytech/substrate.git", rev = "commit_id" }
|
sp-io = { version = "7.0.0", git = "https://github.com/paritytech/polkadot-sdk.git", rev = "commit_id" }
|
||||||
|
|
||||||
[profile]
|
[profile]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user