diff options
Diffstat (limited to 'docs/manifest-format.md')
| -rw-r--r-- | docs/manifest-format.md | 399 |
1 files changed, 399 insertions, 0 deletions
diff --git a/docs/manifest-format.md b/docs/manifest-format.md new file mode 100644 index 00000000..cf48698d --- /dev/null +++ b/docs/manifest-format.md | |||
| @@ -0,0 +1,399 @@ | |||
| 1 | repo Manifest Format | ||
| 2 | ==================== | ||
| 3 | |||
| 4 | A repo manifest describes the structure of a repo client; that is | ||
| 5 | the directories that are visible and where they should be obtained | ||
| 6 | from with git. | ||
| 7 | |||
| 8 | The basic structure of a manifest is a bare Git repository holding | ||
| 9 | a single `default.xml` XML file in the top level directory. | ||
| 10 | |||
| 11 | Manifests are inherently version controlled, since they are kept | ||
| 12 | within a Git repository. Updates to manifests are automatically | ||
| 13 | obtained by clients during `repo sync`. | ||
| 14 | |||
| 15 | [TOC] | ||
| 16 | |||
| 17 | |||
| 18 | XML File Format | ||
| 19 | --------------- | ||
| 20 | |||
| 21 | A manifest XML file (e.g. `default.xml`) roughly conforms to the | ||
| 22 | following DTD: | ||
| 23 | |||
| 24 | ```xml | ||
| 25 | <!DOCTYPE manifest [ | ||
| 26 | <!ELEMENT manifest (notice?, | ||
| 27 | remote*, | ||
| 28 | default?, | ||
| 29 | manifest-server?, | ||
| 30 | remove-project*, | ||
| 31 | project*, | ||
| 32 | extend-project*, | ||
| 33 | repo-hooks?, | ||
| 34 | include*)> | ||
| 35 | |||
| 36 | <!ELEMENT notice (#PCDATA)> | ||
| 37 | |||
| 38 | <!ELEMENT remote EMPTY> | ||
| 39 | <!ATTLIST remote name ID #REQUIRED> | ||
| 40 | <!ATTLIST remote alias CDATA #IMPLIED> | ||
| 41 | <!ATTLIST remote fetch CDATA #REQUIRED> | ||
| 42 | <!ATTLIST remote pushurl CDATA #IMPLIED> | ||
| 43 | <!ATTLIST remote review CDATA #IMPLIED> | ||
| 44 | <!ATTLIST remote revision CDATA #IMPLIED> | ||
| 45 | |||
| 46 | <!ELEMENT default EMPTY> | ||
| 47 | <!ATTLIST default remote IDREF #IMPLIED> | ||
| 48 | <!ATTLIST default revision CDATA #IMPLIED> | ||
| 49 | <!ATTLIST default dest-branch CDATA #IMPLIED> | ||
| 50 | <!ATTLIST default upstream CDATA #IMPLIED> | ||
| 51 | <!ATTLIST default sync-j CDATA #IMPLIED> | ||
| 52 | <!ATTLIST default sync-c CDATA #IMPLIED> | ||
| 53 | <!ATTLIST default sync-s CDATA #IMPLIED> | ||
| 54 | <!ATTLIST default sync-tags CDATA #IMPLIED> | ||
| 55 | |||
| 56 | <!ELEMENT manifest-server EMPTY> | ||
| 57 | <!ATTLIST manifest-server url CDATA #REQUIRED> | ||
| 58 | |||
| 59 | <!ELEMENT project (annotation*, | ||
| 60 | project*, | ||
| 61 | copyfile*, | ||
| 62 | linkfile*)> | ||
| 63 | <!ATTLIST project name CDATA #REQUIRED> | ||
| 64 | <!ATTLIST project path CDATA #IMPLIED> | ||
| 65 | <!ATTLIST project remote IDREF #IMPLIED> | ||
| 66 | <!ATTLIST project revision CDATA #IMPLIED> | ||
| 67 | <!ATTLIST project dest-branch CDATA #IMPLIED> | ||
| 68 | <!ATTLIST project groups CDATA #IMPLIED> | ||
| 69 | <!ATTLIST project sync-c CDATA #IMPLIED> | ||
| 70 | <!ATTLIST project sync-s CDATA #IMPLIED> | ||
| 71 | <!ATTLIST default sync-tags CDATA #IMPLIED> | ||
| 72 | <!ATTLIST project upstream CDATA #IMPLIED> | ||
| 73 | <!ATTLIST project clone-depth CDATA #IMPLIED> | ||
| 74 | <!ATTLIST project force-path CDATA #IMPLIED> | ||
| 75 | |||
| 76 | <!ELEMENT annotation EMPTY> | ||
| 77 | <!ATTLIST annotation name CDATA #REQUIRED> | ||
| 78 | <!ATTLIST annotation value CDATA #REQUIRED> | ||
| 79 | <!ATTLIST annotation keep CDATA "true"> | ||
| 80 | |||
| 81 | <!ELEMENT copyfile EMPTY> | ||
| 82 | <!ATTLIST copyfile src CDATA #REQUIRED> | ||
| 83 | <!ATTLIST copyfile dest CDATA #REQUIRED> | ||
| 84 | |||
| 85 | <!ELEMENT linkfile EMPTY> | ||
| 86 | <!ATTLIST linkfile src CDATA #REQUIRED> | ||
| 87 | <!ATTLIST linkfile dest CDATA #REQUIRED> | ||
| 88 | |||
| 89 | <!ELEMENT extend-project EMPTY> | ||
| 90 | <!ATTLIST extend-project name CDATA #REQUIRED> | ||
| 91 | <!ATTLIST extend-project path CDATA #IMPLIED> | ||
| 92 | <!ATTLIST extend-project groups CDATA #IMPLIED> | ||
| 93 | <!ATTLIST extend-project revision CDATA #IMPLIED> | ||
| 94 | |||
| 95 | <!ELEMENT remove-project EMPTY> | ||
| 96 | <!ATTLIST remove-project name CDATA #REQUIRED> | ||
| 97 | |||
| 98 | <!ELEMENT repo-hooks EMPTY> | ||
| 99 | <!ATTLIST repo-hooks in-project CDATA #REQUIRED> | ||
| 100 | <!ATTLIST repo-hooks enabled-list CDATA #REQUIRED> | ||
| 101 | |||
| 102 | <!ELEMENT include EMPTY> | ||
| 103 | <!ATTLIST include name CDATA #REQUIRED> | ||
| 104 | ]> | ||
| 105 | ``` | ||
| 106 | |||
| 107 | A description of the elements and their attributes follows. | ||
| 108 | |||
| 109 | |||
| 110 | Element manifest | ||
| 111 | ---------------- | ||
| 112 | |||
| 113 | The root element of the file. | ||
| 114 | |||
| 115 | |||
| 116 | Element remote | ||
| 117 | -------------- | ||
| 118 | |||
| 119 | One or more remote elements may be specified. Each remote element | ||
| 120 | specifies a Git URL shared by one or more projects and (optionally) | ||
| 121 | the Gerrit review server those projects upload changes through. | ||
| 122 | |||
| 123 | Attribute `name`: A short name unique to this manifest file. The | ||
| 124 | name specified here is used as the remote name in each project's | ||
| 125 | .git/config, and is therefore automatically available to commands | ||
| 126 | like `git fetch`, `git remote`, `git pull` and `git push`. | ||
| 127 | |||
| 128 | Attribute `alias`: The alias, if specified, is used to override | ||
| 129 | `name` to be set as the remote name in each project's .git/config. | ||
| 130 | Its value can be duplicated while attribute `name` has to be unique | ||
| 131 | in the manifest file. This helps each project to be able to have | ||
| 132 | same remote name which actually points to different remote url. | ||
| 133 | |||
| 134 | Attribute `fetch`: The Git URL prefix for all projects which use | ||
| 135 | this remote. Each project's name is appended to this prefix to | ||
| 136 | form the actual URL used to clone the project. | ||
| 137 | |||
| 138 | Attribute `pushurl`: The Git "push" URL prefix for all projects | ||
| 139 | which use this remote. Each project's name is appended to this | ||
| 140 | prefix to form the actual URL used to "git push" the project. | ||
| 141 | This attribute is optional; if not specified then "git push" | ||
| 142 | will use the same URL as the `fetch` attribute. | ||
| 143 | |||
| 144 | Attribute `review`: Hostname of the Gerrit server where reviews | ||
| 145 | are uploaded to by `repo upload`. This attribute is optional; | ||
| 146 | if not specified then `repo upload` will not function. | ||
| 147 | |||
| 148 | Attribute `revision`: Name of a Git branch (e.g. `master` or | ||
| 149 | `refs/heads/master`). Remotes with their own revision will override | ||
| 150 | the default revision. | ||
| 151 | |||
| 152 | Element default | ||
| 153 | --------------- | ||
| 154 | |||
| 155 | At most one default element may be specified. Its remote and | ||
| 156 | revision attributes are used when a project element does not | ||
| 157 | specify its own remote or revision attribute. | ||
| 158 | |||
| 159 | Attribute `remote`: Name of a previously defined remote element. | ||
| 160 | Project elements lacking a remote attribute of their own will use | ||
| 161 | this remote. | ||
| 162 | |||
| 163 | Attribute `revision`: Name of a Git branch (e.g. `master` or | ||
| 164 | `refs/heads/master`). Project elements lacking their own | ||
| 165 | revision attribute will use this revision. | ||
| 166 | |||
| 167 | Attribute `dest-branch`: Name of a Git branch (e.g. `master`). | ||
| 168 | Project elements not setting their own `dest-branch` will inherit | ||
| 169 | this value. If this value is not set, projects will use `revision` | ||
| 170 | by default instead. | ||
| 171 | |||
| 172 | Attribute `upstream`: Name of the Git ref in which a sha1 | ||
| 173 | can be found. Used when syncing a revision locked manifest in | ||
| 174 | -c mode to avoid having to sync the entire ref space. Project elements | ||
| 175 | not setting their own `upstream` will inherit this value. | ||
| 176 | |||
| 177 | Attribute `sync-j`: Number of parallel jobs to use when synching. | ||
| 178 | |||
| 179 | Attribute `sync-c`: Set to true to only sync the given Git | ||
| 180 | branch (specified in the `revision` attribute) rather than the | ||
| 181 | whole ref space. Project elements lacking a sync-c element of | ||
| 182 | their own will use this value. | ||
| 183 | |||
| 184 | Attribute `sync-s`: Set to true to also sync sub-projects. | ||
| 185 | |||
| 186 | Attribute `sync-tags`: Set to false to only sync the given Git | ||
| 187 | branch (specified in the `revision` attribute) rather than | ||
| 188 | the other ref tags. | ||
| 189 | |||
| 190 | |||
| 191 | Element manifest-server | ||
| 192 | ----------------------- | ||
| 193 | |||
| 194 | At most one manifest-server may be specified. The url attribute | ||
| 195 | is used to specify the URL of a manifest server, which is an | ||
| 196 | XML RPC service. | ||
| 197 | |||
| 198 | The manifest server should implement the following RPC methods: | ||
| 199 | |||
| 200 | GetApprovedManifest(branch, target) | ||
| 201 | |||
| 202 | Return a manifest in which each project is pegged to a known good revision | ||
| 203 | for the current branch and target. This is used by repo sync when the | ||
| 204 | --smart-sync option is given. | ||
| 205 | |||
| 206 | The target to use is defined by environment variables TARGET_PRODUCT | ||
| 207 | and TARGET_BUILD_VARIANT. These variables are used to create a string | ||
| 208 | of the form $TARGET_PRODUCT-$TARGET_BUILD_VARIANT, e.g. passion-userdebug. | ||
| 209 | If one of those variables or both are not present, the program will call | ||
| 210 | GetApprovedManifest without the target parameter and the manifest server | ||
| 211 | should choose a reasonable default target. | ||
| 212 | |||
| 213 | GetManifest(tag) | ||
| 214 | |||
| 215 | Return a manifest in which each project is pegged to the revision at | ||
| 216 | the specified tag. This is used by repo sync when the --smart-tag option | ||
| 217 | is given. | ||
| 218 | |||
| 219 | |||
| 220 | Element project | ||
| 221 | --------------- | ||
| 222 | |||
| 223 | One or more project elements may be specified. Each element | ||
| 224 | describes a single Git repository to be cloned into the repo | ||
| 225 | client workspace. You may specify Git-submodules by creating a | ||
| 226 | nested project. Git-submodules will be automatically | ||
| 227 | recognized and inherit their parent's attributes, but those | ||
| 228 | may be overridden by an explicitly specified project element. | ||
| 229 | |||
| 230 | Attribute `name`: A unique name for this project. The project's | ||
| 231 | name is appended onto its remote's fetch URL to generate the actual | ||
| 232 | URL to configure the Git remote with. The URL gets formed as: | ||
| 233 | |||
| 234 | ${remote_fetch}/${project_name}.git | ||
| 235 | |||
| 236 | where ${remote_fetch} is the remote's fetch attribute and | ||
| 237 | ${project_name} is the project's name attribute. The suffix ".git" | ||
| 238 | is always appended as repo assumes the upstream is a forest of | ||
| 239 | bare Git repositories. If the project has a parent element, its | ||
| 240 | name will be prefixed by the parent's. | ||
| 241 | |||
| 242 | The project name must match the name Gerrit knows, if Gerrit is | ||
| 243 | being used for code reviews. | ||
| 244 | |||
| 245 | Attribute `path`: An optional path relative to the top directory | ||
| 246 | of the repo client where the Git working directory for this project | ||
| 247 | should be placed. If not supplied the project name is used. | ||
| 248 | If the project has a parent element, its path will be prefixed | ||
| 249 | by the parent's. | ||
| 250 | |||
| 251 | Attribute `remote`: Name of a previously defined remote element. | ||
| 252 | If not supplied the remote given by the default element is used. | ||
| 253 | |||
| 254 | Attribute `revision`: Name of the Git branch the manifest wants | ||
| 255 | to track for this project. Names can be relative to refs/heads | ||
| 256 | (e.g. just "master") or absolute (e.g. "refs/heads/master"). | ||
| 257 | Tags and/or explicit SHA-1s should work in theory, but have not | ||
| 258 | been extensively tested. If not supplied the revision given by | ||
| 259 | the remote element is used if applicable, else the default | ||
| 260 | element is used. | ||
| 261 | |||
| 262 | Attribute `dest-branch`: Name of a Git branch (e.g. `master`). | ||
| 263 | When using `repo upload`, changes will be submitted for code | ||
| 264 | review on this branch. If unspecified both here and in the | ||
| 265 | default element, `revision` is used instead. | ||
| 266 | |||
| 267 | Attribute `groups`: List of groups to which this project belongs, | ||
| 268 | whitespace or comma separated. All projects belong to the group | ||
| 269 | "all", and each project automatically belongs to a group of | ||
| 270 | its name:`name` and path:`path`. E.g. for | ||
| 271 | <project name="monkeys" path="barrel-of"/>, that project | ||
| 272 | definition is implicitly in the following manifest groups: | ||
| 273 | default, name:monkeys, and path:barrel-of. If you place a project in the | ||
| 274 | group "notdefault", it will not be automatically downloaded by repo. | ||
| 275 | If the project has a parent element, the `name` and `path` here | ||
| 276 | are the prefixed ones. | ||
| 277 | |||
| 278 | Attribute `sync-c`: Set to true to only sync the given Git | ||
| 279 | branch (specified in the `revision` attribute) rather than the | ||
| 280 | whole ref space. | ||
| 281 | |||
| 282 | Attribute `sync-s`: Set to true to also sync sub-projects. | ||
| 283 | |||
| 284 | Attribute `upstream`: Name of the Git ref in which a sha1 | ||
| 285 | can be found. Used when syncing a revision locked manifest in | ||
| 286 | -c mode to avoid having to sync the entire ref space. | ||
| 287 | |||
| 288 | Attribute `clone-depth`: Set the depth to use when fetching this | ||
| 289 | project. If specified, this value will override any value given | ||
| 290 | to repo init with the --depth option on the command line. | ||
| 291 | |||
| 292 | Attribute `force-path`: Set to true to force this project to create the | ||
| 293 | local mirror repository according to its `path` attribute (if supplied) | ||
| 294 | rather than the `name` attribute. This attribute only applies to the | ||
| 295 | local mirrors syncing, it will be ignored when syncing the projects in a | ||
| 296 | client working directory. | ||
| 297 | |||
| 298 | Element extend-project | ||
| 299 | ---------------------- | ||
| 300 | |||
| 301 | Modify the attributes of the named project. | ||
| 302 | |||
| 303 | This element is mostly useful in a local manifest file, to modify the | ||
| 304 | attributes of an existing project without completely replacing the | ||
| 305 | existing project definition. This makes the local manifest more robust | ||
| 306 | against changes to the original manifest. | ||
| 307 | |||
| 308 | Attribute `path`: If specified, limit the change to projects checked out | ||
| 309 | at the specified path, rather than all projects with the given name. | ||
| 310 | |||
| 311 | Attribute `groups`: List of additional groups to which this project | ||
| 312 | belongs. Same syntax as the corresponding element of `project`. | ||
| 313 | |||
| 314 | Attribute `revision`: If specified, overrides the revision of the original | ||
| 315 | project. Same syntax as the corresponding element of `project`. | ||
| 316 | |||
| 317 | Element annotation | ||
| 318 | ------------------ | ||
| 319 | |||
| 320 | Zero or more annotation elements may be specified as children of a | ||
| 321 | project element. Each element describes a name-value pair that will be | ||
| 322 | exported into each project's environment during a 'forall' command, | ||
| 323 | prefixed with REPO__. In addition, there is an optional attribute | ||
| 324 | "keep" which accepts the case insensitive values "true" (default) or | ||
| 325 | "false". This attribute determines whether or not the annotation will | ||
| 326 | be kept when exported with the manifest subcommand. | ||
| 327 | |||
| 328 | Element copyfile | ||
| 329 | ---------------- | ||
| 330 | |||
| 331 | Zero or more copyfile elements may be specified as children of a | ||
| 332 | project element. Each element describes a src-dest pair of files; | ||
| 333 | the "src" file will be copied to the "dest" place during `repo sync` | ||
| 334 | command. | ||
| 335 | "src" is project relative, "dest" is relative to the top of the tree. | ||
| 336 | |||
| 337 | Element linkfile | ||
| 338 | ---------------- | ||
| 339 | |||
| 340 | It's just like copyfile and runs at the same time as copyfile but | ||
| 341 | instead of copying it creates a symlink. | ||
| 342 | |||
| 343 | Element remove-project | ||
| 344 | ---------------------- | ||
| 345 | |||
| 346 | Deletes the named project from the internal manifest table, possibly | ||
| 347 | allowing a subsequent project element in the same manifest file to | ||
| 348 | replace the project with a different source. | ||
| 349 | |||
| 350 | This element is mostly useful in a local manifest file, where | ||
| 351 | the user can remove a project, and possibly replace it with their | ||
| 352 | own definition. | ||
| 353 | |||
| 354 | Element include | ||
| 355 | --------------- | ||
| 356 | |||
| 357 | This element provides the capability of including another manifest | ||
| 358 | file into the originating manifest. Normal rules apply for the | ||
| 359 | target manifest to include - it must be a usable manifest on its own. | ||
| 360 | |||
| 361 | Attribute `name`: the manifest to include, specified relative to | ||
| 362 | the manifest repository's root. | ||
| 363 | |||
| 364 | |||
| 365 | Local Manifests | ||
| 366 | =============== | ||
| 367 | |||
| 368 | Additional remotes and projects may be added through local manifest | ||
| 369 | files stored in `$TOP_DIR/.repo/local_manifests/*.xml`. | ||
| 370 | |||
| 371 | For example: | ||
| 372 | |||
| 373 | $ ls .repo/local_manifests | ||
| 374 | local_manifest.xml | ||
| 375 | another_local_manifest.xml | ||
| 376 | |||
| 377 | $ cat .repo/local_manifests/local_manifest.xml | ||
| 378 | <?xml version="1.0" encoding="UTF-8"?> | ||
| 379 | <manifest> | ||
| 380 | <project path="manifest" | ||
| 381 | name="tools/manifest" /> | ||
| 382 | <project path="platform-manifest" | ||
| 383 | name="platform/manifest" /> | ||
| 384 | </manifest> | ||
| 385 | |||
| 386 | Users may add projects to the local manifest(s) prior to a `repo sync` | ||
| 387 | invocation, instructing repo to automatically download and manage | ||
| 388 | these extra projects. | ||
| 389 | |||
| 390 | Manifest files stored in `$TOP_DIR/.repo/local_manifests/*.xml` will | ||
| 391 | be loaded in alphabetical order. | ||
| 392 | |||
| 393 | Additional remotes and projects may also be added through a local | ||
| 394 | manifest, stored in `$TOP_DIR/.repo/local_manifest.xml`. This method | ||
| 395 | is deprecated in favor of using multiple manifest files as mentioned | ||
| 396 | above. | ||
| 397 | |||
| 398 | If `$TOP_DIR/.repo/local_manifest.xml` exists, it will be loaded before | ||
| 399 | any manifest files stored in `$TOP_DIR/.repo/local_manifests/*.xml`. | ||
