main: improve launcher update messaging wrt system installs

Some users get repo from their distro (e.g. /usr/bin/repo), so the
suggestion to copy over top of it makes people uneasy, if it's even
possible in the first place.

Bug: https://crbug.com/gerrit/12335
Change-Id: I9a0c83d6ba0f466fa8e6d61f674ee13396f9a968
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/256893
Tested-by: Mike Frysinger <vapier@google.com>
Reviewed-by: David Pursehouse <dpursehouse@collab.net>
This commit is contained in:
Mike Frysinger 2020-02-26 16:21:08 -05:00 committed by David Pursehouse
parent 5f11eac147
commit eea23b44a9

16
main.py
View File

@ -348,12 +348,20 @@ repo: error:
sys.exit(1)
if exp > ver:
print("""
... A new version of repo (%s) is available.
print('\n... A new version of repo (%s) is available.' % (exp_str,),
file=sys.stderr)
if os.access(repo_path, os.W_OK):
print("""\
... You should upgrade soon:
cp %s %s
""" % (exp_str, WrapperPath(), repo_path), file=sys.stderr)
""" % (WrapperPath(), repo_path), file=sys.stderr)
else:
print("""\
... New version is available at: %s
... The launcher is run from: %s
!!! The launcher is not writable. Please talk to your sysadmin or distro
!!! to get an update installed.
""" % (WrapperPath(), repo_path), file=sys.stderr)
def _CheckRepoDir(repo_dir):