pico-setup icon indicating copy to clipboard operation
pico-setup copied to clipboard

Make script idempotent

Open ndabas opened this issue 5 years ago • 5 comments

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

  • The mkdir build commands fail
  • The git clone for picoprobe and picotool fail because those repos have already been cloned.

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.

ndabas avatar Feb 02 '21 17:02 ndabas

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 ?

lurch avatar Mar 15 '21 10:03 lurch

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 avatar Mar 15 '21 14:03 ndabas

@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.

ndabas avatar Apr 01 '21 11:04 ndabas

Superseded by #20?

aallan avatar Apr 06 '21 09:04 aallan

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.

ndabas avatar Apr 06 '21 11:04 ndabas