manifest-format.txt 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. repo Manifest Format
  2. ====================
  3. A repo manifest describes the structure of a repo client; that is
  4. the directories that are visible and where they should be obtained
  5. from with git.
  6. The basic structure of a manifest is a bare Git repository holding
  7. a single 'default.xml' XML file in the top level directory.
  8. Manifests are inherently version controlled, since they are kept
  9. within a Git repository. Updates to manifests are automatically
  10. obtained by clients during `repo sync`.
  11. XML File Format
  12. ---------------
  13. A manifest XML file (e.g. 'default.xml') roughly conforms to the
  14. following DTD:
  15. <!DOCTYPE manifest [
  16. <!ELEMENT manifest (notice?,
  17. remote*,
  18. default?,
  19. manifest-server?,
  20. remove-project*,
  21. project*,
  22. repo-hooks?)>
  23. <!ELEMENT notice (#PCDATA)>
  24. <!ELEMENT remote (EMPTY)>
  25. <!ATTLIST remote name ID #REQUIRED>
  26. <!ATTLIST remote alias CDATA #IMPLIED>
  27. <!ATTLIST remote fetch CDATA #REQUIRED>
  28. <!ATTLIST remote review CDATA #IMPLIED>
  29. <!ELEMENT default (EMPTY)>
  30. <!ATTLIST default remote IDREF #IMPLIED>
  31. <!ATTLIST default revision CDATA #IMPLIED>
  32. <!ATTLIST default sync-j CDATA #IMPLIED>
  33. <!ATTLIST default sync-c CDATA #IMPLIED>
  34. <!ATTLIST default sync-s CDATA #IMPLIED>
  35. <!ELEMENT manifest-server (EMPTY)>
  36. <!ATTLIST url CDATA #REQUIRED>
  37. <!ELEMENT project (annotation?,
  38. project*)>
  39. <!ATTLIST project name CDATA #REQUIRED>
  40. <!ATTLIST project path CDATA #IMPLIED>
  41. <!ATTLIST project remote IDREF #IMPLIED>
  42. <!ATTLIST project revision CDATA #IMPLIED>
  43. <!ATTLIST project groups CDATA #IMPLIED>
  44. <!ATTLIST project sync-c CDATA #IMPLIED>
  45. <!ATTLIST project sync-s CDATA #IMPLIED>
  46. <!ATTLIST project upstream CDATA #IMPLIED>
  47. <!ATTLIST project clone-depth CDATA #IMPLIED>
  48. <!ATTLIST project force-path CDATA #IMPLIED>
  49. <!ELEMENT annotation (EMPTY)>
  50. <!ATTLIST annotation name CDATA #REQUIRED>
  51. <!ATTLIST annotation value CDATA #REQUIRED>
  52. <!ATTLIST annotation keep CDATA "true">
  53. <!ELEMENT remove-project (EMPTY)>
  54. <!ATTLIST remove-project name CDATA #REQUIRED>
  55. <!ELEMENT repo-hooks (EMPTY)>
  56. <!ATTLIST repo-hooks in-project CDATA #REQUIRED>
  57. <!ATTLIST repo-hooks enabled-list CDATA #REQUIRED>
  58. <!ELEMENT include (EMPTY)>
  59. <!ATTLIST include name CDATA #REQUIRED>
  60. ]>
  61. A description of the elements and their attributes follows.
  62. Element manifest
  63. ----------------
  64. The root element of the file.
  65. Element remote
  66. --------------
  67. One or more remote elements may be specified. Each remote element
  68. specifies a Git URL shared by one or more projects and (optionally)
  69. the Gerrit review server those projects upload changes through.
  70. Attribute `name`: A short name unique to this manifest file. The
  71. name specified here is used as the remote name in each project's
  72. .git/config, and is therefore automatically available to commands
  73. like `git fetch`, `git remote`, `git pull` and `git push`.
  74. Attribute `alias`: The alias, if specified, is used to override
  75. `name` to be set as the remote name in each project's .git/config.
  76. Its value can be duplicated while attribute `name` has to be unique
  77. in the manifest file. This helps each project to be able to have
  78. same remote name which actually points to different remote url.
  79. Attribute `fetch`: The Git URL prefix for all projects which use
  80. this remote. Each project's name is appended to this prefix to
  81. form the actual URL used to clone the project.
  82. Attribute `review`: Hostname of the Gerrit server where reviews
  83. are uploaded to by `repo upload`. This attribute is optional;
  84. if not specified then `repo upload` will not function.
  85. Element default
  86. ---------------
  87. At most one default element may be specified. Its remote and
  88. revision attributes are used when a project element does not
  89. specify its own remote or revision attribute.
  90. Attribute `remote`: Name of a previously defined remote element.
  91. Project elements lacking a remote attribute of their own will use
  92. this remote.
  93. Attribute `revision`: Name of a Git branch (e.g. `master` or
  94. `refs/heads/master`). Project elements lacking their own
  95. revision attribute will use this revision.
  96. Attribute `sync_j`: Number of parallel jobs to use when synching.
  97. Attribute `sync_c`: Set to true to only sync the given Git
  98. branch (specified in the `revision` attribute) rather than the
  99. whole ref space. Project elements lacking a sync_c element of
  100. their own will use this value.
  101. Attribute `sync_s`: Set to true to also sync sub-projects.
  102. Element manifest-server
  103. -----------------------
  104. At most one manifest-server may be specified. The url attribute
  105. is used to specify the URL of a manifest server, which is an
  106. XML RPC service.
  107. The manifest server should implement the following RPC methods:
  108. GetApprovedManifest(branch, target)
  109. Return a manifest in which each project is pegged to a known good revision
  110. for the current branch and target.
  111. The target to use is defined by environment variables TARGET_PRODUCT
  112. and TARGET_BUILD_VARIANT. These variables are used to create a string
  113. of the form $TARGET_PRODUCT-$TARGET_BUILD_VARIANT, e.g. passion-userdebug.
  114. If one of those variables or both are not present, the program will call
  115. GetApprovedManifest without the target parameter and the manifest server
  116. should choose a reasonable default target.
  117. GetManifest(tag)
  118. Return a manifest in which each project is pegged to the revision at
  119. the specified tag.
  120. Element project
  121. ---------------
  122. One or more project elements may be specified. Each element
  123. describes a single Git repository to be cloned into the repo
  124. client workspace. You may specify Git-submodules by creating a
  125. nested project. Git-submodules will be automatically
  126. recognized and inherit their parent's attributes, but those
  127. may be overridden by an explicitly specified project element.
  128. Attribute `name`: A unique name for this project. The project's
  129. name is appended onto its remote's fetch URL to generate the actual
  130. URL to configure the Git remote with. The URL gets formed as:
  131. ${remote_fetch}/${project_name}.git
  132. where ${remote_fetch} is the remote's fetch attribute and
  133. ${project_name} is the project's name attribute. The suffix ".git"
  134. is always appended as repo assumes the upstream is a forest of
  135. bare Git repositories. If the project has a parent element, its
  136. name will be prefixed by the parent's.
  137. The project name must match the name Gerrit knows, if Gerrit is
  138. being used for code reviews.
  139. Attribute `path`: An optional path relative to the top directory
  140. of the repo client where the Git working directory for this project
  141. should be placed. If not supplied the project name is used.
  142. If the project has a parent element, its path will be prefixed
  143. by the parent's.
  144. Attribute `remote`: Name of a previously defined remote element.
  145. If not supplied the remote given by the default element is used.
  146. Attribute `revision`: Name of the Git branch the manifest wants
  147. to track for this project. Names can be relative to refs/heads
  148. (e.g. just "master") or absolute (e.g. "refs/heads/master").
  149. Tags and/or explicit SHA-1s should work in theory, but have not
  150. been extensively tested. If not supplied the revision given by
  151. the default element is used.
  152. Attribute `groups`: List of groups to which this project belongs,
  153. whitespace or comma separated. All projects belong to the group
  154. "all", and each project automatically belongs to a group of
  155. its name:`name` and path:`path`. E.g. for
  156. <project name="monkeys" path="barrel-of"/>, that project
  157. definition is implicitly in the following manifest groups:
  158. default, name:monkeys, and path:barrel-of. If you place a project in the
  159. group "notdefault", it will not be automatically downloaded by repo.
  160. If the project has a parent element, the `name` and `path` here
  161. are the prefixed ones.
  162. Attribute `sync_c`: Set to true to only sync the given Git
  163. branch (specified in the `revision` attribute) rather than the
  164. whole ref space.
  165. Attribute `sync_s`: Set to true to also sync sub-projects.
  166. Attribute `upstream`: Name of the Git branch in which a sha1
  167. can be found. Used when syncing a revision locked manifest in
  168. -c mode to avoid having to sync the entire ref space.
  169. Attribute `clone-depth`: Set the depth to use when fetching this
  170. project. If specified, this value will override any value given
  171. to repo init with the --depth option on the command line.
  172. Attribute `force-path`: Set to true to force this project to create the
  173. local mirror repository according to its `path` attribute (if supplied)
  174. rather than the `name` attribute. This attribute only applies to the
  175. local mirrors syncing, it will be ignored when syncing the projects in a
  176. client working directory.
  177. Element annotation
  178. ------------------
  179. Zero or more annotation elements may be specified as children of a
  180. project element. Each element describes a name-value pair that will be
  181. exported into each project's environment during a 'forall' command,
  182. prefixed with REPO__. In addition, there is an optional attribute
  183. "keep" which accepts the case insensitive values "true" (default) or
  184. "false". This attribute determines whether or not the annotation will
  185. be kept when exported with the manifest subcommand.
  186. Element remove-project
  187. ----------------------
  188. Deletes the named project from the internal manifest table, possibly
  189. allowing a subsequent project element in the same manifest file to
  190. replace the project with a different source.
  191. This element is mostly useful in a local manifest file, where
  192. the user can remove a project, and possibly replace it with their
  193. own definition.
  194. Element include
  195. ---------------
  196. This element provides the capability of including another manifest
  197. file into the originating manifest. Normal rules apply for the
  198. target manifest to include - it must be a usable manifest on its own.
  199. Attribute `name`: the manifest to include, specified relative to
  200. the manifest repository's root.
  201. Local Manifests
  202. ===============
  203. Additional remotes and projects may be added through local manifest
  204. files stored in `$TOP_DIR/.repo/local_manifests/*.xml`.
  205. For example:
  206. $ ls .repo/local_manifests
  207. local_manifest.xml
  208. another_local_manifest.xml
  209. $ cat .repo/local_manifests/local_manifest.xml
  210. <?xml version="1.0" encoding="UTF-8"?>
  211. <manifest>
  212. <project path="manifest"
  213. name="tools/manifest" />
  214. <project path="platform-manifest"
  215. name="platform/manifest" />
  216. </manifest>
  217. Users may add projects to the local manifest(s) prior to a `repo sync`
  218. invocation, instructing repo to automatically download and manage
  219. these extra projects.
  220. Manifest files stored in `$TOP_DIR/.repo/local_manifests/*.xml` will
  221. be loaded in alphabetical order.
  222. Additional remotes and projects may also be added through a local
  223. manifest, stored in `$TOP_DIR/.repo/local_manifest.xml`. This method
  224. is deprecated in favor of using multiple manifest files as mentioned
  225. above.
  226. If `$TOP_DIR/.repo/local_manifest.xml` exists, it will be loaded before
  227. any manifest files stored in `$TOP_DIR/.repo/local_manifests/*.xml`.