diff options
| -rw-r--r-- | meta/classes/copyleft_compliance.bbclass | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/meta/classes/copyleft_compliance.bbclass b/meta/classes/copyleft_compliance.bbclass index e68942d84c..786cf1e9c7 100644 --- a/meta/classes/copyleft_compliance.bbclass +++ b/meta/classes/copyleft_compliance.bbclass | |||
| @@ -13,6 +13,7 @@ COPYLEFT_SOURCES_DIR ?= '${DEPLOY_DIR}/copyleft_sources' | |||
| 13 | 13 | ||
| 14 | python do_prepare_copyleft_sources () { | 14 | python do_prepare_copyleft_sources () { |
| 15 | """Populate a tree of the recipe sources and emit patch series files""" | 15 | """Populate a tree of the recipe sources and emit patch series files""" |
| 16 | import os.path | ||
| 16 | import shutil | 17 | import shutil |
| 17 | 18 | ||
| 18 | p = d.getVar('P', True) | 19 | p = d.getVar('P', True) |
| @@ -24,22 +25,27 @@ python do_prepare_copyleft_sources () { | |||
| 24 | bb.debug(1, 'copyleft: %s is included: %s' % (p, reason)) | 25 | bb.debug(1, 'copyleft: %s is included: %s' % (p, reason)) |
| 25 | 26 | ||
| 26 | sources_dir = d.getVar('COPYLEFT_SOURCES_DIR', True) | 27 | sources_dir = d.getVar('COPYLEFT_SOURCES_DIR', True) |
| 28 | dl_dir = d.getVar('DL_DIR', True) | ||
| 27 | src_uri = d.getVar('SRC_URI', True).split() | 29 | src_uri = d.getVar('SRC_URI', True).split() |
| 28 | fetch = bb.fetch2.Fetch(src_uri, d) | 30 | fetch = bb.fetch2.Fetch(src_uri, d) |
| 29 | ud = fetch.ud | 31 | ud = fetch.ud |
| 30 | 32 | ||
| 31 | locals = (fetch.localpath(url) for url in fetch.urls) | ||
| 32 | localpaths = [local for local in locals if not local.endswith('.bb')] | ||
| 33 | if not localpaths: | ||
| 34 | return | ||
| 35 | |||
| 36 | pf = d.getVar('PF', True) | 33 | pf = d.getVar('PF', True) |
| 37 | dest = os.path.join(sources_dir, pf) | 34 | dest = os.path.join(sources_dir, pf) |
| 38 | shutil.rmtree(dest, ignore_errors=True) | 35 | shutil.rmtree(dest, ignore_errors=True) |
| 39 | bb.mkdirhier(dest) | 36 | bb.mkdirhier(dest) |
| 40 | 37 | ||
| 41 | for path in localpaths: | 38 | for u in ud.values(): |
| 42 | os.symlink(path, os.path.join(dest, os.path.basename(path))) | 39 | local = os.path.normpath(fetch.localpath(u.url)) |
| 40 | if local.endswith('.bb'): | ||
| 41 | continue | ||
| 42 | |||
| 43 | if u.mirrortarball: | ||
| 44 | tarball_path = os.path.join(dl_dir, u.mirrortarball) | ||
| 45 | if os.path.exists(tarball_path): | ||
| 46 | local = tarball_path | ||
| 47 | |||
| 48 | os.symlink(local, os.path.join(dest, os.path.basename(local))) | ||
| 43 | 49 | ||
| 44 | patches = src_patches(d) | 50 | patches = src_patches(d) |
| 45 | for patch in patches: | 51 | for patch in patches: |
