Commit Graph

57 Commits (8b34eb4d1e76ae1a94ffce09dbc2a1fbc75d551c)

Author SHA1 Message Date
Sylvain Defresne 53134e3187 Fix the --quiet flag of download_from_google_storage.py
Change download_from_google_storage.py to not write information
for successful actions when passed the --quiet flag.

Bug: none
Change-Id: I639df538935727150e540c72681fc1d4ccc88ec5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1944168
Auto-Submit: Sylvain Defresne <sdefresne@chromium.org>
Commit-Queue: Marc-Antoine Ruel <maruel@chromium.org>
Reviewed-by: Marc-Antoine Ruel <maruel@chromium.org>
5 years ago
Edward Lesmes 94d6f48ba1 gsutil: Decode output from subprocess.
Bug: 1007872, 1009819
Change-Id: Icb24badc0429012dc66912d7d35e03a456512787
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1894354
Reviewed-by: Anthony Polito <apolito@google.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Raphael Kubo da Costa 5189047f97 download_from_google_storage: Decode string passed to re.search()
The code in _downloader_worker_thread() does not work with Python 3:

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 926, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.7/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/home/rakuco/src/depot_tools/download_from_google_storage.py", line 343, in _downloader_worker_thread
    elif re.search(r'executable:\s*1', out):
  File "/usr/lib/python3.7/re.py", line 183, in search
    return _compile(pattern, flags).search(string)
TypeError: cannot use a string pattern on a bytes-like object

Bug: 984182, 1007872
Change-Id: I09df8169d802b010596ac4f34501b4bda805e6f7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1844833
Auto-Submit: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Raphael Kubo da Costa e225ef6ac5 download_from_google_storage: Do not call decode() on a string twice
This throws an exception when running with Python 3:

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 926, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.7/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/home/rakuco/src/depot_tools/download_from_google_storage.py", line 259, in _downloader_worker_thread
    file_url = '%s/%s' % (base_url, input_sha1_sum.decode())
AttributeError: 'str' object has no attribute 'decode'

We are already calling bytes.decode() in enumerate_input(), whose output
is passed to _downloader_worker_thread().

Bug: 984182, 1007872
Change-Id: I55c4835192caf69a8dee9e89ae1bb5531f4bacae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1844832
Auto-Submit: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Edward Lemur 5eac9d3013 depot_tools: Fix bug when running download_from_google on Python 3.
Issue caused by utf-8 vs byte mismatch in python 3.

Bug: 1009698
Change-Id: I8ab6b129ea9ab18f06f8ff4eb5da3aa018829365
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1832773
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Reviewed-by: Anthony Polito <apolito@google.com>
6 years ago
Victor Costan 69b63c9f97 Fix sys.platform mapping in download_from_google_storage.py.
Relevant documentation: https://docs.python.org/3/library/sys.html#sys.platform

Bug: 1007872
Change-Id: Id4bb6e1da1d3244fcd245569fd74fd204ce1e9ad
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1824843
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Auto-Submit: Victor Costan <pwnall@chromium.org>
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Edward Lesmes 7149d23621 Revert "depot_tools: Run Python scripts using vpython (Part 2)"
This reverts commit 3c814957ee.

Reason for revert: <INSERT REASONING HERE>

Original change's description:
> depot_tools: Run Python scripts using vpython (Part 2)
> 
> Tbr: iannucci@chromium.org
> Bug: 984182
> Change-Id: I2e8469f8ee0acd6a54109697d5a6b76faf24fa42
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1748590
> Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
> Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>

TBR=iannucci@chromium.org,ehmaldonado@chromium.org

Change-Id: Ic683543a04b45f733b48d6c43453fc8dff511d09
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 984182
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1749852
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Edward Lemur 3c814957ee depot_tools: Run Python scripts using vpython (Part 2)
Tbr: iannucci@chromium.org
Bug: 984182
Change-Id: I2e8469f8ee0acd6a54109697d5a6b76faf24fa42
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1748590
Reviewed-by: Edward Lesmes <ehmaldonado@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Edward Lemur 1556fbc353 depot_tools: Simplify subprocess2.
Remove support for unused features:
- timeout
- nag_timer and nag_max
- Popen start property
- callback functions for stdout and stderr

