manifest-format.txt 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  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. <!ELEMENT manifest-server (EMPTY)>
  35. <!ATTLIST url CDATA #REQUIRED>
  36. <!ELEMENT project (annotation?,
  37. project*)>
  38. <!ATTLIST project name CDATA #REQUIRED>
  39. <!ATTLIST project path CDATA #IMPLIED>
  40. <!ATTLIST project remote IDREF #IMPLIED>
  41. <!ATTLIST project revision CDATA #IMPLIED>
  42. <!ATTLIST project groups CDATA #IMPLIED>
  43. <!ATTLIST project sync-c CDATA #IMPLIED>
  44. <!ELEMENT annotation (EMPTY)>
  45. <!ATTLIST annotation name CDATA #REQUIRED>
  46. <!ATTLIST annotation value CDATA #REQUIRED>
  47. <!ATTLIST annotation keep CDATA "true">
  48. <!ELEMENT remove-project (EMPTY)>
  49. <!ATTLIST remove-project name CDATA #REQUIRED>
  50. <!ELEMENT repo-hooks (EMPTY)>
  51. <!ATTLIST repo-hooks in-project CDATA #REQUIRED>
  52. <!ATTLIST repo-hooks enabled-list CDATA #REQUIRED>
  53. <!ELEMENT include (EMPTY)>
  54. <!ATTLIST include name CDATA #REQUIRED>
  55. ]>
  56. A description of the elements and their attributes follows.
  57. Element manifest
  58. ----------------
  59. The root element of the file.
  60. Element remote
  61. --------------
  62. One or more remote elements may be specified. Each remote element
  63. specifies a Git URL shared by one or more projects and (optionally)
  64. the Gerrit review server those projects upload changes through.
  65. Attribute `name`: A short name unique to this manifest file. The
  66. name specified here is used as the remote name in each project's
  67. .git/config, and is therefore automatically available to commands
  68. like `git fetch`, `git remote`, `git pull` and `git push`.
  69. Attribute `alias`: The alias, if specified, is used to override
  70. `name` to be set as the remote name in each project's .git/config.
  71. Its value can be duplicated while attribute `name` has to be unique
  72. in the manifest file. This helps each project to be able to have
  73. same remote name which actually points to different remote url.
  74. Attribute `fetch`: The Git URL prefix for all projects which use
  75. this remote. Each project's name is appended to this prefix to
  76. form the actual URL used to clone the project.
  77. Attribute `review`: Hostname of the Gerrit server where reviews
  78. are uploaded to by `repo upload`. This attribute is optional;
  79. if not specified then `repo upload` will not function.
  80. Element default
  81. ---------------
  82. At most one default element may be specified. Its remote and
  83. revision attributes are used when a project element does not
  84. specify its own remote or revision attribute.
  85. Attribute `remote`: Name of a previously defined remote element.
  86. Project elements lacking a remote attribute of their own will use
  87. this remote.
  88. Attribute `revision`: Name of a Git branch (e.g. `master` or
  89. `refs/heads/master`). Project elements lacking their own
  90. revision attribute will use this revision.
  91. Element manifest-server
  92. -----------------------
  93. At most one manifest-server may be specified. The url attribute
  94. is used to specify the URL of a manifest server, which is an
  95. XML RPC service.
  96. The manifest server should implement the following RPC methods:
  97. GetApprovedManifest(branch, target)
  98. Return a manifest in which each project is pegged to a known good revision
  99. for the current branch and target.
  100. The target to use is defined by environment variables TARGET_PRODUCT
  101. and TARGET_BUILD_VARIANT. These variables are used to create a string
  102. of the form $TARGET_PRODUCT-$TARGET_BUILD_VARIANT, e.g. passion-userdebug.
  103. If one of those variables or both are not present, the program will call
  104. GetApprovedManifest without the target parameter and the manifest server
  105. should choose a reasonable default target.
  106. GetManifest(tag)
  107. Return a manifest in which each project is pegged to the revision at
  108. the specified tag.
  109. Element project
  110. ---------------
  111. One or more project elements may be specified. Each element
  112. describes a single Git repository to be cloned into the repo
  113. client workspace. You may specify Git-submodules by creating a
  114. nested project. Git-submodules will be automatically
  115. recognized and inherit their parent's attributes, but those
  116. may be overridden by an explicitly specified project element.
  117. Attribute `name`: A unique name for this project. The project's
  118. name is appended onto its remote's fetch URL to generate the actual
  119. URL to configure the Git remote with. The URL gets formed as:
  120. ${remote_fetch}/${project_name}.git
  121. where ${remote_fetch} is the remote's fetch attribute and
  122. ${project_name} is the project's name attribute. The suffix ".git"
  123. is always appended as repo assumes the upstream is a forest of
  124. bare Git repositories. If the project has a parent element, its
  125. name will be prefixed by the parent's.
  126. The project name must match the name Gerrit knows, if Gerrit is
  127. being used for code reviews.
  128. Attribute `path`: An optional path relative to the top directory
  129. of the repo client where the Git working directory for this project
  130. should be placed. If not supplied the project name is used.
  131. If the project has a parent element, its path will be prefixed
  132. by the parent's.
  133. Attribute `remote`: Name of a previously defined remote element.
  134. If not supplied the remote given by the default element is used.
  135. Attribute `revision`: Name of the Git branch the manifest wants
  136. to track for this project. Names can be relative to refs/heads
  137. (e.g. just "master") or absolute (e.g. "refs/heads/master").
  138. Tags and/or explicit SHA-1s should work in theory, but have not
  139. been extensively tested. If not supplied the revision given by
  140. the default element is used.
  141. Attribute `groups`: List of groups to which this project belongs,
  142. whitespace or comma separated. All projects belong to the group
  143. "all", and each project automatically belongs to a group of
  144. its name:`name` and path:`path`. E.g. for
  145. <project name="monkeys" path="barrel-of"/>, that project
  146. definition is implicitly in the following manifest groups:
  147. default, name:monkeys, and path:barrel-of. If you place a project in the
  148. group "notdefault", it will not be automatically downloaded by repo.
  149. If the project has a parent element, the `name` and `path` here
  150. are the prefixed ones.
  151. Element annotation
  152. ------------------
  153. Zero or more annotation elements may be specified as children of a
  154. project element. Each element describes a name-value pair that will be
  155. exported into each project's environment during a 'forall' command,
  156. prefixed with REPO__. In addition, there is an optional attribute
  157. "keep" which accepts the case insensitive values "true" (default) or
  158. "false". This attribute determines whether or not the annotation will
  159. be kept when exported with the manifest subcommand.
  160. Element remove-project
  161. ----------------------
  162. Deletes the named project from the internal manifest table, possibly
  163. allowing a subsequent project element in the same manifest file to
  164. replace the project with a different source.
  165. This element is mostly useful in the local_manifest.xml, where
  166. the user can remove a project, and possibly replace it with their
  167. own definition.
  168. Element include
  169. ---------------
  170. This element provides the capability of including another manifest
  171. file into the originating manifest. Normal rules apply for the
  172. target manifest to include- it must be a usable manifest on it's own.
  173. Attribute `name`; the manifest to include, specified relative to
  174. the manifest repositories root.
  175. Local Manifest
  176. ==============
  177. Additional remotes and projects may be added through a local
  178. manifest, stored in `$TOP_DIR/.repo/local_manifest.xml`.
  179. For example:
  180. $ cat .repo/local_manifest.xml
  181. <?xml version="1.0" encoding="UTF-8"?>
  182. <manifest>
  183. <project path="manifest"
  184. name="tools/manifest" />
  185. <project path="platform-manifest"
  186. name="platform/manifest" />
  187. </manifest>
  188. Users may add projects to the local manifest prior to a `repo sync`
  189. invocation, instructing repo to automatically download and manage
  190. these extra projects.