1// Copyright 2023 The ChromiumOS Authors 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5syntax = "proto3"; 6 7package chromiumos.build.api; 8 9option go_package = "go.chromium.org/chromiumos/config/go/build/api"; 10 11 12message SubtoolPackage { 13 // The name of the package. May be referenced in cipd. Must not contain a /. 14 string name = 1; 15 16 enum ExportType { 17 EXPORT_UNSPECIFIED = 0; 18 EXPORT_CIPD = 1; 19 EXPORT_GCS = 2; 20 } 21 // How the package should be exported. 22 ExportType type = 2; 23 24 // The maximum number of files expected to be packaged. Export will fail if 25 // this would be exceeded. 26 int32 max_files = 3; 27 28 // The cipd package prefix. If not specified, defaults to 29 // chromiumos/infra/tools/. 30 string cipd_prefix = 4; 31 32 // Input paths relative to the SDK root. Pattern matching is permitted. 33 // Any dynamically linked ELFs are automatically wrapped with lddtree. 34 repeated PathMapping paths = 5; 35 36 message PathMapping { 37 // The source file (or files) to bundle. Glob syntax used by pathlib.Path 38 // is supported (go/pathlib#pathlib.Path.glob). Paths match files installed 39 // in the subtools chroot. If nothing matches, export will fail. 40 repeated string input = 1; 41 42 // The target path relative to the export destination. Default: "/bin". 43 string dest = 2; 44 45 // The file prefix to strip before copying to `dest`. Default: "^.*/". 46 // Export fails if this does not match all files matching `glob`. 47 string strip_prefix_regex = 3; 48 49 // A portage package (e.g., app-editors/vim) whose installed files are 50 // matched against `glob`. If unspecified, all files in the chroot are 51 // candidates to match. 52 string ebuild_filter = 4; 53 54 // Whether to treat all entries in this PathMapping as "opaque" data files. 55 // There will be no attempt to discover and bundle any dependencies. 56 bool opaque_data = 5; 57 } 58 59 // Describes how a bundled package could have changed from a prior bundle. 60 enum Change { 61 // Select the default change type configured in the subtools builder. 62 CHANGE_UNSPECIFIED = 0; 63 64 // The Build ID of any binary in the bundle has changed, or any file without 65 // a Build ID has changed, or the revision of any ebuild that contributed 66 // files to the bundle has changed. 67 CHANGE_BUILD_ID_OR_REVISION = 1; 68 69 // The revision of any ebuild contributing files to the bundle has changed. 70 CHANGE_REVISION_ONLY = 2; 71 } 72 // The type of change that will trigger a new upload. 73 Change upload_trigger = 6; 74 75 // When exporting to GCS, archives will be written to: 76 // gs://${BUCKET}/${PREFIX}/${NAME}/${PVR}/${HASH}.${EXTENSION} 77 // Where BUCKET, PREFIX, and EXTENSION are configurable using 78 // GcsExportOptions. NAME is the package name, and HASH is a checksum of the 79 // bundle contents. PVR is the package version and revision of the package 80 // that installed the subtool config. 81 message GcsExportOptions { 82 // The bucket name to export to. 83 string bucket = 1; 84 // An optional subdirectory prefix to use in the bucket. 85 string prefix = 2; 86 // The archive format to use. Right now only .tar.zst is supported. 87 enum ArchiveFormat { 88 ARCHIVE_FORMAT_UNSPECIFIED = 0; 89 ARCHIVE_FORMAT_TAR_ZST = 1; 90 } 91 ArchiveFormat archive_format = 3; 92 } 93 GcsExportOptions gcs_export_options = 7; 94 95 enum SymlinkMode { 96 // Default behavior (currently SYMLINK_RESOLVE, but subject to change). 97 SYMLINK_DEFAULT = 0; 98 99 // Resolve symlinks to files, potentially creating duplicate files. This is 100 // the safest behavior, but potentially creates sub-optimal archives. 101 SYMLINK_RESOLVE = 1; 102 103 // Preserve original symlinks. Beware of the limitations: 104 // 105 // - Installing a symlink to an absolute path will result in an error. 106 // - Absolutely no translation of symlink paths is attempted. I.e., if you 107 // re-locate files with PathMappings, things may not work. 108 // - Symlinks which do not resolve to a path inside the result bundle will 109 // result in an error. 110 // 111 // That being said, it's an effective way to reduce the size of large 112 // bundles like toolchains, so if you think you can work around these 113 // thorns, go for it. 114 SYMLINK_PRESERVE = 2; 115 } 116 SymlinkMode symlink_mode = 8; 117} 118