Bug: 984182
Change-Id: Ib2327119508a89d1e60f4a42c64b78d050f48092
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1745406
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
6 years ago
Eli Ribble 78dec0421b Show nice error on failure to enumerage input files.
Without this we get an ugly stack trace. This is way more
friendly.

Bug: 983006

Change-Id: I5ba871ad71ad43bb48d91697e96473afbfe399a0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1697221
Auto-Submit: Eli Ribble <eliribble@chromium.org>
Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
6 years ago
Raul Tambre b946b2389c Improve gclient Python 3 compatibility
This enables gclient sync and gclient runhooks to run, barring hook script failures.
git cl upload also now works.

The scripts still work with Python 2.
There are no intended behaviour changes.

Bug: 942522
Change-Id: I2ac587b5f803ba7f5bb5e412337ce049f4b1a741
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1524583
Commit-Queue: Raul Tambre <raul@tambre.ee>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
6 years ago
Vasili Skurydzin 179059f63e AIX: Enable usage of fetch and gclient
Change-Id: I4fe559cb44ccd9c6b037b7b096b088adf652ef9b
Reviewed-on: https://chromium-review.googlesource.com/1102718
Commit-Queue: Dirk Pranke <dpranke@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
7 years ago
Alexander Alekseev 3ade6e1214 Override temporary directory before spawning subprocess.
Python multiprocessing is using sockets to communicate. UNIX socket names are
bound by PATH_MAX which includes temporary directory name.

gsutil uses multiprocessing, which creates file sockets in the tmpdir.
On some testing configurations, the tmpdir is set to a very long path, which
causes gsutil to fail with AF_UNIX path too long errors.

To prevent multiprocess failures, this CL overrides temporary directory
dictated by the environment to /tmp.

Bug: 812581
Change-Id: Idcd99d13b2e20b3095111fa26ec4e242848c8848
Reviewed-on: https://chromium-review.googlesource.com/923170
Reviewed-by: Ryan Tseng <hinoka@chromium.org>
Commit-Queue: Alexander Alekseev <alemate@chromium.org>
7 years ago
Aaron Gable 22b540d065 download_from_google_storage: allow normal files with ..
Although we want to prevent dfgs from untar'ing files to a parent
or sibling of its target directory, normal files that just happen
to have ".." in their name (i.e. not preceding a path separator) are
okay.

R=hinoka

Bug: 807286
Change-Id: Ibdc2c3615c4778ef66abceb532a4f671fbdab8ef
Reviewed-on: https://chromium-review.googlesource.com/912430
Reviewed-by: Ryan Tseng <hinoka@chromium.org>
Commit-Queue: Aaron Gable <agable@chromium.org>
7 years ago
Michael Achenbach 1f067b88df Optimize check for existing files in download_from_google_storage
The first call to gsutil causes a network call and makes the download
script slow also in the most optimal cases. This CL refactors the
download script and moves the first gsutil call after checking locally
if sha1s match.

1) This turns the input acquisition into a generator and buffers the
files and sha1s in a list before multithreading.

2) This sequentially checks the sha1s and files and bails out early if
all match. In Chrome-land, we usually call this script with only one
file. There are some cases with around 4. This could also be
parallelized if the need arises.

3) The initial gsutil check, which ensures gsutil is updated, is moved
right in front of the multithreaded downloads.

The performance of one call to download_from_google_storage for an
existing 500MB file is 2.3s before this CL and 1.2s after (most of the
remaining time left is spent for making sha1sum).

Example for full gclient runhooks (when everything is up-to-date):

Chromium: 32s before, 12s after
V8: 12s before, 3s after

