When a shell script `pants` that lives in the repo...
# general
f
When a shell script
pants
that lives in the repo root is updated, how would one force Pants to re-bootstrap itself using the latest file? (see https://www.pantsbuild.org/docs/upgrade-tips#check-for-updates-to-the-pants-script). Blowing the
~/.cache/pants
doesn’t feel very friendly 😕 I’m on
2.9.0
and after making changes to the
pants
file that would cause Pants to fail bootstrapping, Pants still runs, ignoring the changes in the
pants
file.
h
Specifically you could blow
~/.cache/pants/setup
, but I don't see why that would be necessary. What are the changes that Pants is not doing and that you expect it to?
🙌 1
f
so what I mean is: • having a fresh computer • checkout a Git repo with
pants
script from a few months ago (
pants
file is part of the repo) • run
./pants version
; it bootstraps itself and working • download the latest https://github.com/pantsbuild/setup/blob/gh-pages/pants and re-run
./pants
. It doesn’t use the newly downloaded
pants
file. This can be reproduced by simply making some bogus changes to the script that would cause it to fail, e.g. https://github.com/pantsbuild/setup/blob/gh-pages/pants#L37 set a non-existing version here
👍 1
h
Ah, it does execute the new script - but the script is written to short-circuit so you never hit that particular codepath. Adding
set -x
to the top will show you specifically which lines of bash are being executed
f
ah of course, that was a bit too short-sighted of me, apologies!
h
No apologies necessary! I'm being pedantic to try to clarify what's happening. But the real answer you were after is
~/.cache/pants/setup
f
perfect, thank you! So is it safe to assume that users don’t need to nuke
~/.cache/pants/setup
after they pull and get a new version of the
pants
file — it will run and use the latest file, no matter what?
h
Yes, it is safe to assume that. If we ever make a change to the
./pants
script to no longer install in the same place, we would probably add code to handle that
to convince yourself of that, add
exit 1
to the top of the script and run
./pants
f
oh I’ve done that with
ls foo
😄 I can see that it runs, which is great. If there is anything dodgy, I’ll report. And I know what directory to nuke as well. Thanks, Eric, so helpful, as always!
❤️ 1
💯 1