raspberrypi / pico-setup

92 stars 42 forks source link

Make script idempotent #11

Open ndabas opened 3 years ago

ndabas commented 3 years ago

If the script fails on the first try, and is re-run later, it fails for two reasons:

This PR fixes these issues. This will also supersede/obsolete #6 and fix #10. Compared to #6, this PR only skips the git clone bit if the picoprobe/picotool directory exists, but will still try to build those even if they exist. The reasoning here is that one of these builds might have failed, so we need to re-try building if the script is re-run.

lurch commented 3 years ago

this PR only skips the git clone bit if the picoprobe/picotool directory exists, but will still try to build those even if they exist.

Hmmm, if the repo directory already exists, maybe it's worth cd-ing into it and doing a git pull ?

ndabas commented 3 years ago

this PR only skips the git clone bit if the picoprobe/picotool directory exists, but will still try to build those even if they exist.

Hmmm, if the repo directory already exists, maybe it's worth cd-ing into it and doing a git pull ?

Yes indeed, that would be nice to have, I'll do some testing around this scenario and update this PR.

ndabas commented 3 years ago

@lurch I had a go at adding in git pull --ff-only, and that would require some minor changes to the conditional parts of the script. Can we merge in #14 first, and I will rebase and add my changes on master then? Just want to avoid a messy merge situation for a couple of lines of actual changes.

aallan commented 3 years ago

Superseded by #20?

ndabas commented 3 years ago

I think the entire repo has been superseded by #20 😀

I haven't tested that myself, but yes, if that PR is merged, this should be closed.