diff options
author | Chih-Hsuan Yen | 2018-10-18 19:43:08 +0800 |
---|---|---|
committer | Chih-Hsuan Yen | 2018-10-18 19:43:08 +0800 |
commit | df6cb3c103f18472158bcbbd9128c964ef4183da (patch) | |
tree | d716c1e51035d26272c4792e000c89636e97c43f | |
parent | 7120b5dc82f5ee65ef605f205da2f5cb8f7f9544 (diff) | |
download | aur-df6cb3c103f18472158bcbbd9128c964ef4183da.tar.gz |
fix vpython and fix+simplify gsutil
-rw-r--r-- | .SRCINFO | 6 | ||||
-rw-r--r-- | PKGBUILD | 35 | ||||
-rw-r--r-- | gsutil-use-google-cloud-sdk.patch | 54 | ||||
-rw-r--r-- | vpython-use-system-python2.patch | 22 |
4 files changed, 103 insertions, 14 deletions
@@ -1,6 +1,6 @@ pkgbase = depot-tools-git pkgdesc = Build tools for working with Chromium development, include gclient - pkgver = r5113.4d2e8bff + pkgver = r5469.488362624 pkgrel = 1 url = https://dev.chromium.org/developers/how-tos/install-depot-tools install = depot_tools.install @@ -19,9 +19,13 @@ pkgbase = depot-tools-git source = depot-tools-git::git+https://chromium.googlesource.com/chromium/tools/depot_tools.git source = repo_fix.sh source = fixshebangs.py + source = gsutil-use-google-cloud-sdk.patch + source = vpython-use-system-python2.patch sha512sums = SKIP sha512sums = bde33ffcad42a4d554d5490b6562981ef4b9f3abebadbed909749ee05ba391da4b5acb31b901e785b6f019b4ed3f9c740ab92623dd6a87e67b4b599a0010374b sha512sums = 33d772f68deddefce985d2820d3ef60fa730a1f3bc404cef3c8b1b517369501b9c3a07bc7b1b3df4d0589b45cbe4850f935699676c3e10c437bceffb37eb8214 + sha512sums = 4043722867ebefc3d65b03f6faa016ef31c510587d499a96e3f3ae1f6e19b49299f5b540e3f2d5176e9ecfd73645d9b815d8c052fcc327687091a2355f817d6a + sha512sums = 4efd6fa204e429619d2da999d07d27eabd748b1941a913cfd5a83cf23fd93b3c8c021ed97c3f30dcc17f67b0dd32486bc361da374aa26e2be2d1d3ed922712c7 pkgname = depot-tools-git @@ -8,13 +8,18 @@ # Contributor: hack.augusto <hack.augusto@gmail.com> pkgname=depot-tools-git -pkgver=r5113.4d2e8bff +pkgver=r5469.488362624 pkgrel=1 pkgdesc='Build tools for working with Chromium development, include gclient' arch=('any') url='https://dev.chromium.org/developers/how-tos/install-depot-tools' -source=("${pkgname}::git+https://chromium.googlesource.com/chromium/tools/depot_tools.git" - 'repo_fix.sh' 'fixshebangs.py') +source=( + "${pkgname}::git+https://chromium.googlesource.com/chromium/tools/depot_tools.git" + 'repo_fix.sh' + 'fixshebangs.py' + 'gsutil-use-google-cloud-sdk.patch' + 'vpython-use-system-python2.patch' +) license=('Custom') depends=('git' 'ninja' 'python2') optdepends=( @@ -27,9 +32,11 @@ options=('!strip') install="depot_tools.install" sha512sums=('SKIP' 'bde33ffcad42a4d554d5490b6562981ef4b9f3abebadbed909749ee05ba391da4b5acb31b901e785b6f019b4ed3f9c740ab92623dd6a87e67b4b599a0010374b' - '33d772f68deddefce985d2820d3ef60fa730a1f3bc404cef3c8b1b517369501b9c3a07bc7b1b3df4d0589b45cbe4850f935699676c3e10c437bceffb37eb8214') + '33d772f68deddefce985d2820d3ef60fa730a1f3bc404cef3c8b1b517369501b9c3a07bc7b1b3df4d0589b45cbe4850f935699676c3e10c437bceffb37eb8214' + '4043722867ebefc3d65b03f6faa016ef31c510587d499a96e3f3ae1f6e19b49299f5b540e3f2d5176e9ecfd73645d9b815d8c052fcc327687091a2355f817d6a' + '4efd6fa204e429619d2da999d07d27eabd748b1941a913cfd5a83cf23fd93b3c8c021ed97c3f30dcc17f67b0dd32486bc361da374aa26e2be2d1d3ed922712c7') -scripts_to_fix_exec=( +_scripts_to_fix_exec=( cit clang-format clang_format_merge_driver @@ -57,7 +64,6 @@ prepare () { # gclient.py require a fix for work correctly with python2-colorama # Another way is make default python2, but I don't think is a good idea! # Fixing python scripts. - msg "Patching scripts for python2 usage..." "${srcdir}/fixshebangs.py" # Fix gclient.py @@ -66,10 +72,16 @@ prepare () { gclient.py # Fixing scripts which use "exec python" - for script in "${scripts_to_fix_exec[@]}" + for script in "${_scripts_to_fix_exec[@]}" do sed -r -i -e 's/exec python/exec python2/' "${script}" done + + # Make gsutil use google-cloud-sdk instead of downloading from Google Storage + patch -Np1 -i ../gsutil-use-google-cloud-sdk.patch + + # Force vpython to use system Python 2 + patch -Np1 -i ../vpython-use-system-python2.patch } package() @@ -108,12 +120,9 @@ package() EOF chmod 755 "${pkgdir}/opt/depot_tools/ninja" - # gsutil v4.19 is included in google-cloud-sdk, and I guess 4.19 is compatible with 4.13 and 4.15 - # download_from_google_storage.py expects version 4.15 and gsutil.py expects 4.13 - GSUTIL_PATH="${pkgdir}/opt/depot_tools/external_bin/gsutil" - install -d "${GSUTIL_PATH}/gsutil_4.13" - ln -s /opt/google-cloud-sdk/platform/gsutil "${GSUTIL_PATH}/gsutil_4.13/gsutil" - ln -s "gsutil_4.13" "${GSUTIL_PATH}/gsutil_4.15" + # some commands (e.g., gsutil) calls vpython directly + install -Ddm755 "$pkgdir"/usr/bin + ln -s /opt/depot_tools/vpython "$pkgdir"/usr/bin/vpython rm -rf "${pkgdir}/opt/depot_tools/.git" } diff --git a/gsutil-use-google-cloud-sdk.patch b/gsutil-use-google-cloud-sdk.patch new file mode 100644 index 000000000000..89549951f765 --- /dev/null +++ b/gsutil-use-google-cloud-sdk.patch @@ -0,0 +1,54 @@ +diff --git a/gsutil.py b/gsutil.py +index 8bfed540e..cca9d4b50 100755 +--- a/gsutil.py ++++ b/gsutil.py +@@ -82,45 +82,10 @@ def temporary_directory(base): + shutil.rmtree(tmpdir) + + def ensure_gsutil(version, target, clean): +- bin_dir = os.path.join(target, 'gsutil_%s' % version) +- gsutil_bin = os.path.join(bin_dir, 'gsutil', 'gsutil') +- gsutil_flag = os.path.join(bin_dir, 'gsutil', 'install.flag') +- # We assume that if gsutil_flag exists, then we have a good version +- # of the gsutil package. +- if not clean and os.path.isfile(gsutil_flag): +- # Everything is awesome! we're all done here. +- return gsutil_bin +- +- if not os.path.exists(target): +- os.makedirs(target) +- with temporary_directory(target) as instance_dir: +- # Clean up if we're redownloading a corrupted gsutil. +- cleanup_path = os.path.join(instance_dir, 'clean') +- try: +- os.rename(bin_dir, cleanup_path) +- except (OSError, IOError): +- cleanup_path = None +- if cleanup_path: +- shutil.rmtree(cleanup_path) +- +- download_dir = os.path.join(instance_dir, 'download') +- target_zip_filename = download_gsutil(version, instance_dir) +- with zipfile.ZipFile(target_zip_filename, 'r') as target_zip: +- target_zip.extractall(download_dir) +- +- try: +- os.rename(download_dir, bin_dir) +- except (OSError, IOError): +- # Something else did this in parallel. +- pass +- # Final check that the gsutil bin exists. This should never fail. +- if not os.path.isfile(gsutil_bin): +- raise InvalidGsutilError() +- # Drop a flag file. +- with open(gsutil_flag, 'w') as f: +- f.write('This flag file is dropped by gsutil.py') +- +- return gsutil_bin ++ candidate = '/opt/google-cloud-sdk/platform/gsutil/gsutil' ++ if os.path.exists(candidate): ++ return candidate ++ raise RuntimeError('Please install google-cloud-sdk package to use gsutil') + + + def run_gsutil(force_version, fallback, target, args, clean=False): diff --git a/vpython-use-system-python2.patch b/vpython-use-system-python2.patch new file mode 100644 index 000000000000..a1d8a8d13a2e --- /dev/null +++ b/vpython-use-system-python2.patch @@ -0,0 +1,22 @@ +diff --git a/vpython b/vpython +index 9befaa690..03ebe525b 100755 +--- a/vpython ++++ b/vpython +@@ -4,7 +4,7 @@ + # Use of this source code is governed by a BSD-style license that can be + # found in the LICENSE file. + +-if [[ $VPYTHON_BYPASS == "manually managed python not supported by chrome operations" ]] ++if [[ 1 ]] + then + NEWARGS=() + while [[ $# -gt 0 ]] +@@ -30,7 +30,7 @@ then + ;; + esac + done +- exec "python" "${NEWARGS[@]}" ++ exec "python2" "${NEWARGS[@]}" + fi + + |