diff options
author | Jeff Hamilton <jham@android.com> | 2014-04-21 17:10:59 -0500 |
---|---|---|
committer | Jeff Hamilton <jham@android.com> | 2014-04-22 14:35:47 -0500 |
commit | e0df232da7c92b0776a3e86a70687e2c9f2bad7b (patch) | |
tree | d9bb8f70c88f622a29472c49fb253200fb9ed52f /manifest_xml.py | |
parent | 5a7c3afa73c99ab07c60bb65f5ec57423cac4282 (diff) | |
download | git-repo-e0df232da7c92b0776a3e86a70687e2c9f2bad7b.tar.gz |
Add linkfile support.
It's just like copyfile and runs at the same time as copyfile but
instead of copying it creates a symlink instead. This is needed
because copyfile copies the target of the link as opposed to the
symlink itself.
Change-Id: I7bff2aa23f0d80d9d51061045bd9c86a9b741ac5
Diffstat (limited to 'manifest_xml.py')
-rw-r--r-- | manifest_xml.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/manifest_xml.py b/manifest_xml.py index 3c8fadd6..e2f58e62 100644 --- a/manifest_xml.py +++ b/manifest_xml.py | |||
@@ -261,6 +261,12 @@ class XmlManifest(object): | |||
261 | ce.setAttribute('dest', c.dest) | 261 | ce.setAttribute('dest', c.dest) |
262 | e.appendChild(ce) | 262 | e.appendChild(ce) |
263 | 263 | ||
264 | for l in p.linkfiles: | ||
265 | le = doc.createElement('linkfile') | ||
266 | le.setAttribute('src', l.src) | ||
267 | le.setAttribute('dest', l.dest) | ||
268 | e.appendChild(le) | ||
269 | |||
264 | default_groups = ['all', 'name:%s' % p.name, 'path:%s' % p.relpath] | 270 | default_groups = ['all', 'name:%s' % p.name, 'path:%s' % p.relpath] |
265 | egroups = [g for g in p.groups if g not in default_groups] | 271 | egroups = [g for g in p.groups if g not in default_groups] |
266 | if egroups: | 272 | if egroups: |
@@ -765,6 +771,8 @@ class XmlManifest(object): | |||
765 | for n in node.childNodes: | 771 | for n in node.childNodes: |
766 | if n.nodeName == 'copyfile': | 772 | if n.nodeName == 'copyfile': |
767 | self._ParseCopyFile(project, n) | 773 | self._ParseCopyFile(project, n) |
774 | if n.nodeName == 'linkfile': | ||
775 | self._ParseLinkFile(project, n) | ||
768 | if n.nodeName == 'annotation': | 776 | if n.nodeName == 'annotation': |
769 | self._ParseAnnotation(project, n) | 777 | self._ParseAnnotation(project, n) |
770 | if n.nodeName == 'project': | 778 | if n.nodeName == 'project': |
@@ -814,6 +822,14 @@ class XmlManifest(object): | |||
814 | # dest is relative to the top of the tree | 822 | # dest is relative to the top of the tree |
815 | project.AddCopyFile(src, dest, os.path.join(self.topdir, dest)) | 823 | project.AddCopyFile(src, dest, os.path.join(self.topdir, dest)) |
816 | 824 | ||
825 | def _ParseLinkFile(self, project, node): | ||
826 | src = self._reqatt(node, 'src') | ||
827 | dest = self._reqatt(node, 'dest') | ||
828 | if not self.IsMirror: | ||
829 | # src is project relative; | ||
830 | # dest is relative to the top of the tree | ||
831 | project.AddLinkFile(src, dest, os.path.join(self.topdir, dest)) | ||
832 | |||
817 | def _ParseAnnotation(self, project, node): | 833 | def _ParseAnnotation(self, project, node): |
818 | name = self._reqatt(node, 'name') | 834 | name = self._reqatt(node, 'name') |
819 | value = self._reqatt(node, 'value') | 835 | value = self._reqatt(node, 'value') |