From 9fcd0d4b742b6910b8bfcc5f8a9e8600702d6a87 Mon Sep 17 00:00:00 2001 From: Robin Schneider Date: Tue, 14 Jan 2020 23:51:02 +0100 Subject: [PATCH] [scripts/config] Input tolerance for leading space Google fail Closes: #16 Post by @ubergeek77 with the details: > The [Factory Images page](https://developers.google.com/android/images) has some unfortunate inconsistencies with how it is displaying some of the image information. > > There are two main issues: > > * Starting with the January 2020 images, Google has been prepending the Build ID field with an unnecessary space. > > * `config` splits that string with a space already, so the index the script expects the build ID to be at will no longer be at that location unless that space is removed before splitting. > > * Google is now serving T-Mobile/Google Fi factory images. They are the last image in each section, so this "TMO/Fi" image will be considered "latest." However, not everyone has a T-Mobile/Google Fi device. If you were to fix the above issue, you'd still have the issue of determining whether or not the user wants a T-Mobile/Fi image or not (I'd imagine you wouldn't in ~80% of cases) > > > For clarity, consider the following excerpt from the images HTML source: > > ``` > > 10.0.0 (QQ1A.191205.008, Dec 2019) > class="gc-analytics-event" data-category="Android Images" > data-label="crosshatch for Pixel 3 XL [QQ1A.191205.008]">Link > ff62c0224a3cffe0dbcfd45adf0a42b4271bd907b3f0839fe2940bf41ba7b88b > > > 10.0.0 (QQ1A.200105.002, Jan 2020) > class="gc-analytics-event" data-category="Android Images" > data-label="crosshatch for Pixel 3 XL [QQ1A.200105.002]">Link > 853405e1c585e2a5c28f8fdf9ea8b2a03a2868eb7cb3137dde5fc6ffa854caf4 > > > 10.0.0 (QQ1A.200105.003, Jan 2020, TMO/Fi) > class="gc-analytics-event" data-category="Android Images" > data-label="crosshatch for Pixel 3 XL [QQ1A.200105.003]">Link > 6d235f477ac74153bf8bc23e69e30c81cb500ca2ac72a3d67731f916981dacea > > ``` > > Look carefully at the last two sections' version strings - they have spaces, but every image before it does not (unless you count some of the 9.0 images, since a few of them did actually have spaces). > > You can fix this rather easily by adding the following below [config:45](https://github.com/hashbang/aosp-build/blob/master/scripts/config#L45): > > ``` > if data.startswith(' '): > data = data[1:] > ``` > > That does still leave the issue of the T-Mobile/Google Fi images, though. --- scripts/config | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/config b/scripts/config index ef1cc8e..853c0f9 100755 --- a/scripts/config +++ b/scripts/config @@ -42,6 +42,7 @@ class AndroidImagesParser(HTMLParser): def handle_data(self, data): if self.device: + data = data.strip() if len(data) > 6: if self.hash_pattern.match(data) and self.version_open == True: self.images.setdefault(