diff options
author | Ola x Nilsson <ola.x.nilsson@axis.com> | 2017-01-25 16:49:46 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-01-31 14:43:01 +0000 |
commit | 2e77eff6ccba84b5229971794a31122dfa033e07 (patch) | |
tree | b8e18c4e4aa82bd8f880cef6be148451d65ba48f | |
parent | 2313a77d8474c742e1cd8cee246f6c05847dd3c6 (diff) | |
download | poky-2e77eff6ccba84b5229971794a31122dfa033e07.tar.gz |
externalsrc: Hide created symlinks with .git/info/exclude
Add created symlinks to the exclude file. This will both make them
less distracting and hide them from the srctree_hash_files function.
(From OE-Core rev: c11fcd6fbde4a90913960b223451e0ce9e6b4b64)
Signed-off-by: Ola x Nilsson <olani@axis.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes/externalsrc.bbclass | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/meta/classes/externalsrc.bbclass b/meta/classes/externalsrc.bbclass index bdf23ec6be..39789ea30f 100644 --- a/meta/classes/externalsrc.bbclass +++ b/meta/classes/externalsrc.bbclass | |||
@@ -124,11 +124,13 @@ python () { | |||
124 | } | 124 | } |
125 | 125 | ||
126 | python externalsrc_configure_prefunc() { | 126 | python externalsrc_configure_prefunc() { |
127 | s_dir = d.getVar('S') | ||
127 | # Create desired symlinks | 128 | # Create desired symlinks |
128 | symlinks = (d.getVar('EXTERNALSRC_SYMLINKS') or '').split() | 129 | symlinks = (d.getVar('EXTERNALSRC_SYMLINKS') or '').split() |
130 | newlinks = [] | ||
129 | for symlink in symlinks: | 131 | for symlink in symlinks: |
130 | symsplit = symlink.split(':', 1) | 132 | symsplit = symlink.split(':', 1) |
131 | lnkfile = os.path.join(d.getVar('S'), symsplit[0]) | 133 | lnkfile = os.path.join(s_dir, symsplit[0]) |
132 | target = d.expand(symsplit[1]) | 134 | target = d.expand(symsplit[1]) |
133 | if len(symsplit) > 1: | 135 | if len(symsplit) > 1: |
134 | if os.path.islink(lnkfile): | 136 | if os.path.islink(lnkfile): |
@@ -140,6 +142,19 @@ python externalsrc_configure_prefunc() { | |||
140 | # File/dir exists with same name as link, just leave it alone | 142 | # File/dir exists with same name as link, just leave it alone |
141 | continue | 143 | continue |
142 | os.symlink(target, lnkfile) | 144 | os.symlink(target, lnkfile) |
145 | newlinks.append(symsplit[0]) | ||
146 | # Hide the symlinks from git | ||
147 | try: | ||
148 | git_exclude_file = os.path.join(s_dir, '.git/info/exclude') | ||
149 | if os.path.exists(git_exclude_file): | ||
150 | with open(git_exclude_file, 'r+') as efile: | ||
151 | elines = efile.readlines() | ||
152 | for link in newlinks: | ||
153 | if link in elines or '/'+link in elines: | ||
154 | continue | ||
155 | efile.write('/' + link + '\n') | ||
156 | except IOError as ioe: | ||
157 | bb.note('Failed to hide EXTERNALSRC_SYMLINKS from git') | ||
143 | } | 158 | } |
144 | 159 | ||
145 | python externalsrc_compile_prefunc() { | 160 | python externalsrc_compile_prefunc() { |