paritytech / substrate-up

Scripts for working with new Substrate projects
Apache License 2.0
67 stars 21 forks source link

Scripts location wrong #29

Closed electronix closed 5 years ago

electronix commented 5 years ago

When using the HEAD of the substrate-node-new script, the compilation fails because the scripts are not located in ./scripts but in the root folder.

I fixed this [1] and can create a PR, but I'm not sure if the downloaded image is "wrong" and where you want to have the scripts in the end (I prefer the ./scripts folder).

Regards Marcel

[1] https://github.com/electronix/substrate-up/commit/089f0df0678c24669da7feffd028e9bb1f166afc

ltfschoen commented 5 years ago

I'm using Debian 8. Whenever I run substrate-node-new substrate-node-template <author-name> (following this guide: https://docs.substrate.dev/docs/creating-a-custom-substrate-chain for example), I get the following errors:

$ substrate-node-new substrate-node-template abc

  Substrate Node Template Setup 
  Downloading project...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 66477  100 66477    0     0  37483      0  0:00:01  0:00:01 --:--:-- 37472
mv: cannot move 'substrate-node-template' to a subdirectory of itself, 'substrate-node-template/substrate-node-template'
Customizing project...
Initializing repository...
Initializing WebAssembly build environment...
/home/me/.cargo/bin/substrate-node-new: line 88: ./scripts/build.sh: No such file or directory
Building node...
...
error: couldn't read src/../runtime/wasm/target/wasm32-unknown-unknown/release/substrate_node_template_runtime_wasm.compact.wasm: No such file or directory (os error 2)
  --> src/chain_spec.rs:96:10
   |
96 |             code: include_bytes!("../runtime/wasm/target/wasm32-unknown-unknown/release/substrate_node_template_runtime_wasm.compact.wasm").to_vec(),
   |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: couldn't read src/../runtime/wasm/target/wasm32-unknown-unknown/release/substrate_node_template_runtime_wasm.compact.wasm: No such file or directory (os error 2)
  --> src/service.rs:29:2
   |
29 |     include_bytes!("../runtime/wasm/target/wasm32-unknown-unknown/release/substrate_node_template_runtime_wasm.compact.wasm")
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 2 previous errors

But if I change the script to the following and run it with bash substrate-node-template.sh abc def then it works.

if [[ "$OSTYPE" == "linux-gnu" ]]; then
    if [ -f /etc/debian_version ]; then
              ./init.sh 2>/dev/null >/dev/null
              ./build.sh  
    fi
else
        ./scripts/init.sh 2>/dev/null >/dev/null
        ./scripts/build.sh  
fi

If it affects all platforms then we could just change it to:

./init.sh 2>/dev/null >/dev/null
./build.sh  

The current lines of code that I'm talking about modifying are Lines 86-88:

./scripts/init.sh 2>/dev/null >/dev/null
./scripts/build.sh  

Alternatively we could update the relevant section of https://docs.substrate.dev/docs/creating-a-custom-substrate-chain to tell users to follow substrate-package https://github.com/shawntabrizi/substrate-package instead

shawntabrizi commented 5 years ago

Solved with https://github.com/paritytech/substrate-up/pull/30

Tested on Mac OS