diff options
Diffstat (limited to 'meta/classes/externalsrc.bbclass')
| -rw-r--r-- | meta/classes/externalsrc.bbclass | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/meta/classes/externalsrc.bbclass b/meta/classes/externalsrc.bbclass index 70e27a8d35..527c99ab69 100644 --- a/meta/classes/externalsrc.bbclass +++ b/meta/classes/externalsrc.bbclass | |||
| @@ -28,6 +28,20 @@ | |||
| 28 | SRCTREECOVEREDTASKS ?= "do_patch do_unpack do_fetch" | 28 | SRCTREECOVEREDTASKS ?= "do_patch do_unpack do_fetch" |
| 29 | EXTERNALSRC_SYMLINKS ?= "oe-workdir:${WORKDIR} oe-logs:${T}" | 29 | EXTERNALSRC_SYMLINKS ?= "oe-workdir:${WORKDIR} oe-logs:${T}" |
| 30 | 30 | ||
| 31 | def find_git_dir(d, s_dir): | ||
| 32 | import subprocess | ||
| 33 | git_dir = None | ||
| 34 | try: | ||
| 35 | git_dir = os.path.join(s_dir, | ||
| 36 | subprocess.check_output(['git', '-C', s_dir, 'rev-parse', '--git-dir'], stderr=subprocess.DEVNULL).decode("utf-8").rstrip()) | ||
| 37 | top_git_dir = os.path.join(d.getVar("TOPDIR"), | ||
| 38 | subprocess.check_output(['git', '-C', d.getVar("TOPDIR"), 'rev-parse', '--git-dir'], stderr=subprocess.DEVNULL).decode("utf-8").rstrip()) | ||
| 39 | if git_dir == top_git_dir: | ||
| 40 | git_dir = None | ||
| 41 | except subprocess.CalledProcessError: | ||
| 42 | pass | ||
| 43 | return git_dir | ||
| 44 | |||
| 31 | python () { | 45 | python () { |
| 32 | externalsrc = d.getVar('EXTERNALSRC') | 46 | externalsrc = d.getVar('EXTERNALSRC') |
| 33 | externalsrcbuild = d.getVar('EXTERNALSRC_BUILD') | 47 | externalsrcbuild = d.getVar('EXTERNALSRC_BUILD') |
| @@ -169,14 +183,16 @@ python externalsrc_configure_prefunc() { | |||
| 169 | newlinks.append(symsplit[0]) | 183 | newlinks.append(symsplit[0]) |
| 170 | # Hide the symlinks from git | 184 | # Hide the symlinks from git |
| 171 | try: | 185 | try: |
| 172 | git_exclude_file = os.path.join(s_dir, '.git/info/exclude') | 186 | git_dir = find_git_dir(d, s_dir) |
| 173 | if os.path.exists(git_exclude_file): | 187 | if git_dir: |
| 174 | with open(git_exclude_file, 'r+') as efile: | 188 | git_exclude_file = os.path.join(git_dir, 'info/exclude') |
| 175 | elines = efile.readlines() | 189 | if os.path.exists(git_exclude_file): |
| 176 | for link in newlinks: | 190 | with open(git_exclude_file, 'r+') as efile: |
| 177 | if link in elines or '/'+link in elines: | 191 | elines = efile.readlines() |
| 178 | continue | 192 | for link in newlinks: |
| 179 | efile.write('/' + link + '\n') | 193 | if link in elines or '/'+link in elines: |
| 194 | continue | ||
| 195 | efile.write('/' + link + '\n') | ||
| 180 | except IOError as ioe: | 196 | except IOError as ioe: |
| 181 | bb.note('Failed to hide EXTERNALSRC_SYMLINKS from git') | 197 | bb.note('Failed to hide EXTERNALSRC_SYMLINKS from git') |
| 182 | } | 198 | } |
| @@ -207,17 +223,7 @@ def srctree_hash_files(d, srcdir=None): | |||
| 207 | import hashlib | 223 | import hashlib |
| 208 | 224 | ||
| 209 | s_dir = srcdir or d.getVar('EXTERNALSRC') | 225 | s_dir = srcdir or d.getVar('EXTERNALSRC') |
| 210 | git_dir = None | 226 | git_dir = find_git_dir(d, s_dir) |
| 211 | |||
| 212 | try: | ||
| 213 | git_dir = os.path.join(s_dir, | ||
| 214 | subprocess.check_output(['git', '-C', s_dir, 'rev-parse', '--git-dir'], stderr=subprocess.DEVNULL).decode("utf-8").rstrip()) | ||
| 215 | top_git_dir = os.path.join(d.getVar("TOPDIR"), | ||
| 216 | subprocess.check_output(['git', '-C', d.getVar("TOPDIR"), 'rev-parse', '--git-dir'], stderr=subprocess.DEVNULL).decode("utf-8").rstrip()) | ||
| 217 | if git_dir == top_git_dir: | ||
| 218 | git_dir = None | ||
| 219 | except subprocess.CalledProcessError: | ||
| 220 | pass | ||
| 221 | 227 | ||
| 222 | ret = " " | 228 | ret = " " |
| 223 | if git_dir is not None: | 229 | if git_dir is not None: |
