From eea23b44a97ad84b5a81bd969a04a8b9822448f1 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Wed, 26 Feb 2020 16:21:08 -0500 Subject: [PATCH] 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 Reviewed-by: David Pursehouse --- main.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index 06cd1108..98234cbf 100755 --- a/main.py +++ b/main.py @@ -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):