Bug: 776311
Change-Id: Ia7715a6af84b1b336455ea88494d399bdb050317
Reviewed-on: https://chromium-review.googlesource.com/897562
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Reviewed-by: Sergiy Byelozyorov <sergiyb@chromium.org>
Reviewed-by: Ryan Tseng <hinoka@chromium.org>
7 years ago
Robert Iannucci 1adc91f99f [download_from_google_storage] Use vpython to invoke gsutil.py.
This will allow all uses of this class to correctly move into
gsutil's personal vpython environment. In particular, the
get_toolchain_if_necessary script is pretty sneaky, and adds
depot_tools to sys.path to import and use this class.  This
means that if get_toolchain_if_necessary is invoked in a vanilla
vpython environment (or an environment otherwise incompatible with
gsutil.py), it's use of this class will fail.

R=hinoka@chromium.org, tandrii@chromium.org

Bug: 795146
Change-Id: I87309a8b878b465cda7f53db0a41f2f9e6da6f50
Reviewed-on: https://chromium-review.googlesource.com/849663
Reviewed-by: Ryan Tseng <hinoka@chromium.org>
Commit-Queue: Robbie Iannucci <iannucci@chromium.org>
7 years ago
Joao da Silva f2cb0f5b3e Updated the gsutil version used by download_from_google_storage.
`download_from_google_storage --config` is currently failing. It still uses gsutil 4.26 but 4.28 has been added recently:

https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/801355

Using 4.28 fixes the bug.

Bug: 796937
Change-Id: I299da7ede8087d832cd6e193d8fc4198a6878c6c
Reviewed-on: https://chromium-review.googlesource.com/840007
Reviewed-by: Jochen Eisinger <jochen@chromium.org>
Reviewed-by: John Budorick <jbudorick@chromium.org>
Commit-Queue: Joao da Silva <joaodasilva@chromium.org>
7 years ago
Ryan Tseng 8f572a579a download_from_google_storage: call gsutil.py once before anything else happens
Normally, if dfgs is started with multiple threads, the first
time gsutil.py is called, it may be called by many different
threads at the same time and hit a race condition where
multiple threads are all trying to download gsutil at the same
time.  This works around the problem by calling it for the first
time in the main thread before anything else happens.

Bug: 773671
Change-Id: Ie75d90d6d20d11f46a601500b75a198fa5e5f111
Reviewed-on: https://chromium-review.googlesource.com/713750
Reviewed-by: Jao-ke Chin-Lee <jchinlee@chromium.org>
Commit-Queue: Ryan Tseng <hinoka@chromium.org>
8 years ago
Nico Weber 6bba5a9b4a Restore (unused) "verbose" paramter in download_from_google_storage.py
Apparently several scripts in other repros call this function directly.

Bug: 772741
Change-Id: I486483e44a072af6cf8c75373a2da6ef5469fc2c
TBR=dpranke
Reviewed-on: https://chromium-review.googlesource.com/707937
Commit-Queue: Nico Weber <thakis@chromium.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
8 years ago
Nico Weber 87677e9830 Make download_from_google_storage.py print nothing in the happy case where it needs to do nothing.
The script prints a bunch of stuff behind `if verbose` checks, but then
"verbose" was turned on by default in
https://bugs.chromium.org/p/chromium/issues/detail?id=504452

I think the wrong lesson was learned from that bug – it sounds like the
problem was that an error message was printed only if verbose was set.
After this change, the script is silent when it does nothing, and prints
something if something happens. (Arguably, it still prints too much in the
case where it successfully downloads something.)

This is part of a few changes to make `gclient runhooks` less noisy.

Bug: 772741,504452
Change-Id: I5823c296abe97611ba4411bab2743673b10dca4b
Reviewed-on: https://chromium-review.googlesource.com/706915
Commit-Queue: Nico Weber <thakis@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Reviewed-by: Ryan Tseng <hinoka@chromium.org>
8 years ago
Rico Wind 257c9b2a70 Use extended path syntax on windows when extracting tarball in download script
R=hinoka@chromium.org

