tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

per_platform_dummy.py (1442B)


      1 # This Source Code Form is subject to the terms of the Mozilla Public
      2 # License, v. 2.0. If a copy of the MPL was not distributed with this
      3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
      4 """
      5 Transform the repackage task into an actual task description.
      6 """
      7 
      8 from taskgraph.transforms.base import TransformSequence
      9 from taskgraph.util.dependencies import get_primary_dependency
     10 
     11 from gecko_taskgraph.util.attributes import copy_attributes_from_dependent_job
     12 
     13 transforms = TransformSequence()
     14 
     15 
     16 @transforms.add
     17 def one_task_per_product_and_platform(config, jobs):
     18    unique_products_and_platforms = set()
     19    for job in jobs:
     20        dep_task = get_primary_dependency(config, job)
     21        assert dep_task
     22 
     23        product = dep_task.attributes.get("shipping_product")
     24        platform = dep_task.attributes.get("build_platform")
     25        if (product, platform) not in unique_products_and_platforms:
     26            attr_denylist = ("l10n_chunk", "locale", "artifact_map", "artifact_prefix")
     27            attributes = copy_attributes_from_dependent_job(
     28                dep_task, denylist=attr_denylist
     29            )
     30            attributes.update(job.get("attributes", {}))
     31            job["attributes"] = attributes
     32            job["name"] = f"{product}-{platform}"
     33            job["shipping-product"] = product
     34            del job["dependencies"]
     35            yield job
     36            unique_products_and_platforms.add((product, platform))