manifest-format.txt 15 KB

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