summaryrefslogtreecommitdiff
path: root/meta/classes
diff options
context:
space:
mode:
authorOla x Nilsson <ola.x.nilsson@axis.com>2017-01-25 16:49:46 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-01-31 14:40:17 +0000
commitc11fcd6fbde4a90913960b223451e0ce9e6b4b64 (patch)
tree30f8eb8dc0ba738c876d2f5e3562e9c6e8b73a56 /meta/classes
parent7d2a2160336413736dd4640f5b84ba4d74bb00f5 (diff)
downloadopenembedded-core-c11fcd6fbde4a90913960b223451e0ce9e6b4b64.tar.gz
openembedded-core-c11fcd6fbde4a90913960b223451e0ce9e6b4b64.tar.bz2
openembedded-core-c11fcd6fbde4a90913960b223451e0ce9e6b4b64.zip
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. Signed-off-by: Ola x Nilsson <olani@axis.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'meta/classes')
-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 () {
}
python externalsrc_configure_prefunc() {
+ s_dir = d.getVar('S')
# Create desired symlinks
symlinks = (d.getVar('EXTERNALSRC_SYMLINKS') or '').split()
+ newlinks = []
for symlink in symlinks:
symsplit = symlink.split(':', 1)
- lnkfile = os.path.join(d.getVar('S'), symsplit[0])
+ lnkfile = os.path.join(s_dir, symsplit[0])
target = d.expand(symsplit[1])
if len(symsplit) > 1:
if os.path.islink(lnkfile):
@@ -140,6 +142,19 @@ python externalsrc_configure_prefunc() {
# File/dir exists with same name as link, just leave it alone
continue
os.symlink(target, lnkfile)
+ newlinks.append(symsplit[0])
+ # Hide the symlinks from git
+ try:
+ git_exclude_file = os.path.join(s_dir, '.git/info/exclude')
+ if os.path.exists(git_exclude_file):
+ with open(git_exclude_file, 'r+') as efile:
+ elines = efile.readlines()
+ for link in newlinks:
+ if link in elines or '/'+link in elines:
+ continue
+ efile.write('/' + link + '\n')
+ except IOError as ioe:
+ bb.note('Failed to hide EXTERNALSRC_SYMLINKS from git')
}
python externalsrc_compile_prefunc() {