Bug:
Change-Id: I027ac560beeea2ebf38fe6ddcb4e707efd3f615a
Reviewed-on: https://chromium-review.googlesource.com/538612
Reviewed-by: Ryan Tseng <hinoka@chromium.org>
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Rico Wind <ricow@chromium.org>
8 years ago
Ryan Tseng ce325ac84a Update gsutil pin for download_from_google_storage.py from 4.15 to 4.26
This picks up about 2 years worth of changes.

Bug:723733
TEST=Ran gclient sync on src.git checkout, worked.
Change-Id: I7021ac62be560bb3ba7b523f0758d56bceeef12a
Reviewed-on: https://chromium-review.googlesource.com/527262
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Ryan Tseng <hinoka@chromium.org>
8 years ago
pauljensen@chromium.org 6f830d75c6 Force download and extract if extracted directory is missing
Without this change, the extracted directory could be missing but
the downloaded file could match the hash, and in turn
download_from_google_storage will not download the file and will
not extract it, and any tools depending on the extracted
directory will fail.

Review URL: https://codereview.chromium.org/1904483002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@300051 0039d316-1c4b-4281-b951-d872f2087c98
9 years ago
dsansome@chromium.org b180ded392 Retry errors setting executable headers.
Fixes this flake: https://build.chromium.org/p/chromium.infra/builders/infra-continuous-mac-10.9-64/builds/1729/steps/upload%20go%20bin/logs/stdio

BUG=

Review URL: https://codereview.chromium.org/1824223002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@299525 0039d316-1c4b-4281-b951-d872f2087c98
9 years ago
hinoka@chromium.org 79c7897538 Remove --no_resume from download_from_google_storage.py
This doesn't actually look like it's used.

BUG=

Review URL: https://codereview.chromium.org/1747443002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@298997 0039d316-1c4b-4281-b951-d872f2087c98
9 years ago
hinoka@chromium.org 47ea639f5f Default download_from_google_storage.py to verbose
BUG=504452

Review URL: https://codereview.chromium.org/1223793008

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@296882 0039d316-1c4b-4281-b951-d872f2087c98
10 years ago
hinoka@chromium.org c3d4413cab Bump Gsutil version for download_from_google_storage to 4.15
BUG=

Review URL: https://codereview.chromium.org/1352043004

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@296750 0039d316-1c4b-4281-b951-d872f2087c98
10 years ago
ricow@chromium.org 92cd7b05d5 Reland 0c7d94eb9d9fa388bda0d74405c0928dceea22ff: Add support for tar.gz archive files to download from download_from_google_storage
I fixed the overlapping argument and fixed up the tests so that the actual sha1 hash is now passed (since the tool actually check now that the downloaded file hash matches)

BUG=
R=hinoka@google.com

Review URL: https://codereview.chromium.org/1285423002 .

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@296346 0039d316-1c4b-4281-b951-d872f2087c98
10 years ago
hinoka@chromium.org be46fddf5f Add verification to downloaded files
This does one last check to see if the file downloaded by
download_from_google_storage.py actually matches its sha1

BUG=

