diff options
-rw-r--r-- | .SRCINFO | 22 | ||||
-rw-r--r-- | 0001-set-python2-for-dev-appserver-py.patch | 9 | ||||
-rw-r--r-- | 0002-set-python2-for-endpointscfg-py.patch | 9 | ||||
-rw-r--r-- | 0003-add-compdef-to-zsh-completion.patch | 9 | ||||
-rw-r--r-- | 0004-collections-abc.patch | 113 | ||||
-rw-r--r-- | BUILD | 0 | ||||
-rw-r--r-- | PKGBUILD | 93 | ||||
-rw-r--r-- | google-cloud-sdk.sh | 2 |
8 files changed, 192 insertions, 65 deletions
@@ -1,18 +1,26 @@ pkgbase = google-cloud-sdk pkgdesc = A set of command-line tools for the Google Cloud Platform. Includes gcloud (with beta and alpha commands), gsutil, and bq. - pkgver = 245.0.0 + pkgver = 404.0.0 pkgrel = 1 url = https://cloud.google.com/sdk/ arch = x86_64 license = Apache - depends = python2 - optdepends = python2-crcmod: [gsutil] verify the integrity of GCS object contents + depends = python + optdepends = python2: for dev_appserver.py and endpointscfg support + optdepends = python-crcmod: [gsutil] verify the integrity of GCS object contents options = !strip options = staticlibs - source = https://dl.google.com/dl/cloudsdk/release/downloads/for_packagers/linux/google-cloud-sdk_245.0.0.orig.tar.gz + source = https://dl.google.com/dl/cloudsdk/release/downloads/for_packagers/linux/google-cloud-sdk_404.0.0.orig.tar.gz source = google-cloud-sdk.sh - sha256sums = 7304bcdfaccf75d19161929db1e8f15f1af82e1e84f75230c089c333fc573940 - sha256sums = 36ac88de630e49ea4b067b1f5f229142e4cf97561b98b3bd3d8115a356946692 + source = 0001-set-python2-for-dev-appserver-py.patch + source = 0002-set-python2-for-endpointscfg-py.patch + source = 0003-add-compdef-to-zsh-completion.patch + source = 0004-collections-abc.patch + sha256sums = 0aad5e6a020df8fc810eb519d8430522581bbbd0794f9356c207ced830c43c2a + sha256sums = ecd7b3895f6ecf1c6411f385bee3a4b64139976d72069469d323c8a09b97aaea + sha256sums = 62ec7f56e09168d375823e9e99fcdcfbf40b0fffdd75f35cf91122c5902c82e9 + sha256sums = ff6065ce2e54ac654605bd5fe554313b1d0def2c31ce56ff39429098dd1e39fe + sha256sums = 4694f5191ceea7cf8076861ce5790ba9e809023da278b0f6ed862b9611e5aa93 + sha256sums = ea39fc4907d8ddf28ebaeed4b7c4547936a602f907c7523fc62488771e0df043 pkgname = google-cloud-sdk - diff --git a/0001-set-python2-for-dev-appserver-py.patch b/0001-set-python2-for-dev-appserver-py.patch new file mode 100644 index 000000000000..9332d42de003 --- /dev/null +++ b/0001-set-python2-for-dev-appserver-py.patch @@ -0,0 +1,9 @@ +diff -urN --color a/bin/dev_appserver.py b/bin/dev_appserver.py +--- a/bin/dev_appserver.py 2020-01-23 19:38:55.457052071 -0800 ++++ b/bin/dev_appserver.py 2020-01-23 19:41:10.211160929 -0800 +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python2 + # + # Copyright 2015 Google Inc. All Rights Reserved. + # diff --git a/0002-set-python2-for-endpointscfg-py.patch b/0002-set-python2-for-endpointscfg-py.patch new file mode 100644 index 000000000000..93e590a6a284 --- /dev/null +++ b/0002-set-python2-for-endpointscfg-py.patch @@ -0,0 +1,9 @@ +diff -urN --color a/bin/endpointscfg.py b/bin/endpointscfg.py +--- a/bin/endpointscfg.py 2020-01-23 20:12:58.838993348 -0800 ++++ b/bin/endpointscfg.py 2020-01-23 20:13:14.125618291 -0800 +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python2 + # + # Copyright 2015 Google Inc. All Rights Reserved. + # diff --git a/0003-add-compdef-to-zsh-completion.patch b/0003-add-compdef-to-zsh-completion.patch new file mode 100644 index 000000000000..4a684f166218 --- /dev/null +++ b/0003-add-compdef-to-zsh-completion.patch @@ -0,0 +1,9 @@ +diff -urN --color a/completion.zsh.inc b/completion.zsh.inc +--- a/completion.zsh.inc 2020-05-04 13:47:11.211895195 +0200 ++++ b/completion.zsh.inc 2020-05-04 13:47:32.197626189 +0200 +@@ -1,3 +1,5 @@ ++#compdef gcloud ++ + autoload -U +X bashcompinit && bashcompinit + zmodload -i zsh/parameter + if ! (( $+functions[compdef] )) ; then diff --git a/0004-collections-abc.patch b/0004-collections-abc.patch new file mode 100644 index 000000000000..bfecbe345564 --- /dev/null +++ b/0004-collections-abc.patch @@ -0,0 +1,113 @@ +diff --git a/lib/third_party/dns/namedict.py b/lib/third_party/dns/namedict.py +index 37a13104..e2309c1f 100644 +--- a/lib/third_party/dns/namedict.py ++++ b/lib/third_party/dns/namedict.py +@@ -32,7 +32,14 @@ import dns.name + from ._compat import xrange + + +-class NameDict(collections.MutableMapping): ++try: ++ # Python 3.3 and above. ++ collections_abc = collections.abc ++except AttributeError: ++ collections_abc = collections ++ ++ ++class NameDict(collections_abc.MutableMapping): + """A dictionary whose keys are dns.name.Name objects. + + In addition to being like a regular Python dictionary, this +diff --git a/lib/third_party/functools32/functools32.py b/lib/third_party/functools32/functools32.py +index c44551fa..291f81d0 100644 +--- a/lib/third_party/functools32/functools32.py ++++ b/lib/third_party/functools32/functools32.py +@@ -12,7 +12,7 @@ __all__ = ['update_wrapper', 'wraps', 'WRAPPER_ASSIGNMENTS', 'WRAPPER_UPDATES', + 'total_ordering', 'cmp_to_key', 'lru_cache', 'reduce', 'partial'] + + from _functools import partial, reduce +-from collections import MutableMapping, namedtuple ++from collections import namedtuple + from .reprlib32 import recursive_repr as _recursive_repr + from weakref import proxy as _proxy + import sys as _sys +@@ -21,6 +21,11 @@ try: + except ImportError: + from ._dummy_thread32 import allocate_lock as Lock + ++try: ++ from collections.abc import MutableMapping ++except ImportError: ++ from collections import MutableMapping ++ + ################################################################################ + ### OrderedDict + ################################################################################ +diff --git a/lib/third_party/ml_sdk/cloud/ml/prediction/prediction_utils.py b/lib/third_party/ml_sdk/cloud/ml/prediction/prediction_utils.py +index 0439728d..f4a75eda 100644 +--- a/lib/third_party/ml_sdk/cloud/ml/prediction/prediction_utils.py ++++ b/lib/third_party/ml_sdk/cloud/ml/prediction/prediction_utils.py +@@ -32,6 +32,13 @@ collections_lib = collections + if sys.version_info > (3, 8): + collections_lib = collections.abc + ++try: ++ # Python 3.3 and above. ++ collections_abc = collections.abc ++except AttributeError: ++ collections_abc = collections ++ ++ + # -------------------------- + # prediction.common + # -------------------------- +diff --git a/platform/gsutil/gslib/vendored/boto/boto/dynamodb/types.py b/platform/gsutil/gslib/vendored/boto/boto/dynamodb/types.py +index d9aaaa4c..1d50fb0c 100644 +--- a/platform/gsutil/gslib/vendored/boto/boto/dynamodb/types.py ++++ b/platform/gsutil/gslib/vendored/boto/boto/dynamodb/types.py +@@ -27,11 +27,17 @@ Python types and vice-versa. + import base64 + from decimal import (Decimal, DecimalException, Context, + Clamped, Overflow, Inexact, Underflow, Rounded) +-from collections import Mapping + from boto.dynamodb.exceptions import DynamoDBNumberError + from boto.compat import filter, map, six, long_type + + ++ ++try: ++ from collections.abc import Mapping ++except ImportError: ++ from collections import Mapping ++ ++ + DYNAMODB_CONTEXT = Context( + Emin=-128, Emax=126, rounding=None, prec=38, + traps=[Clamped, Overflow, Inexact, Rounded, Underflow]) +diff --git a/platform/gsutil/gslib/vendored/boto/boto/mws/connection.py b/platform/gsutil/gslib/vendored/boto/boto/mws/connection.py +index 687fae74..ae92d087 100644 +--- a/platform/gsutil/gslib/vendored/boto/boto/mws/connection.py ++++ b/platform/gsutil/gslib/vendored/boto/boto/mws/connection.py +@@ -29,6 +29,13 @@ import boto.mws.response + from boto.handler import XmlHandler + from boto.compat import filter, map, six, encodebytes + ++try: ++ # Python 3.3 and above. ++ collections_abc = collections.abc ++except AttributeError: ++ collections_abc = collections ++ ++ + __all__ = ['MWSConnection'] + + api_version_path = { +@@ -109,7 +116,7 @@ def http_body(field): + def destructure_object(value, into, prefix, members=False): + if isinstance(value, boto.mws.response.ResponseElement): + destructure_object(value.__dict__, into, prefix, members=members) +- elif isinstance(value, collections.Mapping): ++ elif isinstance(value, collections_abc.Mapping): + for name in value: + if name.startswith('_'): + continue diff --git a/BUILD b/BUILD new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/BUILD @@ -5,71 +5,60 @@ # Contributor: Sebastien Bariteau <numkem@numkem.org> # Contributor: Justin Dray <justin@dray.be> +# For ISSUES, REQUESTS, and QUESTIONS: +# https://github.com/sudoforge/pkgbuilds + pkgname="google-cloud-sdk" -pkgver=245.0.0 +pkgver=404.0.0 pkgrel=1 pkgdesc="A set of command-line tools for the Google Cloud Platform. Includes gcloud (with beta and alpha commands), gsutil, and bq." url="https://cloud.google.com/sdk/" license=("Apache") arch=('x86_64') -depends=('python2') -optdepends=('python2-crcmod: [gsutil] verify the integrity of GCS object contents') +depends=('python') +optdepends=( + "python2: for dev_appserver.py and endpointscfg support" + "python-crcmod: [gsutil] verify the integrity of GCS object contents" +) options=('!strip' 'staticlibs') source=( "https://dl.google.com/dl/cloudsdk/release/downloads/for_packagers/linux/${pkgname}_${pkgver}.orig.tar.gz" "google-cloud-sdk.sh" + "0001-set-python2-for-dev-appserver-py.patch" + "0002-set-python2-for-endpointscfg-py.patch" + "0003-add-compdef-to-zsh-completion.patch" + "0004-collections-abc.patch" ) -sha256sums=( - '7304bcdfaccf75d19161929db1e8f15f1af82e1e84f75230c089c333fc573940' - '36ac88de630e49ea4b067b1f5f229142e4cf97561b98b3bd3d8115a356946692' -) +sha256sums=('0aad5e6a020df8fc810eb519d8430522581bbbd0794f9356c207ced830c43c2a' + 'ecd7b3895f6ecf1c6411f385bee3a4b64139976d72069469d323c8a09b97aaea' + '62ec7f56e09168d375823e9e99fcdcfbf40b0fffdd75f35cf91122c5902c82e9' + 'ff6065ce2e54ac654605bd5fe554313b1d0def2c31ce56ff39429098dd1e39fe' + '4694f5191ceea7cf8076861ce5790ba9e809023da278b0f6ed862b9611e5aa93' + 'ea39fc4907d8ddf28ebaeed4b7c4547936a602f907c7523fc62488771e0df043') prepare() { - if command ping -c 1 dl.google.com > /dev/null 2>&1; then - msg2 "Checking for newer upstream release" + cd "${srcdir}/${pkgname}" - _latest=$(\ - curl -s https://dl.google.com/dl/cloudsdk/release/sha256.txt |\ - egrep "google-cloud-sdk_.*\.orig\.tar\.gz" |\ - awk -e 'BEGIN{FS="/"}{print $4}' |\ - sed 's/[^0-9]*\(\([[:digit:]]\+.\?\)\{2\}[^.]\+\).*/\1/') - # [^0-9]* :: matches any non-digit character 0-n times - # \( :: begins group 1 - # \([[:digit:]]\+.\?\)\{2\} - # :: captures the major and minor parts of the version, with dot - # :: capture group 2 is created to facilitate repeating with \{2\} - # [^.]\+ :: matches the patch without the dot - # \) :: terminates group 1 - # .* :: matches any character 0-n times - # /\1/ :: replaces the entire string with the contents of group 1 - - msg2 "This AUR release: ${pkgver}" - msg2 "Latest upstream release: ${_latest}" - if [ "${_latest}" != "${pkgver}" ]; then - msg2 "** THIS PACKAGE IS OUT OF DATE" - msg2 "** Please flag this package out-of-date:" - msg2 " https://aur.archlinux.org/packages/${pkgname}" - msg2 "** Alternatively, submit an issue and/or patch:" - msg2 " https://github.com/sudoforge/pkgbuilds" - else - msg2 "Everything up to date :)" - fi - else - msg2 "Unable to reach dl.google.com, cannot determine latest upstream release" - fi + for f in "${source[@]}"; do + [[ "$f" =~ \.patch$ ]] && \ + ( \ + patch -p1 -i "${srcdir}/${f}" > /dev/null 2>&1 ||\ + ( \ + echo "failed to apply patch: $(basename ${f})" && \ + exit 1 \ + ) \ + ) + done } package() { - msg2 "Copying core SDK components" mkdir "${pkgdir}/opt" cp -r "${srcdir}/${pkgname}" "${pkgdir}/opt" - msg2 "Running bootstrapping script" - # The Google code uses a _TraceAction() method which spams the screen even # in "quiet" mode, we're throwing away output on purpose to keep it clean # ref: lib/googlecloudsdk/core/platforms_install.py - python2 "${pkgdir}/opt/${pkgname}/bin/bootstrapping/install.py" \ + python "${pkgdir}/opt/${pkgname}/bin/bootstrapping/install.py" \ --quiet \ --usage-reporting False \ --path-update False \ @@ -77,40 +66,30 @@ package() { --additional-components "" \ 1 > /dev/null - msg2 "Cleaning up artifacts of the bootstrap script" rm -rf "${pkgdir}/opt/${pkgname}/.install/.backup" mkdir "${pkgdir}/opt/${pkgname}/.install/.backup" + find $pkgdir -name '__pycache__' -type d -exec rm -rf {} + - msg2 "Setting up profile environment variables" - install -Dm755 "${srcdir}/${source[1]}" \ + install -D -m 0755 "${srcdir}/${source[1]}" \ "${pkgdir}/etc/profile.d/google-cloud-sdk.sh" - msg2 "Installing bash completion script" - install -Dm755 "${pkgdir}/opt/${pkgname}/completion.bash.inc" \ + install -D -m 0644 "${pkgdir}/opt/${pkgname}/completion.bash.inc" \ "${pkgdir}/etc/bash_completion.d/google-cloud-sdk" - msg2 "Fixing python references for python2 and compiling *.pyc" - grep -Irl 'python' "${pkgdir}/opt/${pkgname}" | \ - xargs sed -i 's|#!.*python\b|#!/usr/bin/env python2|g' - find "${pkgdir}/opt/${pkgname}/bin/" -maxdepth 1 -type f -exec \ - sed -i 's/CLOUDSDK_PYTHON=python\b/CLOUDSDK_PYTHON=python2/g' {} \; - python2 -m compileall -q -f -x python3 -d "/opt/google-cloud-sdk" \ - "${pkgdir}/opt/${pkgname}/" + install -D -m 0644 "${pkgdir}/opt/${pkgname}/completion.zsh.inc" \ + "${pkgdir}/usr/share/zsh/site-functions/_gcloud" - msg2 "Installing man pages" mkdir -p "${pkgdir}/usr/share" mv -f "${pkgdir}/opt/${pkgname}/help/man" "${pkgdir}/usr/share/" chmod 0755 "${pkgdir}/usr/share/man" chmod 0755 "${pkgdir}/usr/share/man/man1" - msg2 "Creating symlinks for applications" mkdir -p "${pkgdir}/usr/bin" for i in "${pkgdir}/opt/${pkgname}/bin"/*; do ln -st "${pkgdir}/usr/bin/" "${i#${pkgdir}}" done rm -f "${pkgdir}"/usr/bin/{bq,dev_appserver.py*,endpointscfg.py*,java_dev_appserver.sh} - msg2 "Fixing file permissions" chmod -x "${pkgdir}"/usr/share/man/man1/* find "${pkgdir}/opt/${pkgname}" -name "*.html" -o -name "*.json" -exec chmod -x {} \; find "${pkgdir}/opt/${pkgname}" -name "*_test.py" -exec chmod +x {} \; diff --git a/google-cloud-sdk.sh b/google-cloud-sdk.sh index 9713b0963854..b1c4ec5807d0 100644 --- a/google-cloud-sdk.sh +++ b/google-cloud-sdk.sh @@ -1,5 +1,5 @@ export CLOUDSDK_ROOT_DIR=/opt/google-cloud-sdk -export CLOUDSDK_PYTHON=python2 +export CLOUDSDK_PYTHON=/usr/bin/python export CLOUDSDK_PYTHON_ARGS=-S export PATH=$CLOUDSDK_ROOT_DIR/bin:$PATH export GOOGLE_CLOUD_SDK_HOME=$CLOUDSDK_ROOT_DIR |