manifest-format.txt 13 KB

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