manifest-format.txt 14 KB

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