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