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