Shawn O. Pearce | 3e54819 | 2008-11-04 11:19:36 -0800 | [diff] [blame] | 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 | |
| 16 | XML File Format |
| 17 | --------------- |
| 18 | |
| 19 | A manifest XML file (e.g. 'default.xml') roughly conforms to the |
| 20 | following DTD: |
| 21 | |
Shawn O. Pearce | 43c3d9e | 2009-03-04 14:26:50 -0800 | [diff] [blame] | 22 | <!DOCTYPE manifest [ |
Doug Anderson | 2b8db3c | 2010-11-01 15:08:06 -0700 | [diff] [blame] | 23 | <!ELEMENT manifest (notice?, |
| 24 | remote*, |
Shawn O. Pearce | 43c3d9e | 2009-03-04 14:26:50 -0800 | [diff] [blame] | 25 | default?, |
Nico Sallembien | a1bfd2c | 2010-04-06 10:40:01 -0700 | [diff] [blame] | 26 | manifest-server?, |
Shawn O. Pearce | 43c3d9e | 2009-03-04 14:26:50 -0800 | [diff] [blame] | 27 | remove-project*, |
Doug Anderson | 37282b4 | 2011-03-04 11:54:18 -0800 | [diff] [blame] | 28 | project*, |
| 29 | repo-hooks?)> |
Shawn O. Pearce | 43c3d9e | 2009-03-04 14:26:50 -0800 | [diff] [blame] | 30 | |
Doug Anderson | 2b8db3c | 2010-11-01 15:08:06 -0700 | [diff] [blame] | 31 | <!ELEMENT notice (#PCDATA)> |
| 32 | |
Shawn O. Pearce | 43c3d9e | 2009-03-04 14:26:50 -0800 | [diff] [blame] | 33 | <!ELEMENT remote (EMPTY)> |
| 34 | <!ATTLIST remote name ID #REQUIRED> |
Yestin Sun | b292b98 | 2012-07-02 07:32:50 -0700 | [diff] [blame] | 35 | <!ATTLIST remote alias CDATA #IMPLIED> |
Shawn O. Pearce | 43c3d9e | 2009-03-04 14:26:50 -0800 | [diff] [blame] | 36 | <!ATTLIST remote fetch CDATA #REQUIRED> |
| 37 | <!ATTLIST remote review CDATA #IMPLIED> |
Shawn O. Pearce | 43c3d9e | 2009-03-04 14:26:50 -0800 | [diff] [blame] | 38 | |
| 39 | <!ELEMENT default (EMPTY)> |
| 40 | <!ATTLIST default remote IDREF #IMPLIED> |
| 41 | <!ATTLIST default revision CDATA #IMPLIED> |
Shawn O. Pearce | 6392c87 | 2011-09-22 17:44:31 -0700 | [diff] [blame] | 42 | <!ATTLIST default sync-j CDATA #IMPLIED> |
Anatol Pomazau | 79770d2 | 2012-04-20 14:41:59 -0700 | [diff] [blame] | 43 | <!ATTLIST default sync-c CDATA #IMPLIED> |
Nico Sallembien | a1bfd2c | 2010-04-06 10:40:01 -0700 | [diff] [blame] | 44 | |
| 45 | <!ELEMENT manifest-server (EMPTY)> |
| 46 | <!ATTLIST url CDATA #REQUIRED> |
Shawn O. Pearce | 43c3d9e | 2009-03-04 14:26:50 -0800 | [diff] [blame] | 47 | |
Che-Liang Chiou | 69998b0 | 2012-01-11 11:28:42 +0800 | [diff] [blame] | 48 | <!ELEMENT project (annotation?, |
| 49 | project*)> |
Shawn O. Pearce | 43c3d9e | 2009-03-04 14:26:50 -0800 | [diff] [blame] | 50 | <!ATTLIST project name CDATA #REQUIRED> |
| 51 | <!ATTLIST project path CDATA #IMPLIED> |
| 52 | <!ATTLIST project remote IDREF #IMPLIED> |
| 53 | <!ATTLIST project revision CDATA #IMPLIED> |
Colin Cross | 5acde75 | 2012-03-28 20:15:45 -0700 | [diff] [blame] | 54 | <!ATTLIST project groups CDATA #IMPLIED> |
Anatol Pomazau | 79770d2 | 2012-04-20 14:41:59 -0700 | [diff] [blame] | 55 | <!ATTLIST project sync-c CDATA #IMPLIED> |
James W. Mills | 24c1308 | 2012-04-12 15:04:13 -0500 | [diff] [blame] | 56 | |
| 57 | <!ELEMENT annotation (EMPTY)> |
| 58 | <!ATTLIST annotation name CDATA #REQUIRED> |
| 59 | <!ATTLIST annotation value CDATA #REQUIRED> |
| 60 | <!ATTLIST annotation keep CDATA "true"> |
Shawn O. Pearce | 43c3d9e | 2009-03-04 14:26:50 -0800 | [diff] [blame] | 61 | |
Shawn O. Pearce | 43c3d9e | 2009-03-04 14:26:50 -0800 | [diff] [blame] | 62 | <!ELEMENT remove-project (EMPTY)> |
| 63 | <!ATTLIST remove-project name CDATA #REQUIRED> |
Doug Anderson | 37282b4 | 2011-03-04 11:54:18 -0800 | [diff] [blame] | 64 | |
| 65 | <!ELEMENT repo-hooks (EMPTY)> |
| 66 | <!ATTLIST repo-hooks in-project CDATA #REQUIRED> |
| 67 | <!ATTLIST repo-hooks enabled-list CDATA #REQUIRED> |
Brian Harring | 2644874 | 2011-04-28 05:04:41 -0700 | [diff] [blame] | 68 | |
| 69 | <!ELEMENT include (EMPTY)> |
| 70 | <!ATTLIST include name CDATA #REQUIRED> |
Shawn O. Pearce | 43c3d9e | 2009-03-04 14:26:50 -0800 | [diff] [blame] | 71 | ]> |
Shawn O. Pearce | 3e54819 | 2008-11-04 11:19:36 -0800 | [diff] [blame] | 72 | |
| 73 | A description of the elements and their attributes follows. |
| 74 | |
| 75 | |
| 76 | Element manifest |
| 77 | ---------------- |
| 78 | |
| 79 | The root element of the file. |
| 80 | |
| 81 | |
| 82 | Element remote |
| 83 | -------------- |
| 84 | |
| 85 | One or more remote elements may be specified. Each remote element |
| 86 | specifies a Git URL shared by one or more projects and (optionally) |
| 87 | the Gerrit review server those projects upload changes through. |
| 88 | |
| 89 | Attribute `name`: A short name unique to this manifest file. The |
| 90 | name specified here is used as the remote name in each project's |
| 91 | .git/config, and is therefore automatically available to commands |
| 92 | like `git fetch`, `git remote`, `git pull` and `git push`. |
| 93 | |
Yestin Sun | b292b98 | 2012-07-02 07:32:50 -0700 | [diff] [blame] | 94 | Attribute `alias`: The alias, if specified, is used to override |
| 95 | `name` to be set as the remote name in each project's .git/config. |
| 96 | Its value can be duplicated while attribute `name` has to be unique |
| 97 | in the manifest file. This helps each project to be able to have |
| 98 | same remote name which actually points to different remote url. |
| 99 | |
Shawn O. Pearce | 3e54819 | 2008-11-04 11:19:36 -0800 | [diff] [blame] | 100 | Attribute `fetch`: The Git URL prefix for all projects which use |
| 101 | this remote. Each project's name is appended to this prefix to |
| 102 | form the actual URL used to clone the project. |
| 103 | |
| 104 | Attribute `review`: Hostname of the Gerrit server where reviews |
| 105 | are uploaded to by `repo upload`. This attribute is optional; |
| 106 | if not specified then `repo upload` will not function. |
| 107 | |
Shawn O. Pearce | 3e54819 | 2008-11-04 11:19:36 -0800 | [diff] [blame] | 108 | Element default |
| 109 | --------------- |
| 110 | |
| 111 | At most one default element may be specified. Its remote and |
| 112 | revision attributes are used when a project element does not |
| 113 | specify its own remote or revision attribute. |
| 114 | |
| 115 | Attribute `remote`: Name of a previously defined remote element. |
| 116 | Project elements lacking a remote attribute of their own will use |
| 117 | this remote. |
| 118 | |
| 119 | Attribute `revision`: Name of a Git branch (e.g. `master` or |
| 120 | `refs/heads/master`). Project elements lacking their own |
| 121 | revision attribute will use this revision. |
| 122 | |
| 123 | |
Nico Sallembien | a1bfd2c | 2010-04-06 10:40:01 -0700 | [diff] [blame] | 124 | Element manifest-server |
| 125 | ----------------------- |
| 126 | |
| 127 | At most one manifest-server may be specified. The url attribute |
| 128 | is used to specify the URL of a manifest server, which is an |
David Pursehouse | 9a27d01 | 2012-08-21 14:23:49 +0900 | [diff] [blame] | 129 | XML RPC service. |
Nico Sallembien | a1bfd2c | 2010-04-06 10:40:01 -0700 | [diff] [blame] | 130 | |
David Pursehouse | 9a27d01 | 2012-08-21 14:23:49 +0900 | [diff] [blame] | 131 | The manifest server should implement the following RPC methods: |
Nico Sallembien | a1bfd2c | 2010-04-06 10:40:01 -0700 | [diff] [blame] | 132 | |
| 133 | GetApprovedManifest(branch, target) |
| 134 | |
David Pursehouse | 9a27d01 | 2012-08-21 14:23:49 +0900 | [diff] [blame] | 135 | Return a manifest in which each project is pegged to a known good revision |
| 136 | for the current branch and target. |
| 137 | |
Nico Sallembien | a1bfd2c | 2010-04-06 10:40:01 -0700 | [diff] [blame] | 138 | The target to use is defined by environment variables TARGET_PRODUCT |
| 139 | and TARGET_BUILD_VARIANT. These variables are used to create a string |
| 140 | of the form $TARGET_PRODUCT-$TARGET_BUILD_VARIANT, e.g. passion-userdebug. |
| 141 | If one of those variables or both are not present, the program will call |
David Pursehouse | daa851f | 2012-08-21 13:52:18 +0900 | [diff] [blame] | 142 | GetApprovedManifest without the target parameter and the manifest server |
Nico Sallembien | a1bfd2c | 2010-04-06 10:40:01 -0700 | [diff] [blame] | 143 | should choose a reasonable default target. |
| 144 | |
David Pursehouse | 9a27d01 | 2012-08-21 14:23:49 +0900 | [diff] [blame] | 145 | GetManifest(tag) |
| 146 | |
| 147 | Return a manifest in which each project is pegged to the revision at |
| 148 | the specified tag. |
| 149 | |
Nico Sallembien | a1bfd2c | 2010-04-06 10:40:01 -0700 | [diff] [blame] | 150 | |
Shawn O. Pearce | 3e54819 | 2008-11-04 11:19:36 -0800 | [diff] [blame] | 151 | Element project |
| 152 | --------------- |
| 153 | |
| 154 | One or more project elements may be specified. Each element |
| 155 | describes a single Git repository to be cloned into the repo |
Che-Liang Chiou | 69998b0 | 2012-01-11 11:28:42 +0800 | [diff] [blame] | 156 | client workspace. You may specify Git-submodules by creating a |
| 157 | nested project. Git-submodules will be automatically |
| 158 | recognized and inherit their parent's attributes, but those |
| 159 | may be overridden by an explicitly specified project element. |
Shawn O. Pearce | 3e54819 | 2008-11-04 11:19:36 -0800 | [diff] [blame] | 160 | |
| 161 | Attribute `name`: A unique name for this project. The project's |
| 162 | name is appended onto its remote's fetch URL to generate the actual |
| 163 | URL to configure the Git remote with. The URL gets formed as: |
| 164 | |
| 165 | ${remote_fetch}/${project_name}.git |
| 166 | |
| 167 | where ${remote_fetch} is the remote's fetch attribute and |
| 168 | ${project_name} is the project's name attribute. The suffix ".git" |
David Pursehouse | daa851f | 2012-08-21 13:52:18 +0900 | [diff] [blame] | 169 | is always appended as repo assumes the upstream is a forest of |
Che-Liang Chiou | 69998b0 | 2012-01-11 11:28:42 +0800 | [diff] [blame] | 170 | bare Git repositories. If the project has a parent element, its |
| 171 | name will be prefixed by the parent's. |
Shawn O. Pearce | 3e54819 | 2008-11-04 11:19:36 -0800 | [diff] [blame] | 172 | |
| 173 | The project name must match the name Gerrit knows, if Gerrit is |
| 174 | being used for code reviews. |
| 175 | |
| 176 | Attribute `path`: An optional path relative to the top directory |
| 177 | of the repo client where the Git working directory for this project |
| 178 | should be placed. If not supplied the project name is used. |
Che-Liang Chiou | 69998b0 | 2012-01-11 11:28:42 +0800 | [diff] [blame] | 179 | If the project has a parent element, its path will be prefixed |
| 180 | by the parent's. |
Shawn O. Pearce | 3e54819 | 2008-11-04 11:19:36 -0800 | [diff] [blame] | 181 | |
| 182 | Attribute `remote`: Name of a previously defined remote element. |
| 183 | If not supplied the remote given by the default element is used. |
| 184 | |
| 185 | Attribute `revision`: Name of the Git branch the manifest wants |
| 186 | to track for this project. Names can be relative to refs/heads |
| 187 | (e.g. just "master") or absolute (e.g. "refs/heads/master"). |
| 188 | Tags and/or explicit SHA-1s should work in theory, but have not |
| 189 | been extensively tested. If not supplied the revision given by |
| 190 | the default element is used. |
| 191 | |
Colin Cross | 5acde75 | 2012-03-28 20:15:45 -0700 | [diff] [blame] | 192 | Attribute `groups`: List of groups to which this project belongs, |
Conley Owens | 971de8e | 2012-04-16 10:36:08 -0700 | [diff] [blame] | 193 | whitespace or comma separated. All projects belong to the group |
Conley Owens | bb1b5f5 | 2012-08-13 13:11:18 -0700 | [diff] [blame] | 194 | "all", and each project automatically belongs to a group of |
| 195 | its name:`name` and path:`path`. E.g. for |
Brian Harring | 7da1314 | 2012-06-15 02:24:20 -0700 | [diff] [blame] | 196 | <project name="monkeys" path="barrel-of"/>, that project |
| 197 | definition is implicitly in the following manifest groups: |
Conley Owens | bb1b5f5 | 2012-08-13 13:11:18 -0700 | [diff] [blame] | 198 | default, name:monkeys, and path:barrel-of. If you place a project in the |
| 199 | group "notdefault", it will not be automatically downloaded by repo. |
Che-Liang Chiou | 69998b0 | 2012-01-11 11:28:42 +0800 | [diff] [blame] | 200 | If the project has a parent element, the `name` and `path` here |
| 201 | are the prefixed ones. |
Colin Cross | 5acde75 | 2012-03-28 20:15:45 -0700 | [diff] [blame] | 202 | |
James W. Mills | 24c1308 | 2012-04-12 15:04:13 -0500 | [diff] [blame] | 203 | Element annotation |
| 204 | ------------------ |
| 205 | |
| 206 | Zero or more annotation elements may be specified as children of a |
| 207 | project element. Each element describes a name-value pair that will be |
| 208 | exported into each project's environment during a 'forall' command, |
| 209 | prefixed with REPO__. In addition, there is an optional attribute |
| 210 | "keep" which accepts the case insensitive values "true" (default) or |
| 211 | "false". This attribute determines whether or not the annotation will |
| 212 | be kept when exported with the manifest subcommand. |
| 213 | |
Shawn O. Pearce | 03eaf07 | 2008-11-20 11:42:22 -0800 | [diff] [blame] | 214 | Element remove-project |
| 215 | ---------------------- |
| 216 | |
| 217 | Deletes the named project from the internal manifest table, possibly |
| 218 | allowing a subsequent project element in the same manifest file to |
| 219 | replace the project with a different source. |
| 220 | |
| 221 | This element is mostly useful in the local_manifest.xml, where |
| 222 | the user can remove a project, and possibly replace it with their |
| 223 | own definition. |
| 224 | |
Brian Harring | 2644874 | 2011-04-28 05:04:41 -0700 | [diff] [blame] | 225 | Element include |
| 226 | --------------- |
| 227 | |
| 228 | This element provides the capability of including another manifest |
| 229 | file into the originating manifest. Normal rules apply for the |
| 230 | target manifest to include- it must be a usable manifest on it's own. |
| 231 | |
| 232 | Attribute `name`; the manifest to include, specified relative to |
| 233 | the manifest repositories root. |
| 234 | |
Shawn O. Pearce | 03eaf07 | 2008-11-20 11:42:22 -0800 | [diff] [blame] | 235 | |
Shawn O. Pearce | 70cd4ab | 2008-11-06 08:48:44 -0800 | [diff] [blame] | 236 | Local Manifest |
| 237 | ============== |
| 238 | |
| 239 | Additional remotes and projects may be added through a local |
| 240 | manifest, stored in `$TOP_DIR/.repo/local_manifest.xml`. |
| 241 | |
| 242 | For example: |
| 243 | |
Shawn O. Pearce | 43c3d9e | 2009-03-04 14:26:50 -0800 | [diff] [blame] | 244 | $ cat .repo/local_manifest.xml |
| 245 | <?xml version="1.0" encoding="UTF-8"?> |
| 246 | <manifest> |
| 247 | <project path="manifest" |
| 248 | name="tools/manifest" /> |
| 249 | <project path="platform-manifest" |
| 250 | name="platform/manifest" /> |
| 251 | </manifest> |
Shawn O. Pearce | 70cd4ab | 2008-11-06 08:48:44 -0800 | [diff] [blame] | 252 | |
| 253 | Users may add projects to the local manifest prior to a `repo sync` |
| 254 | invocation, instructing repo to automatically download and manage |
| 255 | these extra projects. |