uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead
https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948 this can do it nicely. Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
commit
56de2bcd43
30691 changed files with 3076956 additions and 0 deletions
23
pkgs/tools/admin/google-cloud-sdk/alpha__init__.py
Executable file
23
pkgs/tools/admin/google-cloud-sdk/alpha__init__.py
Executable file
|
|
@ -0,0 +1,23 @@
|
|||
# Copyright 2013 Google Inc. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""Auth for the Google Cloud SDK.
|
||||
"""
|
||||
|
||||
from googlecloudsdk.calliope import base
|
||||
|
||||
|
||||
@base.ReleaseTracks(base.ReleaseTrack.ALPHA)
|
||||
class Alpha(base.Group):
|
||||
"""Alpha versions of gcloud commands."""
|
||||
23
pkgs/tools/admin/google-cloud-sdk/beta__init__.py
Executable file
23
pkgs/tools/admin/google-cloud-sdk/beta__init__.py
Executable file
|
|
@ -0,0 +1,23 @@
|
|||
# Copyright 2013 Google Inc. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""Auth for the Google Cloud SDK.
|
||||
"""
|
||||
|
||||
from googlecloudsdk.calliope import base
|
||||
|
||||
|
||||
@base.ReleaseTracks(base.ReleaseTrack.BETA)
|
||||
class Beta(base.Group):
|
||||
"""Beta versions of gcloud commands."""
|
||||
36
pkgs/tools/admin/google-cloud-sdk/cloud_sql_proxy_path.patch
Normal file
36
pkgs/tools/admin/google-cloud-sdk/cloud_sql_proxy_path.patch
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
diff --git a/lib/googlecloudsdk/api_lib/sql/instances.py b/lib/googlecloudsdk/api_lib/sql/instances.py
|
||||
index 0d88ffe..814a436 100644
|
||||
--- a/lib/googlecloudsdk/api_lib/sql/instances.py
|
||||
+++ b/lib/googlecloudsdk/api_lib/sql/instances.py
|
||||
@@ -85,18 +85,19 @@ def GetRegionFromZone(gce_zone):
|
||||
def _GetCloudSqlProxyPath():
|
||||
"""Determines the path to the cloud_sql_proxy binary."""
|
||||
sdk_bin_path = config.Paths().sdk_bin_path
|
||||
- if not sdk_bin_path:
|
||||
- # Check if cloud_sql_proxy is located on the PATH.
|
||||
- proxy_path = file_utils.FindExecutableOnPath('cloud_sql_proxy')
|
||||
- if proxy_path:
|
||||
- log.debug(
|
||||
- 'Using cloud_sql_proxy found at [{path}]'.format(path=proxy_path))
|
||||
- return proxy_path
|
||||
- else:
|
||||
- raise sql_exceptions.SqlProxyNotFound(
|
||||
- 'A Cloud SQL Proxy SDK root could not be found. Please check your '
|
||||
- 'installation.')
|
||||
- return os.path.join(sdk_bin_path, 'cloud_sql_proxy')
|
||||
+ if sdk_bin_path and os.path.isfile(os.path.join(sdk_bin_path, 'cloud_sql_proxy')):
|
||||
+ return os.path.join(sdk_bin_path, 'cloud_sql_proxy')
|
||||
+
|
||||
+ # Check if cloud_sql_proxy is located on the PATH.
|
||||
+ proxy_path = file_utils.FindExecutableOnPath('cloud_sql_proxy')
|
||||
+ if proxy_path:
|
||||
+ log.debug(
|
||||
+ 'Using cloud_sql_proxy found at [{path}]'.format(path=proxy_path))
|
||||
+ return proxy_path
|
||||
+
|
||||
+ raise sql_exceptions.SqlProxyNotFound(
|
||||
+ 'A Cloud SQL Proxy SDK root could not be found. Please check your '
|
||||
+ 'installation.')
|
||||
|
||||
|
||||
def _RaiseProxyError(error_msg=None):
|
||||
32
pkgs/tools/admin/google-cloud-sdk/data.nix
Normal file
32
pkgs/tools/admin/google-cloud-sdk/data.nix
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
# DO NOT EDIT! This file is generated automatically by update.sh
|
||||
{ }:
|
||||
{
|
||||
version = "387.0.0";
|
||||
googleCloudSdkPkgs = {
|
||||
x86_64-linux =
|
||||
{
|
||||
url = "https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-387.0.0-linux-x86_64.tar.gz";
|
||||
sha256 = "1hsp575xg7caxhldxmqxsds99mr0gs2qxgk7x7mr9jnjdq6nqmdg";
|
||||
};
|
||||
x86_64-darwin =
|
||||
{
|
||||
url = "https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-387.0.0-darwin-x86_64.tar.gz";
|
||||
sha256 = "0qyd6z5clnd0slhsn9hc1xiic5rbssrps1n97jq94mv90rjp94jx";
|
||||
};
|
||||
aarch64-linux =
|
||||
{
|
||||
url = "https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-387.0.0-linux-arm.tar.gz";
|
||||
sha256 = "0drxv1dzlnzmrs92j7a48iwvzfvdl9dl4hk688lj7cl51yndbyyz";
|
||||
};
|
||||
aarch64-darwin =
|
||||
{
|
||||
url = "https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-387.0.0-darwin-arm.tar.gz";
|
||||
sha256 = "0244k34lwj29smyds8qs7qdrvwwnvwh0v6giifbwzhlb40nw4k72";
|
||||
};
|
||||
i686-linux =
|
||||
{
|
||||
url = "https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-387.0.0-linux-x86.tar.gz";
|
||||
sha256 = "0fb6qx1qjm9y013glinxdaf1x9ppwrb7szjx96maqb90zvq1jdcz";
|
||||
};
|
||||
};
|
||||
}
|
||||
119
pkgs/tools/admin/google-cloud-sdk/default.nix
Normal file
119
pkgs/tools/admin/google-cloud-sdk/default.nix
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
# Make sure that the "with-gce" flag is set when building `google-cloud-sdk`
|
||||
# for GCE hosts. This flag prevents "google-compute-engine" from being a
|
||||
# default dependency which is undesirable because this package is
|
||||
#
|
||||
# 1) available only on GNU/Linux (requires `systemd` in particular)
|
||||
# 2) intended only for GCE guests (and is useless elsewhere)
|
||||
# 3) used by `google-cloud-sdk` only on GCE guests
|
||||
#
|
||||
|
||||
{ stdenv, lib, fetchurl, makeWrapper, nixosTests, python, openssl, jq, with-gce ? false }:
|
||||
|
||||
let
|
||||
pythonEnv = python.withPackages (p: with p; [
|
||||
cffi
|
||||
cryptography
|
||||
openssl
|
||||
crcmod
|
||||
] ++ lib.optional (with-gce) google-compute-engine);
|
||||
|
||||
data = import ./data.nix { };
|
||||
sources = system:
|
||||
data.googleCloudSdkPkgs.${system} or (throw "Unsupported system: ${system}");
|
||||
|
||||
in stdenv.mkDerivation rec {
|
||||
pname = "google-cloud-sdk";
|
||||
inherit (data) version;
|
||||
|
||||
src = fetchurl (sources stdenv.hostPlatform.system);
|
||||
|
||||
buildInputs = [ python ];
|
||||
|
||||
nativeBuildInputs = [ jq makeWrapper ];
|
||||
|
||||
patches = [
|
||||
# For kubectl configs, don't store the absolute path of the `gcloud` binary as it can be garbage-collected
|
||||
./gcloud-path.patch
|
||||
# Disable checking for updates for the package
|
||||
./gsutil-disable-updates.patch
|
||||
# Try to use cloud_sql_proxy from SDK only if it actually exists, otherwise, search for one in PATH
|
||||
./cloud_sql_proxy_path.patch
|
||||
];
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out/google-cloud-sdk
|
||||
cp -R * .install $out/google-cloud-sdk/
|
||||
|
||||
mkdir -p $out/google-cloud-sdk/lib/surface/{alpha,beta}
|
||||
cp ${./alpha__init__.py} $out/google-cloud-sdk/lib/surface/alpha/__init__.py
|
||||
cp ${./beta__init__.py} $out/google-cloud-sdk/lib/surface/beta/__init__.py
|
||||
|
||||
# create wrappers with correct env
|
||||
for program in gcloud bq gsutil git-credential-gcloud.sh docker-credential-gcloud; do
|
||||
programPath="$out/google-cloud-sdk/bin/$program"
|
||||
binaryPath="$out/bin/$program"
|
||||
wrapProgram "$programPath" \
|
||||
--set CLOUDSDK_PYTHON "${pythonEnv}/bin/python" \
|
||||
--prefix PYTHONPATH : "${pythonEnv}/${python.sitePackages}" \
|
||||
--prefix PATH : "${openssl.bin}/bin"
|
||||
|
||||
mkdir -p $out/bin
|
||||
ln -s $programPath $binaryPath
|
||||
done
|
||||
|
||||
# disable component updater and update check
|
||||
substituteInPlace $out/google-cloud-sdk/lib/googlecloudsdk/core/config.json \
|
||||
--replace "\"disable_updater\": false" "\"disable_updater\": true"
|
||||
echo "
|
||||
[component_manager]
|
||||
disable_update_check = true" >> $out/google-cloud-sdk/properties
|
||||
|
||||
# setup bash completion
|
||||
mkdir -p $out/share/bash-completion/completions
|
||||
mv $out/google-cloud-sdk/completion.bash.inc $out/share/bash-completion/completions/gcloud
|
||||
ln -s $out/share/bash-completion/completions/gcloud $out/share/bash-completion/completions/gsutil
|
||||
|
||||
# setup zsh completion
|
||||
mkdir -p $out/share/zsh/site-functions
|
||||
mv $out/google-cloud-sdk/completion.zsh.inc $out/share/zsh/site-functions/_gcloud
|
||||
ln -s $out/share/zsh/site-functions/_gcloud $out/share/zsh/site-functions/_gsutil
|
||||
# zsh doesn't load completions from $FPATH without #compdef as the first line
|
||||
sed -i '1 i #compdef gcloud' $out/share/zsh/site-functions/_gcloud
|
||||
|
||||
# This directory contains compiled mac binaries. We used crcmod from
|
||||
# nixpkgs instead.
|
||||
rm -r $out/google-cloud-sdk/platform/gsutil/third_party/crcmod \
|
||||
$out/google-cloud-sdk/platform/gsutil/third_party/crcmod_osx
|
||||
|
||||
# remove tests and test data
|
||||
find $out -name tests -type d -exec rm -rf '{}' +
|
||||
rm $out/google-cloud-sdk/platform/gsutil/gslib/commands/test.py
|
||||
|
||||
# compact all the JSON
|
||||
find $out -name \*.json | while read path; do
|
||||
jq -c . $path > $path.min
|
||||
mv $path.min $path
|
||||
done
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
doInstallCheck = true;
|
||||
installCheckPhase = ''
|
||||
$out/bin/gcloud version --format json | jq '."Google Cloud SDK"' | grep "${version}"
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "Tools for the google cloud platform";
|
||||
longDescription = "The Google Cloud SDK. This package has the programs: gcloud, gsutil, and bq";
|
||||
# This package contains vendored dependencies. All have free licenses.
|
||||
license = licenses.free;
|
||||
homepage = "https://cloud.google.com/sdk/";
|
||||
changelog = "https://cloud.google.com/sdk/docs/release-notes";
|
||||
maintainers = with maintainers; [ iammrinal0 pradyuman stephenmw zimbatm ];
|
||||
platforms = builtins.attrNames data.googleCloudSdkPkgs;
|
||||
mainProgram = "gcloud";
|
||||
};
|
||||
}
|
||||
46
pkgs/tools/admin/google-cloud-sdk/gcloud-path.patch
Normal file
46
pkgs/tools/admin/google-cloud-sdk/gcloud-path.patch
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
From b69fee70154a861637c82e98e18be01bbb96423b Mon Sep 17 00:00:00 2001
|
||||
From: Florian Klink <flokli@flokli.de>
|
||||
Date: Wed, 12 Jun 2019 17:03:09 +0200
|
||||
Subject: [PATCH] kubeconfig: don't store absolute path to gcloud binary
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The `gcloud beta container clusters get-credentials $cluster \
|
||||
--region $region --project $project`
|
||||
command can be used to write kubectl config files.
|
||||
|
||||
In that file, normally the absolute path to the `gcloud` binary is
|
||||
stored.
|
||||
|
||||
This is a bad idea in NixOS. We might eventually garbage-collect that
|
||||
specific gcloud binary - and in general, would expect a nix-shell
|
||||
provided gcloud to be used.
|
||||
|
||||
In its current state, token renewal would just start to break with the
|
||||
following error message:
|
||||
|
||||
Unable to connect to the server: error executing access token command "/nix/store/…/gcloud config config-helper --format=json": err=fork/exec /nix/store/…/gcloud: no such file or directory output= stderr=
|
||||
|
||||
Avoid this by storing just `gcloud` inside `cmd-path`, which causes
|
||||
kubectl to lookup the gcloud command from $PATH, which is more likely to
|
||||
keep working.
|
||||
---
|
||||
lib/googlecloudsdk/api_lib/container/kubeconfig.py | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/lib/googlecloudsdk/api_lib/container/kubeconfig.py b/lib/googlecloudsdk/api_lib/container/kubeconfig.py
|
||||
index 4330988d6..37424b841 100644
|
||||
--- a/lib/googlecloudsdk/api_lib/container/kubeconfig.py
|
||||
+++ b/lib/googlecloudsdk/api_lib/container/kubeconfig.py
|
||||
@@ -352,7 +352,7 @@ def _AuthProvider(name='gcp',
|
||||
if sdk_bin_path is None:
|
||||
log.error(SDK_BIN_PATH_NOT_FOUND)
|
||||
raise Error(SDK_BIN_PATH_NOT_FOUND)
|
||||
- cmd_path = os.path.join(sdk_bin_path, bin_name)
|
||||
+ cmd_path = bin_name
|
||||
|
||||
cfg = {
|
||||
# Command for gcloud credential helper
|
||||
--
|
||||
2.21.0
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
diff --git a/platform/gsutil/gslib/command_runner.py b/platform/gsutil/gslib/command_runner.py
|
||||
index f490bb3..dc6bbcc 100644
|
||||
--- a/platform/gsutil/gslib/command_runner.py
|
||||
+++ b/platform/gsutil/gslib/command_runner.py
|
||||
@@ -330,18 +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()
|
||||
-
|
||||
- self.MaybePromptForPythonUpdate(command_name)
|
||||
|
||||
if not args:
|
||||
args = []
|
||||
@@ -415,15 +403,6 @@ 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 SkipUpdateCheck(self):
|
||||
@@ -467,6 +446,7 @@ class CommandRunner(object):
|
||||
return True
|
||||
|
||||
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
|
||||
47
pkgs/tools/admin/google-cloud-sdk/update.sh
Executable file
47
pkgs/tools/admin/google-cloud-sdk/update.sh
Executable file
|
|
@ -0,0 +1,47 @@
|
|||
#!/usr/bin/env nix-shell
|
||||
#! nix-shell -i bash -p nix
|
||||
|
||||
BASE_URL="https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk"
|
||||
|
||||
# Version of Google Cloud SDK from
|
||||
# https://cloud.google.com/sdk/docs/release-notes
|
||||
VERSION="387.0.0"
|
||||
|
||||
function genMainSrc() {
|
||||
local url="${BASE_URL}-${VERSION}-${1}-${2}.tar.gz"
|
||||
local sha256
|
||||
sha256=$(nix-prefetch-url "$url")
|
||||
echo " {"
|
||||
echo " url = \"${url}\";"
|
||||
echo " sha256 = \"${sha256}\";"
|
||||
echo " };"
|
||||
}
|
||||
|
||||
{
|
||||
cat <<EOF
|
||||
# DO NOT EDIT! This file is generated automatically by update.sh
|
||||
{ }:
|
||||
{
|
||||
version = "${VERSION}";
|
||||
googleCloudSdkPkgs = {
|
||||
EOF
|
||||
|
||||
echo " x86_64-linux ="
|
||||
genMainSrc "linux" "x86_64"
|
||||
|
||||
echo " x86_64-darwin ="
|
||||
genMainSrc "darwin" "x86_64"
|
||||
|
||||
echo " aarch64-linux ="
|
||||
genMainSrc "linux" "arm"
|
||||
|
||||
echo " aarch64-darwin ="
|
||||
genMainSrc "darwin" "arm"
|
||||
|
||||
echo " i686-linux ="
|
||||
genMainSrc "linux" "x86"
|
||||
|
||||
echo " };"
|
||||
echo "}"
|
||||
|
||||
} >data.nix
|
||||
Loading…
Add table
Add a link
Reference in a new issue