Skip to content

Make script idempotent #11

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

ndabas
Copy link

@ndabas ndabas commented Feb 2, 2021

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.

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 raspberrypi#6 and fix raspberrypi#10.
@lurch
Copy link
Contributor

lurch commented Mar 15, 2021

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
Copy link
Author

ndabas commented Mar 15, 2021

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
Copy link
Author

ndabas commented Apr 1, 2021

@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
Copy link

aallan commented Apr 6, 2021

Superseded by #20?

@ndabas
Copy link
Author

ndabas commented Apr 6, 2021

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.

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.

If pico_setup.sh fails during install it can't be re-run
3 participants