diff options
| -rw-r--r-- | docs/manifest-format.txt | 19 | ||||
| -rw-r--r-- | manifest_xml.py | 14 |
2 files changed, 26 insertions, 7 deletions
diff --git a/docs/manifest-format.txt b/docs/manifest-format.txt index f499868c..c51b84be 100644 --- a/docs/manifest-format.txt +++ b/docs/manifest-format.txt | |||
| @@ -224,15 +224,19 @@ Attribute `name`; the manifest to include, specified relative to | |||
| 224 | the manifest repositories root. | 224 | the manifest repositories root. |
| 225 | 225 | ||
| 226 | 226 | ||
| 227 | Local Manifest | 227 | Local Manifests |
| 228 | ============== | 228 | =============== |
| 229 | 229 | ||
| 230 | Additional remotes and projects may be added through a local | 230 | Additional remotes and projects may be added through local manifest |
| 231 | manifest, stored in `$TOP_DIR/.repo/local_manifest.xml`. | 231 | files stored in `$TOP_DIR/.repo/local_manifests/*.xml`. |
| 232 | 232 | ||
| 233 | For example: | 233 | For example: |
| 234 | 234 | ||
| 235 | $ cat .repo/local_manifest.xml | 235 | $ ls .repo/local_manifests |
| 236 | local_manifest.xml | ||
| 237 | another_local_manifest.xml | ||
| 238 | |||
| 239 | $ cat .repo/local_manifests/local_manifest.xml | ||
| 236 | <?xml version="1.0" encoding="UTF-8"?> | 240 | <?xml version="1.0" encoding="UTF-8"?> |
| 237 | <manifest> | 241 | <manifest> |
| 238 | <project path="manifest" | 242 | <project path="manifest" |
| @@ -241,6 +245,9 @@ For example: | |||
| 241 | name="platform/manifest" /> | 245 | name="platform/manifest" /> |
| 242 | </manifest> | 246 | </manifest> |
| 243 | 247 | ||
| 244 | Users may add projects to the local manifest prior to a `repo sync` | 248 | Users may add projects to the local manifest(s) prior to a `repo sync` |
| 245 | invocation, instructing repo to automatically download and manage | 249 | invocation, instructing repo to automatically download and manage |
| 246 | these extra projects. | 250 | these extra projects. |
| 251 | |||
| 252 | Additional remotes and projects may also be added through a local | ||
| 253 | manifest, stored in `$TOP_DIR/.repo/local_manifest.xml`. | ||
diff --git a/manifest_xml.py b/manifest_xml.py index bf981f03..4e476791 100644 --- a/manifest_xml.py +++ b/manifest_xml.py | |||
| @@ -27,6 +27,7 @@ from error import ManifestParseError | |||
| 27 | 27 | ||
| 28 | MANIFEST_FILE_NAME = 'manifest.xml' | 28 | MANIFEST_FILE_NAME = 'manifest.xml' |
| 29 | LOCAL_MANIFEST_NAME = 'local_manifest.xml' | 29 | LOCAL_MANIFEST_NAME = 'local_manifest.xml' |
| 30 | LOCAL_MANIFESTS_DIR_NAME = 'local_manifests' | ||
| 30 | 31 | ||
| 31 | urlparse.uses_relative.extend(['ssh', 'git']) | 32 | urlparse.uses_relative.extend(['ssh', 'git']) |
| 32 | urlparse.uses_netloc.extend(['ssh', 'git']) | 33 | urlparse.uses_netloc.extend(['ssh', 'git']) |
| @@ -301,6 +302,17 @@ class XmlManifest(object): | |||
| 301 | if os.path.exists(local): | 302 | if os.path.exists(local): |
| 302 | nodes.append(self._ParseManifestXml(local, self.repodir)) | 303 | nodes.append(self._ParseManifestXml(local, self.repodir)) |
| 303 | 304 | ||
| 305 | local_dir = os.path.abspath(os.path.join(self.repodir, LOCAL_MANIFESTS_DIR_NAME)) | ||
| 306 | try: | ||
| 307 | for local_file in os.listdir(local_dir): | ||
| 308 | if local_file.endswith('.xml'): | ||
| 309 | try: | ||
| 310 | nodes.append(self._ParseManifestXml(local_file, self.repodir)) | ||
| 311 | except ManifestParseError as e: | ||
| 312 | print >>sys.stderr, '%s' % str(e) | ||
| 313 | except OSError: | ||
| 314 | pass | ||
| 315 | |||
| 304 | self._ParseManifest(nodes) | 316 | self._ParseManifest(nodes) |
| 305 | 317 | ||
| 306 | if self.IsMirror: | 318 | if self.IsMirror: |
| @@ -312,7 +324,7 @@ class XmlManifest(object): | |||
| 312 | def _ParseManifestXml(self, path, include_root): | 324 | def _ParseManifestXml(self, path, include_root): |
| 313 | try: | 325 | try: |
| 314 | root = xml.dom.minidom.parse(path) | 326 | root = xml.dom.minidom.parse(path) |
| 315 | except (OSError, xml.parsers.expat.ExpatError), e: | 327 | except (OSError, xml.parsers.expat.ExpatError) as e: |
| 316 | raise ManifestParseError("error parsing manifest %s: %s" % (path, e)) | 328 | raise ManifestParseError("error parsing manifest %s: %s" % (path, e)) |
| 317 | 329 | ||
| 318 | if not root or not root.childNodes: | 330 | if not root or not root.childNodes: |
