summaryrefslogtreecommitdiffstats
path: root/meta/classes/externalsrc.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/externalsrc.bbclass')
-rw-r--r--meta/classes/externalsrc.bbclass17
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
126python externalsrc_configure_prefunc() { 126python 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
145python externalsrc_compile_prefunc() { 160python externalsrc_compile_prefunc() {