load("//crowbar", "crowbar_workflow") _readme_template = """ Name: The USB ID Repository Short Name: usb-ids URL: http://www.linux-usb.org/usb-ids.html https://packages.debian.org/testing/usb.ids Version: {version} Update Mechanism: Manual License: BSD-3-Clause License File: LICENSE Security Critical: no Shipped: yes Description: "This is a public repository of all known ID's used in USB devices: ID's of vendors, devices, subsystems and device classes." We use it to present a human-readable description of a USB device to the user when an extension asks for permission to access it. To update, update upstream artifact URL in crowbar.txtpb, then run `crowbar build ./ --overwrite` in this directory. We use Debian's patched usb.ids file (which fixes typos and UTF-8 encodings). This file is licensed as "BSD-3-Clause OR GPL-2", see: https://sources.debian.org/copyright/license/usb.ids/testing Local Modifications: None. # This file is generated by copy.bara.sky, do not edit. """.lstrip() # TODO(b/524456385): Remove this part when Crowbar CLI can update README.chromium # during package upgrade step. # # This is put here to make crowbar.txtpb the single source of truth for "Version" # metadata. def generate_readme(ctx): content = ctx.read_path(ctx.new_path("src/usb.ids")) matcher = re2.compile(r"#\s*Version:\s*(\S+)").matcher(content) if not matcher.find(): fail("Failed to find version from usb.ids file") ctx.write_path( ctx.new_path("README.chromium"), _readme_template.format(version = matcher.group(1)), ) crowbar_workflow( transformations = [ core.dynamic_transform(impl = generate_readme), ], )