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> |
| 35 | <!ATTLIST remote fetch CDATA #REQUIRED> |
| 36 | <!ATTLIST remote review CDATA #IMPLIED> |
Shawn O. Pearce | 43c3d9e | 2009-03-04 14:26:50 -0800 | [diff] [blame] | 37 | |
| 38 | <!ELEMENT default (EMPTY)> |
| 39 | <!ATTLIST default remote IDREF #IMPLIED> |
| 40 | <!ATTLIST default revision CDATA #IMPLIED> |
Nico Sallembien | a1bfd2c | 2010-04-06 10:40:01 -0700 | [diff] [blame] | 41 | |
| 42 | <!ELEMENT manifest-server (EMPTY)> |
| 43 | <!ATTLIST url CDATA #REQUIRED> |
Shawn O. Pearce | 43c3d9e | 2009-03-04 14:26:50 -0800 | [diff] [blame] | 44 | |
Shawn O. Pearce | 242b526 | 2009-05-19 13:00:29 -0700 | [diff] [blame] | 45 | <!ELEMENT project (EMPTY)> |
Shawn O. Pearce | 43c3d9e | 2009-03-04 14:26:50 -0800 | [diff] [blame] | 46 | <!ATTLIST project name CDATA #REQUIRED> |
| 47 | <!ATTLIST project path CDATA #IMPLIED> |
| 48 | <!ATTLIST project remote IDREF #IMPLIED> |
| 49 | <!ATTLIST project revision CDATA #IMPLIED> |
| 50 | |
Shawn O. Pearce | 43c3d9e | 2009-03-04 14:26:50 -0800 | [diff] [blame] | 51 | <!ELEMENT remove-project (EMPTY)> |
| 52 | <!ATTLIST remove-project name CDATA #REQUIRED> |
Doug Anderson | 37282b4 | 2011-03-04 11:54:18 -0800 | [diff] [blame] | 53 | |
| 54 | <!ELEMENT repo-hooks (EMPTY)> |
| 55 | <!ATTLIST repo-hooks in-project CDATA #REQUIRED> |
| 56 | <!ATTLIST repo-hooks enabled-list CDATA #REQUIRED> |
Shawn O. Pearce | 43c3d9e | 2009-03-04 14:26:50 -0800 | [diff] [blame] | 57 | ]> |
Shawn O. Pearce | 3e54819 | 2008-11-04 11:19:36 -0800 | [diff] [blame] | 58 | |
| 59 | A description of the elements and their attributes follows. |
| 60 | |
| 61 | |
| 62 | Element manifest |
| 63 | ---------------- |
| 64 | |
| 65 | The root element of the file. |
| 66 | |
| 67 | |
| 68 | Element remote |
| 69 | -------------- |
| 70 | |
| 71 | One or more remote elements may be specified. Each remote element |
| 72 | specifies a Git URL shared by one or more projects and (optionally) |
| 73 | the Gerrit review server those projects upload changes through. |
| 74 | |
| 75 | Attribute `name`: A short name unique to this manifest file. The |
| 76 | name specified here is used as the remote name in each project's |
| 77 | .git/config, and is therefore automatically available to commands |
| 78 | like `git fetch`, `git remote`, `git pull` and `git push`. |
| 79 | |
| 80 | Attribute `fetch`: The Git URL prefix for all projects which use |
| 81 | this remote. Each project's name is appended to this prefix to |
| 82 | form the actual URL used to clone the project. |
| 83 | |
| 84 | Attribute `review`: Hostname of the Gerrit server where reviews |
| 85 | are uploaded to by `repo upload`. This attribute is optional; |
| 86 | if not specified then `repo upload` will not function. |
| 87 | |
Shawn O. Pearce | 3e54819 | 2008-11-04 11:19:36 -0800 | [diff] [blame] | 88 | Element default |
| 89 | --------------- |
| 90 | |
| 91 | At most one default element may be specified. Its remote and |
| 92 | revision attributes are used when a project element does not |
| 93 | specify its own remote or revision attribute. |
| 94 | |
| 95 | Attribute `remote`: Name of a previously defined remote element. |
| 96 | Project elements lacking a remote attribute of their own will use |
| 97 | this remote. |
| 98 | |
| 99 | Attribute `revision`: Name of a Git branch (e.g. `master` or |
| 100 | `refs/heads/master`). Project elements lacking their own |
| 101 | revision attribute will use this revision. |
| 102 | |
| 103 | |
Nico Sallembien | a1bfd2c | 2010-04-06 10:40:01 -0700 | [diff] [blame] | 104 | Element manifest-server |
| 105 | ----------------------- |
| 106 | |
| 107 | At most one manifest-server may be specified. The url attribute |
| 108 | is used to specify the URL of a manifest server, which is an |
| 109 | XML RPC service that will return a manifest in which each project |
| 110 | is pegged to a known good revision for the current branch and |
| 111 | target. |
| 112 | |
| 113 | The manifest server should implement: |
| 114 | |
| 115 | GetApprovedManifest(branch, target) |
| 116 | |
| 117 | The target to use is defined by environment variables TARGET_PRODUCT |
| 118 | and TARGET_BUILD_VARIANT. These variables are used to create a string |
| 119 | of the form $TARGET_PRODUCT-$TARGET_BUILD_VARIANT, e.g. passion-userdebug. |
| 120 | If one of those variables or both are not present, the program will call |
| 121 | GetApprovedManifest without the target paramater and the manifest server |
| 122 | should choose a reasonable default target. |
| 123 | |
| 124 | |
Shawn O. Pearce | 3e54819 | 2008-11-04 11:19:36 -0800 | [diff] [blame] | 125 | Element project |
| 126 | --------------- |
| 127 | |
| 128 | One or more project elements may be specified. Each element |
| 129 | describes a single Git repository to be cloned into the repo |
| 130 | client workspace. |
| 131 | |
| 132 | Attribute `name`: A unique name for this project. The project's |
| 133 | name is appended onto its remote's fetch URL to generate the actual |
| 134 | URL to configure the Git remote with. The URL gets formed as: |
| 135 | |
| 136 | ${remote_fetch}/${project_name}.git |
| 137 | |
| 138 | where ${remote_fetch} is the remote's fetch attribute and |
| 139 | ${project_name} is the project's name attribute. The suffix ".git" |
| 140 | is always appended as repo assumes the upstream is a forrest of |
| 141 | bare Git repositories. |
| 142 | |
| 143 | The project name must match the name Gerrit knows, if Gerrit is |
| 144 | being used for code reviews. |
| 145 | |
| 146 | Attribute `path`: An optional path relative to the top directory |
| 147 | of the repo client where the Git working directory for this project |
| 148 | should be placed. If not supplied the project name is used. |
| 149 | |
| 150 | Attribute `remote`: Name of a previously defined remote element. |
| 151 | If not supplied the remote given by the default element is used. |
| 152 | |
| 153 | Attribute `revision`: Name of the Git branch the manifest wants |
| 154 | to track for this project. Names can be relative to refs/heads |
| 155 | (e.g. just "master") or absolute (e.g. "refs/heads/master"). |
| 156 | Tags and/or explicit SHA-1s should work in theory, but have not |
| 157 | been extensively tested. If not supplied the revision given by |
| 158 | the default element is used. |
| 159 | |
Shawn O. Pearce | 03eaf07 | 2008-11-20 11:42:22 -0800 | [diff] [blame] | 160 | Element remove-project |
| 161 | ---------------------- |
| 162 | |
| 163 | Deletes the named project from the internal manifest table, possibly |
| 164 | allowing a subsequent project element in the same manifest file to |
| 165 | replace the project with a different source. |
| 166 | |
| 167 | This element is mostly useful in the local_manifest.xml, where |
| 168 | the user can remove a project, and possibly replace it with their |
| 169 | own definition. |
| 170 | |
| 171 | |
Shawn O. Pearce | 70cd4ab | 2008-11-06 08:48:44 -0800 | [diff] [blame] | 172 | Local Manifest |
| 173 | ============== |
| 174 | |
| 175 | Additional remotes and projects may be added through a local |
| 176 | manifest, stored in `$TOP_DIR/.repo/local_manifest.xml`. |
| 177 | |
| 178 | For example: |
| 179 | |
Shawn O. Pearce | 43c3d9e | 2009-03-04 14:26:50 -0800 | [diff] [blame] | 180 | $ cat .repo/local_manifest.xml |
| 181 | <?xml version="1.0" encoding="UTF-8"?> |
| 182 | <manifest> |
| 183 | <project path="manifest" |
| 184 | name="tools/manifest" /> |
| 185 | <project path="platform-manifest" |
| 186 | name="platform/manifest" /> |
| 187 | </manifest> |
Shawn O. Pearce | 70cd4ab | 2008-11-06 08:48:44 -0800 | [diff] [blame] | 188 | |
| 189 | Users may add projects to the local manifest prior to a `repo sync` |
| 190 | invocation, instructing repo to automatically download and manage |
| 191 | these extra projects. |