@@ -67,10 +67,6 @@ def parse_arguments() -> argparse.Namespace:
6767 "\" results\" directory can be found." )
6868 parser .add_argument ("-D" , "--debug" , required = False , action = "count" ,
6969 help = "If specified, debugging mode is turned on." )
70- parser .add_argument ("--use-old-results-classification" , required = False ,
71- action = "count" ,
72- help = "If specified, results will be classified using "
73- "old classification using ADB convention." )
7470 parser .add_argument ("--pull-all-apks" , required = False ,
7571 action = "count" ,
7672 help = "If specified, the script will attempt to download "
@@ -334,47 +330,6 @@ def wait_for_results(adb_wrapper, logger):
334330 return adb_wrapper .logcat_find (patterns , terminate_logcat )
335331
336332
337- def classify_dir_using_adb_format (adb_wrapper : syscall_wrapper .AdbWrapper ,
338- source : str ,
339- results_dir : str ,
340- device : syscall_wrapper .DeviceInfo ,
341- logger : logging .Logger )-> Optional [str ]:
342- """Decides which directory in results/ to dump new result to.
343-
344- This method is grandfathered as it was the original way of classification,
345- using ADB's information, on product name, model name, and device name.
346-
347- Args:
348- adb_wrapper: An AdbWrapper instance.
349- source: the source directory (on target device) containing new results.
350- results_dir: the umbrella results/ directory.
351- device: A DeviceInfo instance containing the device to operate on.
352- logger: A logger object to log debug or error messages.
353-
354- Returns:
355- A string representing the final directory (on host) where results are pulled
356- to. <code>None</code> is returned if any failure is encountered along the
357- way.
358- """
359- target_dir_parent = os .path .join (results_dir , "{}-{}-{}" .format (
360- device .product_name , device .model_name , device .device_name ))
361- if not os .path .exists (target_dir_parent ):
362- logger .debug ("{} does not exist yet. Creating..." .format (target_dir_parent ))
363- os .makedirs (target_dir_parent )
364-
365- target_dir = ""
366- for i in range (1000 ):
367- target_dir = os .path .join (target_dir_parent , "{0:03d}" .format (i ))
368- logger .debug ("Testing {} as target directory." .format (target_dir ))
369- if not os .path .exists (target_dir ):
370- logger .debug ("{} does not exist yet! Using it!" .format (target_dir ))
371- break
372-
373- if adb_wrapper .pull (source , target_dir ):
374- return target_dir
375- return None
376-
377-
378333def _retry_apk_extraction (adb_wrapper : syscall_wrapper .AdbWrapper ,
379334 retry_packages_dict : dict [str , str ],
380335 apks_dir : str ,
@@ -635,22 +590,15 @@ def classify_dir_using_build_fingerprint(
635590def extract_results_and_apks (adb_wrapper : syscall_wrapper .AdbWrapper ,
636591 source : str ,
637592 destination : str ,
638- device : syscall_wrapper .DeviceInfo ,
639593 logger : logging .Logger ,
640- use_old_classification = False ,
641594 extract_apks = False ) -> Optional [str ]:
642595 """Extracts results (and optionally APKs) from Hubble's execution.
643596
644597 Args:
645598 adb_wrapper: An AdbWrapper object that is used to issue ADB commands.
646599 source: the path to where results live (on device).
647600 destination: the path to where results should be copied to (on host).
648- device: A DeviceInfo object containing the device to operate on.
649601 logger: A logger object to log debug or error messages.
650- use_old_classification: A boolean indicating whether to revert to old
651- classification of result, i.e. based on how ADB
652- displays device information. This is defaulted to
653- False.
654602 extract_apks: A boolean indicating whether to also extract APKs from the
655603 device or not. This is defaulted to False.
656604
@@ -680,14 +628,6 @@ def extract_results_and_apks(adb_wrapper: syscall_wrapper.AdbWrapper,
680628 logger .debug ("{} does not exist yet. Creating..." .format (results_dir ))
681629 os .makedirs (results_dir , exist_ok = True )
682630
683- if use_old_classification :
684- # Note that this method will not support pulling APKs from device.
685- return classify_dir_using_adb_format (adb_wrapper ,
686- source ,
687- results_dir ,
688- device ,
689- logger )
690-
691631 return classify_dir_using_build_fingerprint (adb_wrapper ,
692632 source ,
693633 results_dir ,
@@ -907,14 +847,11 @@ def main():
907847 if not results_source :
908848 logger .error ("Failed to obtain results from Hubble execution." )
909849 continue
910- use_old_classification = args .use_old_results_classification is not None
911850 extract_apks = args .pull_all_apks is not None
912851 results_dir = extract_results_and_apks (adb_wrapper ,
913852 results_source ,
914853 args .output ,
915- target_device ,
916854 logger ,
917- use_old_classification ,
918855 extract_apks )
919856
920857 if not results_dir :
0 commit comments