about summary refs log tree commit diff
path: root/pkgs/tools/admin
diff options
context:
space:
mode:
authoredef <edef@edef.eu>2020-02-13 11:14:31 +0000
committeredef <edef@edef.eu>2020-02-18 13:31:42 +0000
commit0c403efde9a57c58585a75c1678c08a32e3f877c (patch)
tree59840e5f657faafb4fa42ab2044d3dfce63e94f4 /pkgs/tools/admin
parentf8c8f523a8f6377a3ffe42cb2228d03dad4f30b8 (diff)
downloadnixlib-0c403efde9a57c58585a75c1678c08a32e3f877c.tar
nixlib-0c403efde9a57c58585a75c1678c08a32e3f877c.tar.gz
nixlib-0c403efde9a57c58585a75c1678c08a32e3f877c.tar.bz2
nixlib-0c403efde9a57c58585a75c1678c08a32e3f877c.tar.lz
nixlib-0c403efde9a57c58585a75c1678c08a32e3f877c.tar.xz
nixlib-0c403efde9a57c58585a75c1678c08a32e3f877c.tar.zst
nixlib-0c403efde9a57c58585a75c1678c08a32e3f877c.zip
google-cloud-sdk: disable checking for gsutil updates
The update checking mechanism references the tests, and thus
dbaafbbf73ef5aeb2fa7d5aea73bb32b9d78e4f3 turned it into a crash at
startup.

It isn't much use in nixpkgs, so we're better off without it.
Diffstat (limited to 'pkgs/tools/admin')
-rw-r--r--pkgs/tools/admin/google-cloud-sdk/default.nix1
-rw-r--r--pkgs/tools/admin/google-cloud-sdk/gsutil-disable-updates.patch50
2 files changed, 51 insertions, 0 deletions
diff --git a/pkgs/tools/admin/google-cloud-sdk/default.nix b/pkgs/tools/admin/google-cloud-sdk/default.nix
index 07a81a5c5254..93cbb63ce9c9 100644
--- a/pkgs/tools/admin/google-cloud-sdk/default.nix
+++ b/pkgs/tools/admin/google-cloud-sdk/default.nix
@@ -42,6 +42,7 @@ in stdenv.mkDerivation rec {
 
   patches = [
     ./gcloud-path.patch
+    ./gsutil-disable-updates.patch
   ];
 
   installPhase = ''
diff --git a/pkgs/tools/admin/google-cloud-sdk/gsutil-disable-updates.patch b/pkgs/tools/admin/google-cloud-sdk/gsutil-disable-updates.patch
new file mode 100644
index 000000000000..de44ea7e7915
--- /dev/null
+++ b/pkgs/tools/admin/google-cloud-sdk/gsutil-disable-updates.patch
@@ -0,0 +1,50 @@
+diff --git a/platform/gsutil/gslib/command_runner.py b/platform/gsutil/gslib/command_runner.py
+index 06ca5e5..4a4e225 100644
+--- a/platform/gsutil/gslib/command_runner.py
++++ b/platform/gsutil/gslib/command_runner.py
+@@ -61,7 +61,6 @@ from gslib.utils.text_util import InsistAsciiHeaderValue
+ from gslib.utils.text_util import print_to_fd
+ from gslib.utils.unit_util import SECONDS_PER_DAY
+ from gslib.utils.update_util import LookUpGsutilVersion
+-from gslib.tests.util import HAS_NON_DEFAULT_GS_HOST
+ 
+ 
+ def HandleHeaderCoding(headers):
+@@ -331,17 +330,6 @@ class CommandRunner(object):
+     Returns:
+       Return value(s) from Command that was run.
+     """
+-    command_changed_to_update = False
+-    if (not skip_update_check and
+-        self.MaybeCheckForAndOfferSoftwareUpdate(command_name, debug)):
+-      command_name = 'update'
+-      command_changed_to_update = True
+-      args = [_StringToSysArgType('-n')]
+-
+-      # Check for opt-in analytics.
+-      if system_util.IsRunningInteractively() and collect_analytics:
+-        metrics.CheckAndMaybePromptForAnalyticsEnabling()
+-
+     if not args:
+       args = []
+ 
+@@ -414,18 +402,10 @@ class CommandRunner(object):
+       ShutDownGsutil()
+     if GetFailureCount() > 0:
+       return_code = 1
+-    if command_changed_to_update:
+-      # If the command changed to update, the user's original command was
+-      # not executed.
+-      return_code = 1
+-      print('\n'.join(
+-          textwrap.wrap(
+-              'Update was successful. Exiting with code 1 as the original command '
+-              'issued prior to the update was not executed and should be re-run.'
+-          )))
+     return return_code
+ 
+   def MaybeCheckForAndOfferSoftwareUpdate(self, command_name, debug):
++    return False
+     """Checks the last time we checked for an update and offers one if needed.
+ 
+     Offer is made if the time since the last update check is longer