[go: nahoru, domu]

Orderfile: Upload ready orderfiles under a flag

Just a tiny utility, because writing code (to invoke the upload) is
easier than to read the code (to extract the right command).

Bug: 893981
Change-Id: Iff50406f554c207384ab0c4119d22d4510e59fd9
Reviewed-on: https://chromium-review.googlesource.com/c/1340267
Reviewed-by: Matthew Cary <mattcary@chromium.org>
Commit-Queue: Egor Pasko <pasko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609668}
diff --git a/tools/cygprofile/orderfile_generator_backend.py b/tools/cygprofile/orderfile_generator_backend.py
index 2ddac970..7d29f537 100755
--- a/tools/cygprofile/orderfile_generator_backend.py
+++ b/tools/cygprofile/orderfile_generator_backend.py
@@ -662,6 +662,13 @@
       self._orderfile_updater.UploadToCloudStorage(
           filename, use_debug_location=False)
 
+  def UploadReadyOrderfiles(self):
+    self._step_recorder.BeginStep('Upload Ready Orderfiles')
+    for file_name in [self._GetUnpatchedOrderfileFilename(),
+        self._GetPathToOrderfile()]:
+      self._orderfile_updater.UploadToCloudStorage(
+          file_name, use_debug_location=False)
+
   def _GetHashFilePathAndContents(self, base_file):
     """Gets the name and content of the hash file created from uploading the
     given file.
@@ -846,6 +853,11 @@
                       help=('Directory to save any profiles created. These can '
                             'be used with --pregenerated-profiles.  Cannot be '
                             'used with --skip-profiles.'))
+  parser.add_argument('--upload-ready-orderfiles', action='store_true',
+                      help=('Skip orderfile generation and manually upload '
+                            'orderfiles (both patched and unpatched) from '
+                            'their normal location in the tree to the cloud '
+                            'storage. DANGEROUS! USE WITH CARE!'))
 
   profile_android_startup.AddProfileCollectionArguments(parser)
   return parser
@@ -868,6 +880,8 @@
   try:
     if options.verify:
       generator._VerifySymbolOrder()
+    elif options.upload_ready_orderfiles:
+      return generator.UploadReadyOrderfiles()
     else:
       return generator.Generate()
   finally: