Bug 1125280 Part 1 build- Different suggestedsite tiles on first run for kidfox.r=gps
authorAllison Naaktgeboren <ally@mozilla.com>
Fri, 07 Aug 2015 21:40:41 -0700
changeset 256923 b8f3ee0be9aa
parent 256922 b236dcce4e2b
child 256924 bd1474381abd
push id14538
push useranaaktgeboren@mozilla.com
push dateSat, 08 Aug 2015 04:41:58 +0000
treeherderfx-team@bd1474381abd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs1125280
milestone42.0a1
Bug 1125280 Part 1 build- Different suggestedsite tiles on first run for kidfox.r=gps
mobile/android/base/resources/drawable-xhdpi/suggestedsites_restricted_fxsupport.png
mobile/android/base/resources/drawable-xhdpi/suggestedsites_webmaker.png
mobile/locales/en-US/chrome/region.properties
python/mozbuild/mozbuild/action/generate_suggestedsites.py
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..f28a62f53a7f896b9434df91d5fd62f4624468e8
GIT binary patch
literal 2643
zc$@)K3as^sP)<h;3K|Lk000e1NJLTq009^P001}$1^@s6CROJS000UaNkl<Zc-rip
zZLAzs8OP^xOQE%-46j9-nr?+Q4GLw!NP|kq0Fv@SOBWjy;RCLMtyC)+sR3VN(p91a
zM98MrU<(m8ShYd;Fc4B3NDHghTP!4Gs4enpS!<gTdb#%a|8NYOIp;j*oSn|NyZ3pL
zUz6rO=efIcXMS_$oS8F$5Q1SCrVu9m24EP51;a253x;7Bh6Teg3=4)~7#0k}FboT(
z5SD^X;AwCVm~F{F3tR`9U?;fPl0OR00XKn-U=R3!;O)+^V1}Nb3N_vU^D=oe!0*9Z
zn*3`Gwa*3#I3UzmAb8s|ESRC@<H8(|WO9!qa=&G$znExqk>KsmuwaIo?+J4p)Z`yD
z<bIpDlrqI-g10}zf*ERlD9rJWCV!71_f|vwlZpCE1aE)l|3e7spaI$-VZju`#ljq$
zHTk;?xoZveXR=_JJ|qI&5wl>5V}nqm0~Ts>$2<iy%7S57Fq4~6uo7$q&x7?~E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@_Hl?lONY>7u#euV
zAcn$W8&9c%NQT2Uo>v8t0*7t9tO{Zx9JVo96~qiUY-7ACh`DgsMye`^#c<e0nktA4
zIBa8~Du{J(*v2wd5I?|S8>>`7WW!+_8&pBON+&q2@}=TIIGz8rONRsi0001j{=asF
imB0gpKnR3D2$le?wwfXdZCWP)0000<MNUMnLSTYyCQfqz
--- a/mobile/locales/en-US/chrome/region.properties
+++ b/mobile/locales/en-US/chrome/region.properties
@@ -65,8 +65,22 @@ browser.suggestedsites.fxaddons.title=Ad
 browser.suggestedsites.fxaddons.url=https://addons.mozilla.org/en-US/android/
 browser.suggestedsites.fxaddons.bgcolor=#62be06
 browser.suggestedsites.fxaddons.trackingid=630
 
 browser.suggestedsites.fxsupport.title=Firefox Help and Support
 browser.suggestedsites.fxsupport.url=https://support.mozilla.org/en-US/products/mobile
 browser.suggestedsites.fxsupport.bgcolor=#f37c00
 browser.suggestedsites.fxsupport.trackingid=631
+
+browser.suggestedsites.restricted.list.0=restricted_fxsupport
+browser.suggestedsites.restricted.list.1=webmaker
+browser.suggestedsites.restricted.list.2=mozilla
+
+browser.suggestedsites.restricted_fxsupport.title=Firefox Help and Support for Restricted Profiles
+browser.suggestedsites.restricted_fxsupport.url=https://support.mozilla.org/en-US/products/mobile
+browser.suggestedsites.restricted_fxsupport.bgcolor=#f37c00
+browser.suggestedsites.restricted_fxsupport.trackingid=000
+
+browser.suggestedsites.webmaker.title=Learn the Web: Mozilla Webmaker
+browser.suggestedsites.webmaker.url=https://webmaker.org/
+browser.suggestedsites.webmaker.bgcolor=#f37c00
+browser.suggestedsites.webmaker.trackingid=000
--- a/python/mozbuild/mozbuild/action/generate_suggestedsites.py
+++ b/python/mozbuild/mozbuild/action/generate_suggestedsites.py
@@ -6,33 +6,35 @@
 ''' Script to generate the suggestedsites.json file for Fennec.
 
 This script follows these steps:
 
 1. Read the region.properties file in all the given source directories
 (see srcdir option). Merge all properties into a single dict accounting for
 the priority of source directories.
 
-2. Read the list of sites from the 'browser.suggestedsites.list.INDEX'
-properties with value of these keys being an identifier for each suggested site
-e.g. browser.suggestedsites.list.0=mozilla, browser.suggestedsites.list.1=fxmarketplace.
+2. Read the list of sites from the list 'browser.suggestedsites.list.INDEX' and
+'browser.suggestedsites.restricted.list.INDEX' properties with value of these keys
+being an identifier for each suggested site e.g. browser.suggestedsites.list.0=mozilla,
+browser.suggestedsites.list.1=fxmarketplace.
 
 3. For each site identifier defined by the list keys, look for matching branches
 containing the respective properties i.e. url, title, etc. For example,
 for a 'mozilla' identifier, we'll look for keys like:
 browser.suggestedsites.mozilla.url, browser.suggestedsites.mozilla.title, etc.
 
 4. Generate a JSON representation of each site, join them in a JSON array, and
 write the result to suggestedsites.json on the locale-specific raw resource
 directory e.g. raw/suggestedsites.json, raw-pt-rBR/suggestedsites.json.
 '''
 
 from __future__ import absolute_import, print_function
 
 import argparse
+import copy
 import json
 import sys
 import os
 
 from mozbuild.dotproperties import (
     DotProperties,
 )
 from mozbuild.util import (
@@ -73,47 +75,63 @@ def main(args):
                         action='append', required=True,
                         help='directories to read inputs from, in order of priority')
     parser.add_argument('output', metavar='OUTPUT',
                         help='output')
     opts = parser.parse_args(args)
 
     # Use reversed order so that the first srcdir has higher priority to override keys.
     properties = merge_properties('region.properties', reversed(opts.srcdir))
-    names = properties.get_list('browser.suggestedsites.list')
-    if opts.verbose:
-        print('Reading {len} suggested sites: {names}'.format(len=len(names), names=names))
 
     # Keep these two in sync.
     image_url_template = 'android.resource://%s/drawable/suggestedsites_{name}' % opts.android_package_name
     drawables_template = 'drawable*/suggestedsites_{name}.*'
 
     # Load properties corresponding to each site name and define their
     # respective image URL.
     sites = []
-    for name in names:
-        site = properties.get_dict('browser.suggestedsites.{name}'.format(name=name), required_keys=('title', 'url', 'bgcolor'))
-        site['imageurl'] = image_url_template.format(name=name)
-        sites.append(site)
+
+    def add_names(names, defaults={}):
+        for name in names:
+            site = copy.deepcopy(defaults)
+            site.update(properties.get_dict('browser.suggestedsites.{name}'.format(name=name), required_keys=('title', 'url', 'bgcolor')))
+            site['imageurl'] = image_url_template.format(name=name)
+            sites.append(site)
 
-        # Now check for existence of an appropriately named drawable.  If none
-        # exists, throw.  This stops a locale discovering, at runtime, that the
-        # corresponding drawable was not added to en-US.
-        if not opts.resources:
-            continue
-        resources = os.path.abspath(opts.resources)
-        finder = FileFinder(resources)
-        matches = [p for p, _ in finder.find(drawables_template.format(name=name))]
-        if not matches:
-            raise Exception("Could not find drawable in '{resources}' for '{name}'"
-                .format(resources=resources, name=name))
-        else:
-            if opts.verbose:
-                print("Found {len} drawables in '{resources}' for '{name}': {matches}"
-                      .format(len=len(matches), resources=resources, name=name, matches=matches))
+            # Now check for existence of an appropriately named drawable.  If none
+            # exists, throw.  This stops a locale discovering, at runtime, that the
+            # corresponding drawable was not added to en-US.
+            if not opts.resources:
+                continue
+            resources = os.path.abspath(opts.resources)
+            finder = FileFinder(resources)
+            matches = [p for p, _ in finder.find(drawables_template.format(name=name))]
+            if not matches:
+                raise Exception("Could not find drawable in '{resources}' for '{name}'"
+                    .format(resources=resources, name=name))
+            else:
+                if opts.verbose:
+                    print("Found {len} drawables in '{resources}' for '{name}': {matches}"
+                          .format(len=len(matches), resources=resources, name=name, matches=matches))
+
+    # We want the lists to be ordered for reproducibility.  Each list has a
+    # "default" JSON list item which will be extended by the properties read.
+    lists = [
+        ('browser.suggestedsites.list', {}),
+        ('browser.suggestedsites.restricted.list', {'restricted': True}),
+    ]
+    if opts.verbose:
+        print('Reading {len} suggested site lists: {lists}'.format(len=len(lists), lists=[list_name for list_name, _ in lists]))
+
+    for (list_name, list_item_defaults) in lists:
+        names = properties.get_list(list_name)
+        if opts.verbose:
+            print('Reading {len} suggested sites from {list}: {names}'.format(len=len(names), list=list_name, names=names))
+        add_names(names, list_item_defaults)
+
 
     # FileAvoidWrite creates its parent directories.
     output = os.path.abspath(opts.output)
     fh = FileAvoidWrite(output)
     json.dump(sites, fh)
     existed, updated = fh.close()
 
     if not opts.silent: