Skip to content

Commit

Permalink
[scripts/config] Input tolerance for leading space Google fail
Browse files Browse the repository at this point in the history
Closes: hashbang#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:
>
> ```
> <tr id="crosshatchqq1a.191205.008">
>     <td>10.0.0 (QQ1A.191205.008, Dec 2019)</td>
>     <td><a href="https://dl.google.com/dl/android/aosp/crosshatch-qq1a.191205.008-factory-ff62c022.zip"
>         class="gc-analytics-event" data-category="Android Images"
>         data-label="crosshatch for Pixel 3 XL [QQ1A.191205.008]">Link</a></td>
>     <td>ff62c0224a3cffe0dbcfd45adf0a42b4271bd907b3f0839fe2940bf41ba7b88b</td>
>   </tr>
>   <tr id="crosshatchqq1a.200105.002">
>     <td> 10.0.0 (QQ1A.200105.002, Jan 2020)</td>
>     <td><a href="https://dl.google.com/dl/android/aosp/crosshatch-qq1a.200105.002-factory-853405e1.zip"
>         class="gc-analytics-event" data-category="Android Images"
>         data-label="crosshatch for Pixel 3 XL [QQ1A.200105.002]">Link</a></td>
>     <td>853405e1c585e2a5c28f8fdf9ea8b2a03a2868eb7cb3137dde5fc6ffa854caf4</td>
>   </tr>
>   <tr id="crosshatchqq1a.200105.003">
>     <td> 10.0.0 (QQ1A.200105.003, Jan 2020, TMO/Fi)</td>
>     <td><a href="https://dl.google.com/dl/android/aosp/crosshatch-qq1a.200105.003-factory-6d235f47.zip"
>         class="gc-analytics-event" data-category="Android Images"
>         data-label="crosshatch for Pixel 3 XL [QQ1A.200105.003]">Link</a></td>
>     <td>6d235f477ac74153bf8bc23e69e30c81cb500ca2ac72a3d67731f916981dacea</td>
>   </tr>
> ```
>
> 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.
  • Loading branch information
ypid committed Jan 14, 2020
1 parent dcf9523 commit 9fcd0d4
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions scripts/config
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 9fcd0d4

Please sign in to comment.