Review URL: https://codereview.chromium.org/1252313005

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@296155 0039d316-1c4b-4281-b951-d872f2087c98
10 years ago
boliu@chromium.org 2aa134c40a Revert of Add support for tar.gz archive files to download from download_from_google_storage (patchset #8 id:140001 of https://codereview.chromium.org/807463005/)
Reason for revert:
This conflicts with (and duplicates?) the -z option below and has broken one of the chrome android downstream bots.

Safer to revert than trying to fix

Original issue's description:
> Add support for tar.gz archive files to download from download_from_google_storage
> 
> Also, add support for directly setting the public read flag on uploaded files.
> 
> The support for tar.gz allows the uploaded bundle to be a single tar.gz file instead of a lot of individual files using the directory support already in. The benefit here is that it is much easier to update the dependency. Simply clean out the existing files, copy in the new ones, create a tar.gz file, with the same name as the directory + 'tar.gz'. If the directory name and file name does not match up we will not clean up existing artifacts on download (i.e., there can be left over files after extracting).
> 
> I am doing this because I am moving a bunch of the dart dependencies to gcs, and a lot of our dependencies is much easier to manage with this in. If you don't like this, I can simply wrap the download script in another python script and do the logic there, but this may be handy for other people as well.
> 
> Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=295872

TBR=hinoka@google.com,hinoka@chromium.org,azarchs@chromium.org,ricow@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Review URL: https://codereview.chromium.org/1209033006

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@295883 0039d316-1c4b-4281-b951-d872f2087c98
10 years ago
ricow@google.com 0c7d94eb9d Add support for tar.gz archive files to download from download_from_google_storage
Also, add support for directly setting the public read flag on uploaded files.

The support for tar.gz allows the uploaded bundle to be a single tar.gz file instead of a lot of individual files using the directory support already in. The benefit here is that it is much easier to update the dependency. Simply clean out the existing files, copy in the new ones, create a tar.gz file, with the same name as the directory + 'tar.gz'. If the directory name and file name does not match up we will not clean up existing artifacts on download (i.e., there can be left over files after extracting).

I am doing this because I am moving a bunch of the dart dependencies to gcs, and a lot of our dependencies is much easier to manage with this in. If you don't like this, I can simply wrap the download script in another python script and do the logic there, but this may be handy for other people as well.

Review URL: https://codereview.chromium.org/807463005

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@295872 0039d316-1c4b-4281-b951-d872f2087c98
10 years ago
hinoka@chromium.org 40cdc99cb6 Simply download_from_google_storage --config
This does two noticable things:
* Prints a message when "download_from_google_storage --config" is run to
  tell the user to enter "0" for the project ID prompt
* Removes the ".boto.depot_tools" boto file and defaults the boto file to
  grant fullcontrol scopes.

Context: We restricted the depot_tools specific scopes to be readonly out of
concern that we would be forcing every developer to hold a set of non-expiring
write access credentials on their workstation.  But this distinction has caused
a great deal of pain and anguish with confusing credentials (who would've thought
~/.boto.depot_tools would exist and might be broken?), and not for huge security
gains.  Most people don't have write access to buckets, and the ones that do
definitely has a fullcontrol boto file already.

BUG=

Review URL: https://codereview.chromium.org/1182583003

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@295728 0039d316-1c4b-4281-b951-d872f2087c98
10 years ago
nparker@chromium.org 31f3df064d Report more detailed error from download_from_google_storage.py when gsutil fails.
BUG=

Review URL: https://codereview.chromium.org/1091373004

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@295416 0039d316-1c4b-4281-b951-d872f2087c98
10 years ago
primiano@chromium.org e48b81e62b [download_from_google_storage] Don't list ALL objects to check for ACLs
Currently check_bucket_permissions() in download_from_google_storage.py
performs a gsutil ls gs://bucket to determine whether the user has access
to the bucket or not.
This can be an EXTREMELY expensive operation (~minutes) if the bucket in
question has a lot of objects in the root (real case: chrome-telemetry).
It is worth noting that check_bucket_permissions() is not called just for
uploads but also for downloads, hence this is slowing down all invocations
of gclient sync on users and bots machine.
Removing the check_bucket_permissions() and let gsutil fail with an
Unauthorized error message if ACLs are not met.

BUG=458059

Review URL: https://codereview.chromium.org/923473002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@294083 0039d316-1c4b-4281-b951-d872f2087c98
10 years ago
mmoss@chromium.org 0ebd029d8c Support optional BOTO specification with --no_auth.
This prevents --no_auth from always clearing BOTO_CONFIG, since there
are times when a BOTO is needed for other things than just auth info
(e.g. proxy settings).

BUG=443523
R=hinoka@chromium.org, szager@chromium.org

Review URL: https://codereview.chromium.org/844373002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@293652 0039d316-1c4b-4281-b951-d872f2087c98
10 years ago
dpranke@chromium.org 20bef06989 Fix setting the executable bit in download_from_google_storage.
The new GSUtil (or gs protocol, who knows) strips off the redundent x-goog-meta
string from the metadata key.  This CL compensates for that.

Also since we're on 4.7, we can use the faster gsutil stat instead of gsutil ls -L.

BUG=
TEST=ran download_from_google_storage against compiler_proxy.sha, works
NOTREECHECKS=true
NOTRY=true
R=dnj@chromium.org, pgervais@chromium.org

Review URL: https://codereview.chromium.org/809123003

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@293432 0039d316-1c4b-4281-b951-d872f2087c98
11 years ago
hinoka@chromium.org 199bc5f92c Use gsutil.py for download_from_google_storage instead of the builtin one
This pins gsutil to a vanilla 4.7 instead of the weird custom 3.4 we have in depot_tools

BUG=
R=pgervais@chromium.org

Review URL: https://codereview.chromium.org/797663003

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@293413 0039d316-1c4b-4281-b951-d872f2087c98
11 years ago
ojan@chromium.org af2591b71c Fixed download_from_google_storage for real.
check_bucket_permissions should no longer return a tuple.

TBR=vadimsh@chromium.org

Review URL: https://codereview.chromium.org/759013007

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@293255 0039d316-1c4b-4281-b951-d872f2087c98
11 years ago
ojan@chromium.org 5c88fd0f51 Fix download_from_google_storage.py.
check_bucket_permissions() takes exactly 2 arguments (3 given)

TBR=vadimsh@chromium.org

Review URL: https://codereview.chromium.org/780113003

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@293254 0039d316-1c4b-4281-b951-d872f2087c98
11 years ago
ojan@chromium.org 50c8e0ee11 Make --output and --sha1_filename work well together.
--sha1_filename unnecessarily forces the output to have
the same filename and be in the same directory. The code
in main already correctly sets the file name to the
sha1_filename minus the .sha1, so the only change is
to actually use the --output path the same way the
rest of the code does.

R=iannucci@chromium.org

Review URL: https://codereview.chromium.org/752803003

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@293251 0039d316-1c4b-4281-b951-d872f2087c98
11 years ago
ojan@chromium.org d3e713bfd9 Don't check bucket permissions if --no-auth.
Checking bucket permissions takes ~400ms. We don't
need to do this if --no-auth because we know we
won't get a 403 and the 404 check will be handled
later when we try to actually download the file.

Also, remove the check for a null bucket. This
can't happen since we will throw a parser error
in the main function before we get to this code.

R=iannucci@chromium.org

Review URL: https://codereview.chromium.org/772203002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@293250 0039d316-1c4b-4281-b951-d872f2087c98
11 years ago
hinoka@chromium.org 6b6a1144f9 Delete before cp in download_from_google_storage
BUG=

Review URL: https://codereview.chromium.org/696023002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@292819 0039d316-1c4b-4281-b951-d872f2087c98
11 years ago
hinoka@google.com c82706326c Adds --auto_platform to download_from_google_storage.
A very common pattern for the users of this script is to have binaries in
three different folders, eg:
some/folder/win/bin.exe
some/folder/mac/bin
some/folder/linux/bin

Instead of using --platform to specify three different paths, we can recognize
this usage and pass in --auto_platform, and then --directory some/folder/ as the
target.

When enumerating files, it will match each individual file to see if they have
(win|mac|linux) as a parent folder name, and filter out non-matching platforms.

BUG=
TEST= src/third_party/clang_format/bin$ download_from_google_storage --auto_platform --no_auth -b chromium-clang-fomat -dr .
0> Downloading ./linux/clang-format...

Review URL: https://codereview.chromium.org/126893002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@245643 0039d316-1c4b-4281-b951-d872f2087c98
11 years ago
hinoka@google.com 4b74fcd721 Force download_from_google_storage --config to produce a read-only token
When download_from_google_storage --config is run, it should be implied that
the user just wants to download, not upload.  This change passes the '-r' flag
into gsutil config, which requests a read-only scoped token rather than write
token.  This is saved in ~/.boto.depot_tools so that it doesn't conflict
with a ~/.boto file crated later that may have write permissions.


BUG=

Review URL: https://codereview.chromium.org/135153002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@244276 0039d316-1c4b-4281-b951-d872f2087c98
11 years ago
hinoka@chromium.org c6a2ee6930 Adds SSO auth to gsutil
Code path:
1. plugins.sso_auth is imported, which adds the AuthHandler class to the global state.
2. HasConfiguredCredentials() in gslib/utils.py is called by gsutil, and will return true if "prodaccess" exists on the system, which tells the system that we don't want a no-op auth handler.
3. When a command is called, all the auth handlers are cycled through and sso_auth.SSOAuth is called, which calls a stubby command to emit a gaiamint'ed oauth2 access token, which is then used as the Authorization Header

if --bypass_prodaccess is passed in, then:
1. HasConfiguredCredentials() will bypass the check for prodaccess, as if it didn't exist.
2. plugins.sso_auth does not get imported.
Which will essentially cause gsutil to behave as if this patch never existed.

So the expected behavior is:
=.boto file does not exist, prodaccess exists, but unauthenticated=
Failure: No handler was ready to authenticate. 3 handlers were checked. ['OAuth2Auth', 'HmacAuthV1Handler', 'SSOAuth'] Check your credentials.

=.boto file exists, prodaccess exists, but unauthenticated=
sso_auth will raise NotReadyToAuthenticate, and the .boto file will be used instead

=.boto file exists, prodaccess exists, authenticated=
sso_auth will be run _after_ the default gsutil authenticator, which causes the sso_auth to be used over whatever the default authentication is.

bypass_prodaccess is passed in by default to upload_to_google_storage because we expect people who use upload_to_google_storage to not need prodaccess and have their own boto file already.  Also the sso_auth plugin will only request a readonlyi token, which will not work for uploading.

BUG=258152

Review URL: https://codereview.chromium.org/86123002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@240266 0039d316-1c4b-4281-b951-d872f2087c98
12 years ago
brettw@chromium.org 7d4cc4acb3 Actually call the NormlizeFilePath function for download platform detection.
This should make Cygwin work to match "win32".

Review URL: https://codereview.chromium.org/108743002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@239244 0039d316-1c4b-4281-b951-d872f2087c98
12 years ago
brettw@chromium.org 25a33d30d5 Add executable bit to all files downloaded under cygwin.
Review URL: https://codereview.chromium.org/107323002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@239057 0039d316-1c4b-4281-b951-d872f2087c98
12 years ago
brettw@chromium.org 7d6ffa55da Detect cygwin as Win32 for the purposes of running GN and downloading from google storage.
This normalizes sys.platform so people running cygwin are treated like Windows.

Review URL: https://codereview.chromium.org/104763003

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@238999 0039d316-1c4b-4281-b951-d872f2087c98
12 years ago
scottmg@chromium.org ff7ea00a6e Silence common noisiness in download_from_google_storage
Seems overly verbose when run in "gclient runhooks".

R=iannucci@chromium.org, brettw@chromium.org

Review URL: https://codereview.chromium.org/58783002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@237120 0039d316-1c4b-4281-b951-d872f2087c98
12 years ago
hinoka@chromium.org c61894cc02 Add no_auth flag to skip auth checking for buckets that don't require it. Also fix tests
BUG=321254

Review URL: https://codereview.chromium.org/76583002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@236039 0039d316-1c4b-4281-b951-d872f2087c98
12 years ago