blob: d776a81bd45d663c85d948851c0b7b4ab554df0d [file] [log] [blame] [view]
Mike Frysingerb8f7bb02018-10-10 01:05:11 -04001# repo Manifest Format
Shawn O. Pearce3e548192008-11-04 11:19:36 -08002
3A repo manifest describes the structure of a repo client; that is
4the directories that are visible and where they should be obtained
5from with git.
6
7The basic structure of a manifest is a bare Git repository holding
Mike Frysinger3891b752018-10-05 19:26:15 -04008a single `default.xml` XML file in the top level directory.
Shawn O. Pearce3e548192008-11-04 11:19:36 -08009
10Manifests are inherently version controlled, since they are kept
11within a Git repository. Updates to manifests are automatically
12obtained by clients during `repo sync`.
13
Mike Frysinger3891b752018-10-05 19:26:15 -040014[TOC]
15
Shawn O. Pearce3e548192008-11-04 11:19:36 -080016
Mike Frysingerb8f7bb02018-10-10 01:05:11 -040017## XML File Format
Shawn O. Pearce3e548192008-11-04 11:19:36 -080018
Mike Frysinger3891b752018-10-05 19:26:15 -040019A manifest XML file (e.g. `default.xml`) roughly conforms to the
Shawn O. Pearce3e548192008-11-04 11:19:36 -080020following DTD:
21
Mike Frysinger3891b752018-10-05 19:26:15 -040022```xml
23<!DOCTYPE manifest [
24 <!ELEMENT manifest (notice?,
25 remote*,
26 default?,
27 manifest-server?,
28 remove-project*,
29 project*,
30 extend-project*,
31 repo-hooks?,
32 include*)>
Chirayu Desaid5a5b192013-11-21 19:15:30 +053033
Mike Frysinger3891b752018-10-05 19:26:15 -040034 <!ELEMENT notice (#PCDATA)>
Chirayu Desaid5a5b192013-11-21 19:15:30 +053035
Mike Frysinger3891b752018-10-05 19:26:15 -040036 <!ELEMENT remote EMPTY>
37 <!ATTLIST remote name ID #REQUIRED>
38 <!ATTLIST remote alias CDATA #IMPLIED>
39 <!ATTLIST remote fetch CDATA #REQUIRED>
40 <!ATTLIST remote pushurl CDATA #IMPLIED>
41 <!ATTLIST remote review CDATA #IMPLIED>
42 <!ATTLIST remote revision CDATA #IMPLIED>
Chirayu Desaid5a5b192013-11-21 19:15:30 +053043
Mike Frysinger3891b752018-10-05 19:26:15 -040044 <!ELEMENT default EMPTY>
45 <!ATTLIST default remote IDREF #IMPLIED>
46 <!ATTLIST default revision CDATA #IMPLIED>
47 <!ATTLIST default dest-branch CDATA #IMPLIED>
48 <!ATTLIST default upstream CDATA #IMPLIED>
49 <!ATTLIST default sync-j CDATA #IMPLIED>
50 <!ATTLIST default sync-c CDATA #IMPLIED>
51 <!ATTLIST default sync-s CDATA #IMPLIED>
52 <!ATTLIST default sync-tags CDATA #IMPLIED>
Nico Sallembiena1bfd2c2010-04-06 10:40:01 -070053
Mike Frysinger3891b752018-10-05 19:26:15 -040054 <!ELEMENT manifest-server EMPTY>
55 <!ATTLIST manifest-server url CDATA #REQUIRED>
Chirayu Desaid5a5b192013-11-21 19:15:30 +053056
Mike Frysinger3891b752018-10-05 19:26:15 -040057 <!ELEMENT project (annotation*,
58 project*,
59 copyfile*,
60 linkfile*)>
61 <!ATTLIST project name CDATA #REQUIRED>
62 <!ATTLIST project path CDATA #IMPLIED>
63 <!ATTLIST project remote IDREF #IMPLIED>
64 <!ATTLIST project revision CDATA #IMPLIED>
65 <!ATTLIST project dest-branch CDATA #IMPLIED>
66 <!ATTLIST project groups CDATA #IMPLIED>
67 <!ATTLIST project sync-c CDATA #IMPLIED>
68 <!ATTLIST project sync-s CDATA #IMPLIED>
Kyunam Jo01019d92019-03-18 13:30:58 +090069 <!ATTLIST project sync-tags CDATA #IMPLIED>
Mike Frysinger3891b752018-10-05 19:26:15 -040070 <!ATTLIST project upstream CDATA #IMPLIED>
71 <!ATTLIST project clone-depth CDATA #IMPLIED>
72 <!ATTLIST project force-path CDATA #IMPLIED>
James W. Mills24c13082012-04-12 15:04:13 -050073
Mike Frysinger3891b752018-10-05 19:26:15 -040074 <!ELEMENT annotation EMPTY>
75 <!ATTLIST annotation name CDATA #REQUIRED>
76 <!ATTLIST annotation value CDATA #REQUIRED>
77 <!ATTLIST annotation keep CDATA "true">
Chirayu Desaid5a5b192013-11-21 19:15:30 +053078
Mike Frysinger3891b752018-10-05 19:26:15 -040079 <!ELEMENT copyfile EMPTY>
80 <!ATTLIST copyfile src CDATA #REQUIRED>
81 <!ATTLIST copyfile dest CDATA #REQUIRED>
Ruslan Bilovol54527e72015-09-08 13:11:23 +030082
Mike Frysinger3891b752018-10-05 19:26:15 -040083 <!ELEMENT linkfile EMPTY>
84 <!ATTLIST linkfile src CDATA #REQUIRED>
85 <!ATTLIST linkfile dest CDATA #REQUIRED>
Ruslan Bilovol54527e72015-09-08 13:11:23 +030086
Mike Frysinger3891b752018-10-05 19:26:15 -040087 <!ELEMENT extend-project EMPTY>
88 <!ATTLIST extend-project name CDATA #REQUIRED>
89 <!ATTLIST extend-project path CDATA #IMPLIED>
90 <!ATTLIST extend-project groups CDATA #IMPLIED>
91 <!ATTLIST extend-project revision CDATA #IMPLIED>
Josh Triplett884a3872014-06-12 14:57:29 -070092
Mike Frysinger3891b752018-10-05 19:26:15 -040093 <!ELEMENT remove-project EMPTY>
94 <!ATTLIST remove-project name CDATA #REQUIRED>
Doug Anderson37282b42011-03-04 11:54:18 -080095
Mike Frysinger3891b752018-10-05 19:26:15 -040096 <!ELEMENT repo-hooks EMPTY>
97 <!ATTLIST repo-hooks in-project CDATA #REQUIRED>
98 <!ATTLIST repo-hooks enabled-list CDATA #REQUIRED>
Brian Harring26448742011-04-28 05:04:41 -070099
Mike Frysinger3891b752018-10-05 19:26:15 -0400100 <!ELEMENT include EMPTY>
101 <!ATTLIST include name CDATA #REQUIRED>
102]>
103```
Shawn O. Pearce3e548192008-11-04 11:19:36 -0800104
105A description of the elements and their attributes follows.
106
107
Mike Frysingerb8f7bb02018-10-10 01:05:11 -0400108### Element manifest
Shawn O. Pearce3e548192008-11-04 11:19:36 -0800109
110The root element of the file.
111
112
Mike Frysingerb8f7bb02018-10-10 01:05:11 -0400113### Element remote
Shawn O. Pearce3e548192008-11-04 11:19:36 -0800114
115One or more remote elements may be specified. Each remote element
116specifies a Git URL shared by one or more projects and (optionally)
117the Gerrit review server those projects upload changes through.
118
119Attribute `name`: A short name unique to this manifest file. The
120name specified here is used as the remote name in each project's
121.git/config, and is therefore automatically available to commands
122like `git fetch`, `git remote`, `git pull` and `git push`.
123
Yestin Sunb292b982012-07-02 07:32:50 -0700124Attribute `alias`: The alias, if specified, is used to override
125`name` to be set as the remote name in each project's .git/config.
126Its value can be duplicated while attribute `name` has to be unique
127in the manifest file. This helps each project to be able to have
128same remote name which actually points to different remote url.
129
Shawn O. Pearce3e548192008-11-04 11:19:36 -0800130Attribute `fetch`: The Git URL prefix for all projects which use
131this remote. Each project's name is appended to this prefix to
132form the actual URL used to clone the project.
133
Steve Raed6480452016-08-10 15:00:00 -0700134Attribute `pushurl`: The Git "push" URL prefix for all projects
135which use this remote. Each project's name is appended to this
136prefix to form the actual URL used to "git push" the project.
137This attribute is optional; if not specified then "git push"
138will use the same URL as the `fetch` attribute.
139
Shawn O. Pearce3e548192008-11-04 11:19:36 -0800140Attribute `review`: Hostname of the Gerrit server where reviews
141are uploaded to by `repo upload`. This attribute is optional;
142if not specified then `repo upload` will not function.
143
Anthony King36ea2fb2014-05-06 11:54:01 +0100144Attribute `revision`: Name of a Git branch (e.g. `master` or
145`refs/heads/master`). Remotes with their own revision will override
146the default revision.
147
Mike Frysingerb8f7bb02018-10-10 01:05:11 -0400148### Element default
Shawn O. Pearce3e548192008-11-04 11:19:36 -0800149
150At most one default element may be specified. Its remote and
151revision attributes are used when a project element does not
152specify its own remote or revision attribute.
153
154Attribute `remote`: Name of a previously defined remote element.
155Project elements lacking a remote attribute of their own will use
156this remote.
157
158Attribute `revision`: Name of a Git branch (e.g. `master` or
159`refs/heads/master`). Project elements lacking their own
160revision attribute will use this revision.
161
Bryan Jacobsf609f912013-05-06 13:36:24 -0400162Attribute `dest-branch`: Name of a Git branch (e.g. `master`).
163Project elements not setting their own `dest-branch` will inherit
164this value. If this value is not set, projects will use `revision`
165by default instead.
166
Nasser Grainawida403412018-05-04 12:53:29 -0600167Attribute `upstream`: Name of the Git ref in which a sha1
168can be found. Used when syncing a revision locked manifest in
169-c mode to avoid having to sync the entire ref space. Project elements
170not setting their own `upstream` will inherit this value.
171
Mani Chandel7a91d512014-07-24 16:27:08 +0530172Attribute `sync-j`: Number of parallel jobs to use when synching.
David Pursehouse4e465202012-11-27 22:20:10 +0900173
Mani Chandel7a91d512014-07-24 16:27:08 +0530174Attribute `sync-c`: Set to true to only sync the given Git
David Pursehouse4e465202012-11-27 22:20:10 +0900175branch (specified in the `revision` attribute) rather than the
Mani Chandel7a91d512014-07-24 16:27:08 +0530176whole ref space. Project elements lacking a sync-c element of
David Pursehouse4e465202012-11-27 22:20:10 +0900177their own will use this value.
178
Mani Chandel7a91d512014-07-24 16:27:08 +0530179Attribute `sync-s`: Set to true to also sync sub-projects.
David Pursehouse4e465202012-11-27 22:20:10 +0900180
YOUNG HO CHAa32c92c2018-02-14 16:57:31 +0900181Attribute `sync-tags`: Set to false to only sync the given Git
182branch (specified in the `revision` attribute) rather than
183the other ref tags.
184
Shawn O. Pearce3e548192008-11-04 11:19:36 -0800185
Mike Frysingerb8f7bb02018-10-10 01:05:11 -0400186### Element manifest-server
Nico Sallembiena1bfd2c2010-04-06 10:40:01 -0700187
188At most one manifest-server may be specified. The url attribute
189is used to specify the URL of a manifest server, which is an
David Pursehouse9a27d012012-08-21 14:23:49 +0900190XML RPC service.
Nico Sallembiena1bfd2c2010-04-06 10:40:01 -0700191
David Pursehouse9a27d012012-08-21 14:23:49 +0900192The manifest server should implement the following RPC methods:
Nico Sallembiena1bfd2c2010-04-06 10:40:01 -0700193
Mike Frysinger3891b752018-10-05 19:26:15 -0400194 GetApprovedManifest(branch, target)
Nico Sallembiena1bfd2c2010-04-06 10:40:01 -0700195
David Pursehouse9a27d012012-08-21 14:23:49 +0900196Return a manifest in which each project is pegged to a known good revision
David Pursehousee8688412016-04-13 17:55:34 +0900197for the current branch and target. This is used by repo sync when the
198--smart-sync option is given.
David Pursehouse9a27d012012-08-21 14:23:49 +0900199
Nico Sallembiena1bfd2c2010-04-06 10:40:01 -0700200The target to use is defined by environment variables TARGET_PRODUCT
201and TARGET_BUILD_VARIANT. These variables are used to create a string
202of the form $TARGET_PRODUCT-$TARGET_BUILD_VARIANT, e.g. passion-userdebug.
203If one of those variables or both are not present, the program will call
David Pursehousedaa851f2012-08-21 13:52:18 +0900204GetApprovedManifest without the target parameter and the manifest server
Nico Sallembiena1bfd2c2010-04-06 10:40:01 -0700205should choose a reasonable default target.
206
Mike Frysinger3891b752018-10-05 19:26:15 -0400207 GetManifest(tag)
David Pursehouse9a27d012012-08-21 14:23:49 +0900208
209Return a manifest in which each project is pegged to the revision at
David Pursehousee8688412016-04-13 17:55:34 +0900210the specified tag. This is used by repo sync when the --smart-tag option
211is given.
David Pursehouse9a27d012012-08-21 14:23:49 +0900212
Nico Sallembiena1bfd2c2010-04-06 10:40:01 -0700213
Mike Frysingerb8f7bb02018-10-10 01:05:11 -0400214### Element project
Shawn O. Pearce3e548192008-11-04 11:19:36 -0800215
216One or more project elements may be specified. Each element
217describes a single Git repository to be cloned into the repo
Che-Liang Chioub2bd91c2012-01-11 11:28:42 +0800218client workspace. You may specify Git-submodules by creating a
219nested project. Git-submodules will be automatically
220recognized and inherit their parent's attributes, but those
221may be overridden by an explicitly specified project element.
Shawn O. Pearce3e548192008-11-04 11:19:36 -0800222
223Attribute `name`: A unique name for this project. The project's
224name is appended onto its remote's fetch URL to generate the actual
225URL to configure the Git remote with. The URL gets formed as:
226
Mike Frysinger3891b752018-10-05 19:26:15 -0400227 ${remote_fetch}/${project_name}.git
Shawn O. Pearce3e548192008-11-04 11:19:36 -0800228
229where ${remote_fetch} is the remote's fetch attribute and
230${project_name} is the project's name attribute. The suffix ".git"
David Pursehousedaa851f2012-08-21 13:52:18 +0900231is always appended as repo assumes the upstream is a forest of
Che-Liang Chioub2bd91c2012-01-11 11:28:42 +0800232bare Git repositories. If the project has a parent element, its
233name will be prefixed by the parent's.
Shawn O. Pearce3e548192008-11-04 11:19:36 -0800234
235The project name must match the name Gerrit knows, if Gerrit is
236being used for code reviews.
237
238Attribute `path`: An optional path relative to the top directory
239of the repo client where the Git working directory for this project
240should be placed. If not supplied the project name is used.
Che-Liang Chioub2bd91c2012-01-11 11:28:42 +0800241If the project has a parent element, its path will be prefixed
242by the parent's.
Shawn O. Pearce3e548192008-11-04 11:19:36 -0800243
244Attribute `remote`: Name of a previously defined remote element.
245If not supplied the remote given by the default element is used.
246
247Attribute `revision`: Name of the Git branch the manifest wants
248to track for this project. Names can be relative to refs/heads
249(e.g. just "master") or absolute (e.g. "refs/heads/master").
250Tags and/or explicit SHA-1s should work in theory, but have not
251been extensively tested. If not supplied the revision given by
Anthony King36ea2fb2014-05-06 11:54:01 +0100252the remote element is used if applicable, else the default
253element is used.
Shawn O. Pearce3e548192008-11-04 11:19:36 -0800254
Bryan Jacobsf609f912013-05-06 13:36:24 -0400255Attribute `dest-branch`: Name of a Git branch (e.g. `master`).
256When using `repo upload`, changes will be submitted for code
257review on this branch. If unspecified both here and in the
258default element, `revision` is used instead.
259
Colin Cross5acde752012-03-28 20:15:45 -0700260Attribute `groups`: List of groups to which this project belongs,
Conley Owens971de8e2012-04-16 10:36:08 -0700261whitespace or comma separated. All projects belong to the group
Conley Owensbb1b5f52012-08-13 13:11:18 -0700262"all", and each project automatically belongs to a group of
263its name:`name` and path:`path`. E.g. for
Brian Harring7da13142012-06-15 02:24:20 -0700264<project name="monkeys" path="barrel-of"/>, that project
265definition is implicitly in the following manifest groups:
Conley Owensbb1b5f52012-08-13 13:11:18 -0700266default, name:monkeys, and path:barrel-of. If you place a project in the
267group "notdefault", it will not be automatically downloaded by repo.
Che-Liang Chioub2bd91c2012-01-11 11:28:42 +0800268If the project has a parent element, the `name` and `path` here
269are the prefixed ones.
Colin Cross5acde752012-03-28 20:15:45 -0700270
Mani Chandel7a91d512014-07-24 16:27:08 +0530271Attribute `sync-c`: Set to true to only sync the given Git
David Pursehouse4e465202012-11-27 22:20:10 +0900272branch (specified in the `revision` attribute) rather than the
273whole ref space.
274
Mani Chandel7a91d512014-07-24 16:27:08 +0530275Attribute `sync-s`: Set to true to also sync sub-projects.
David Pursehouse4e465202012-11-27 22:20:10 +0900276
Nasser Grainawi909d58b2014-09-19 12:13:04 -0600277Attribute `upstream`: Name of the Git ref in which a sha1
David Pursehouse4e465202012-11-27 22:20:10 +0900278can be found. Used when syncing a revision locked manifest in
279-c mode to avoid having to sync the entire ref space.
280
David Pursehouseede7f122012-11-27 22:25:30 +0900281Attribute `clone-depth`: Set the depth to use when fetching this
282project. If specified, this value will override any value given
283to repo init with the --depth option on the command line.
284
Scott Fandb83b1b2013-02-28 09:34:14 +0800285Attribute `force-path`: Set to true to force this project to create the
286local mirror repository according to its `path` attribute (if supplied)
287rather than the `name` attribute. This attribute only applies to the
288local mirrors syncing, it will be ignored when syncing the projects in a
289client working directory.
290
Mike Frysingerb8f7bb02018-10-10 01:05:11 -0400291### Element extend-project
Josh Triplett884a3872014-06-12 14:57:29 -0700292
293Modify the attributes of the named project.
294
295This element is mostly useful in a local manifest file, to modify the
296attributes of an existing project without completely replacing the
297existing project definition. This makes the local manifest more robust
298against changes to the original manifest.
299
300Attribute `path`: If specified, limit the change to projects checked out
301at the specified path, rather than all projects with the given name.
302
303Attribute `groups`: List of additional groups to which this project
304belongs. Same syntax as the corresponding element of `project`.
305
Luis Hector Chavez7d525852018-03-15 09:54:08 -0700306Attribute `revision`: If specified, overrides the revision of the original
307project. Same syntax as the corresponding element of `project`.
308
Mike Frysingerb8f7bb02018-10-10 01:05:11 -0400309### Element annotation
James W. Mills24c13082012-04-12 15:04:13 -0500310
311Zero or more annotation elements may be specified as children of a
312project element. Each element describes a name-value pair that will be
313exported into each project's environment during a 'forall' command,
314prefixed with REPO__. In addition, there is an optional attribute
315"keep" which accepts the case insensitive values "true" (default) or
316"false". This attribute determines whether or not the annotation will
317be kept when exported with the manifest subcommand.
318
Mike Frysingerb8f7bb02018-10-10 01:05:11 -0400319### Element copyfile
Ruslan Bilovol54527e72015-09-08 13:11:23 +0300320
321Zero or more copyfile elements may be specified as children of a
322project element. Each element describes a src-dest pair of files;
Mike Frysinger3891b752018-10-05 19:26:15 -0400323the "src" file will be copied to the "dest" place during `repo sync`
Ruslan Bilovol54527e72015-09-08 13:11:23 +0300324command.
325"src" is project relative, "dest" is relative to the top of the tree.
326
Mike Frysingerb8f7bb02018-10-10 01:05:11 -0400327### Element linkfile
Ruslan Bilovol54527e72015-09-08 13:11:23 +0300328
329It's just like copyfile and runs at the same time as copyfile but
330instead of copying it creates a symlink.
331
Mike Frysingerb8f7bb02018-10-10 01:05:11 -0400332### Element remove-project
Shawn O. Pearce03eaf072008-11-20 11:42:22 -0800333
334Deletes the named project from the internal manifest table, possibly
335allowing a subsequent project element in the same manifest file to
336replace the project with a different source.
337
David Pursehouseb1525bf2012-11-14 08:51:38 +0900338This element is mostly useful in a local manifest file, where
Shawn O. Pearce03eaf072008-11-20 11:42:22 -0800339the user can remove a project, and possibly replace it with their
340own definition.
341
Mike Frysingerb8f7bb02018-10-10 01:05:11 -0400342### Element include
Brian Harring26448742011-04-28 05:04:41 -0700343
344This element provides the capability of including another manifest
345file into the originating manifest. Normal rules apply for the
David Pursehouse9f3406e2012-11-14 08:52:25 +0900346target manifest to include - it must be a usable manifest on its own.
Brian Harring26448742011-04-28 05:04:41 -0700347
David Pursehouse9f3406e2012-11-14 08:52:25 +0900348Attribute `name`: the manifest to include, specified relative to
349the manifest repository's root.
Brian Harring26448742011-04-28 05:04:41 -0700350
Shawn O. Pearce03eaf072008-11-20 11:42:22 -0800351
Mike Frysingerb8f7bb02018-10-10 01:05:11 -0400352## Local Manifests
Shawn O. Pearce70cd4ab2008-11-06 08:48:44 -0800353
David Pursehouse2d5a0df2012-11-13 02:50:36 +0900354Additional remotes and projects may be added through local manifest
355files stored in `$TOP_DIR/.repo/local_manifests/*.xml`.
Shawn O. Pearce70cd4ab2008-11-06 08:48:44 -0800356
357For example:
358
Mike Frysinger3891b752018-10-05 19:26:15 -0400359 $ ls .repo/local_manifests
360 local_manifest.xml
361 another_local_manifest.xml
David Pursehouse2d5a0df2012-11-13 02:50:36 +0900362
Mike Frysinger3891b752018-10-05 19:26:15 -0400363 $ cat .repo/local_manifests/local_manifest.xml
364 <?xml version="1.0" encoding="UTF-8"?>
365 <manifest>
366 <project path="manifest"
367 name="tools/manifest" />
368 <project path="platform-manifest"
369 name="platform/manifest" />
370 </manifest>
Shawn O. Pearce70cd4ab2008-11-06 08:48:44 -0800371
David Pursehouse2d5a0df2012-11-13 02:50:36 +0900372Users may add projects to the local manifest(s) prior to a `repo sync`
Shawn O. Pearce70cd4ab2008-11-06 08:48:44 -0800373invocation, instructing repo to automatically download and manage
374these extra projects.
David Pursehouse2d5a0df2012-11-13 02:50:36 +0900375
David Pursehouse52f1e5d2012-11-14 04:53:24 +0900376Manifest files stored in `$TOP_DIR/.repo/local_manifests/*.xml` will
377be loaded in alphabetical order.
378
David Pursehouse2d5a0df2012-11-13 02:50:36 +0900379Additional remotes and projects may also be added through a local
David Pursehouse5566ae52012-11-13 03:04:18 +0900380manifest, stored in `$TOP_DIR/.repo/local_manifest.xml`. This method
381is deprecated in favor of using multiple manifest files as mentioned
382above.
David Pursehouse52f1e5d2012-11-14 04:53:24 +0900383
384If `$TOP_DIR/.repo/local_manifest.xml` exists, it will be loaded before
385any manifest files stored in `$TOP_DIR/.repo/local_manifests/*.xml`.