diff options
author | Muhammad Shakeel <muhammad_shakeel@mentor.com> | 2013-02-20 18:50:22 +0500 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-02-28 23:15:45 +0000 |
commit | 2b1afa10bc633c8153881921c181d0ad9b7060f0 (patch) | |
tree | 936fac1976dcd187d24e00a983e77ebbb7e9a6c8 /meta/classes/archiver.bbclass | |
parent | 8e849a23e9ce83fd8e855e8971f8e4803447ee65 (diff) | |
download | poky-2b1afa10bc633c8153881921c181d0ad9b7060f0.tar.gz |
archiver class: Use tasks with sstate instead of pre/post funcs
* Add tasks to move sources, script/logs and diff/env files in
deploy directory.
* Enable SSTATE for 'do_archive_scripts_logs' task
* Enable SSTATE for 'do_dumpdata_create_diff_gz' task
* SSTATE is not used for sources/patches archiver task because source
archive package can result into a very large file. It will be an
unnecessary overhead to keep sources in DL_DIR and cached-binaries.
* If 'SOURCE_ARCHIVE_PACKAGE_TYPE' is 'srpm' then use pre/post functions
because in this case we do not want to use tasks to move sources/logs
in DEPLOY_DIR. 'do_package_write_rpm' is responsible for handling
archiver packages.
[YOCTO #3449]
(From OE-Core rev: 959e2ae23ccbc6955a28996d4538e457cd8cfa5e)
Signed-off-by: Muhammad Shakeel <muhammad_shakeel@mentor.com>
Signed-off-by: Noor Ahsan <noor_ahsan@mentor.com>
Signed-off-by: Christopher Larson <chris_larson@mentor.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/archiver.bbclass')
-rw-r--r-- | meta/classes/archiver.bbclass | 40 |
1 files changed, 29 insertions, 11 deletions
diff --git a/meta/classes/archiver.bbclass b/meta/classes/archiver.bbclass index a4a2158099..43238272c5 100644 --- a/meta/classes/archiver.bbclass +++ b/meta/classes/archiver.bbclass | |||
@@ -94,9 +94,11 @@ def get_bb_inc(d): | |||
94 | work_dir = d.getVar('WORKDIR', True) | 94 | work_dir = d.getVar('WORKDIR', True) |
95 | bbfile = d.getVar('FILE', True) | 95 | bbfile = d.getVar('FILE', True) |
96 | bbdir = os.path.dirname(bbfile) | 96 | bbdir = os.path.dirname(bbfile) |
97 | script_logs = os.path.join(work_dir, 'script-logs') | 97 | target_sys = d.getVar('TARGET_SYS', True) |
98 | pf = d.getVar('PF', True) | ||
99 | licenses = get_licenses(d) | ||
100 | script_logs = os.path.join(work_dir, 'script-logs/'+ target_sys + '/' + licenses + '/' + pf + '/script-logs') | ||
98 | bb_inc = os.path.join(script_logs, 'bb_inc') | 101 | bb_inc = os.path.join(script_logs, 'bb_inc') |
99 | bb.mkdirhier(script_logs) | ||
100 | bb.mkdirhier(bb_inc) | 102 | bb.mkdirhier(bb_inc) |
101 | 103 | ||
102 | def find_file(dir, file): | 104 | def find_file(dir, file): |
@@ -124,6 +126,18 @@ def get_bb_inc(d): | |||
124 | for bbincfile in bbinc: | 126 | for bbincfile in bbinc: |
125 | shutil.copy(bbincfile, bb_inc) | 127 | shutil.copy(bbincfile, bb_inc) |
126 | 128 | ||
129 | return script_logs | ||
130 | |||
131 | def get_logs(d): | ||
132 | """ | ||
133 | create a directory "script-logs" in ${WORKDIR} | ||
134 | """ | ||
135 | work_dir = d.getVar('WORKDIR', True) | ||
136 | target_sys = d.getVar('TARGET_SYS', True) | ||
137 | pf = d.getVar('PF', True) | ||
138 | licenses = get_licenses(d) | ||
139 | script_logs = os.path.join(work_dir, 'script-logs/'+ target_sys + '/' + licenses + '/' + pf + '/script-logs') | ||
140 | |||
127 | try: | 141 | try: |
128 | bb.mkdirhier(os.path.join(script_logs, 'temp')) | 142 | bb.mkdirhier(os.path.join(script_logs, 'temp')) |
129 | oe.path.copytree(os.path.join(work_dir, 'temp'), os.path.join(script_logs, 'temp')) | 143 | oe.path.copytree(os.path.join(work_dir, 'temp'), os.path.join(script_logs, 'temp')) |
@@ -309,7 +323,8 @@ def archive_logs(d, logdir, bbinc=False): | |||
309 | work_dir = d.getVar('WORKDIR', True) | 323 | work_dir = d.getVar('WORKDIR', True) |
310 | log_dir = os.path.basename(logdir) | 324 | log_dir = os.path.basename(logdir) |
311 | tarname = pf + '-' + log_dir + ".tar.gz" | 325 | tarname = pf + '-' + log_dir + ".tar.gz" |
312 | tarname = do_tarball(work_dir, log_dir, tarname) | 326 | archive_dir = os.path.join( logdir, '..' ) |
327 | tarname = do_tarball(archive_dir, log_dir, tarname) | ||
313 | if bbinc: | 328 | if bbinc: |
314 | shutil.rmtree(logdir, ignore_errors=True) | 329 | shutil.rmtree(logdir, ignore_errors=True) |
315 | return tarname | 330 | return tarname |
@@ -414,6 +429,7 @@ def archive_scripts_logs(d): | |||
414 | archive scripts and logs. scripts include .bb and .inc files and | 429 | archive scripts and logs. scripts include .bb and .inc files and |
415 | logs include stuff in "temp". | 430 | logs include stuff in "temp". |
416 | """ | 431 | """ |
432 | import shutil | ||
417 | 433 | ||
418 | if tar_filter(d): | 434 | if tar_filter(d): |
419 | return | 435 | return |
@@ -421,18 +437,20 @@ def archive_scripts_logs(d): | |||
421 | temp_dir = os.path.join(work_dir, 'temp') | 437 | temp_dir = os.path.join(work_dir, 'temp') |
422 | source_archive_log_with_scripts = d.getVar('SOURCE_ARCHIVE_LOG_WITH_SCRIPTS', True) | 438 | source_archive_log_with_scripts = d.getVar('SOURCE_ARCHIVE_LOG_WITH_SCRIPTS', True) |
423 | if source_archive_log_with_scripts == 'logs_with_scripts': | 439 | if source_archive_log_with_scripts == 'logs_with_scripts': |
440 | logdir = get_logs(d) | ||
424 | logdir = get_bb_inc(d) | 441 | logdir = get_bb_inc(d) |
425 | tarlog = archive_logs(d, logdir, True) | ||
426 | elif source_archive_log_with_scripts == 'logs': | 442 | elif source_archive_log_with_scripts == 'logs': |
427 | if os.path.exists(temp_dir): | 443 | logdir = get_logs(d) |
428 | tarlog = archive_logs(d, temp_dir, False) | ||
429 | else: | 444 | else: |
430 | return | 445 | return |
431 | 446 | ||
432 | if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True) != 'srpm': | 447 | tarlog = archive_logs(d, logdir, True) |
433 | move_tarball_deploy(d, [tarlog]) | ||
434 | 448 | ||
435 | else: | 449 | if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True) == 'srpm': |
450 | if os.path.exists(work_dir+ '/' + tarlog): | ||
451 | os.remove(work_dir+ '/' + tarlog) | ||
452 | shutil.move(os.path.join(logdir, '..', tarlog), work_dir) | ||
453 | shutil.rmtree(os.path.join(work_dir,'script-logs')) | ||
436 | store_package(d, tarlog) | 454 | store_package(d, tarlog) |
437 | 455 | ||
438 | def dumpdata(d): | 456 | def dumpdata(d): |
@@ -449,7 +467,7 @@ def dumpdata(d): | |||
449 | pf = d.getVar('PF', True) | 467 | pf = d.getVar('PF', True) |
450 | target_sys = d.getVar('TARGET_SYS', True) | 468 | target_sys = d.getVar('TARGET_SYS', True) |
451 | licenses = get_licenses(d) | 469 | licenses = get_licenses(d) |
452 | dumpdir = d.getVar('DEPLOY_DIR', True) + '/sources/' + target_sys + '/' + licenses + '/' + pf | 470 | dumpdir = os.path.join(workdir, 'diffgz-envdata/'+ target_sys + '/' + licenses + '/' + pf ) |
453 | if not os.path.exists(dumpdir): | 471 | if not os.path.exists(dumpdir): |
454 | bb.mkdirhier(dumpdir) | 472 | bb.mkdirhier(dumpdir) |
455 | 473 | ||
@@ -480,7 +498,7 @@ def create_diff_gz(d): | |||
480 | pf = d.getVar('PF', True) | 498 | pf = d.getVar('PF', True) |
481 | licenses = get_licenses(d) | 499 | licenses = get_licenses(d) |
482 | target_sys = d.getVar('TARGET_SYS', True) | 500 | target_sys = d.getVar('TARGET_SYS', True) |
483 | diff_dir = d.getVar('DEPLOY_DIR', True) + '/sources/' + target_sys + '/' + licenses + '/' + pf | 501 | diff_dir = os.path.join(work_dir, 'diffgz-envdata/'+ target_sys + '/' + licenses + '/' + pf ) |
484 | diff_file = os.path.join(diff_dir, bb.data.expand("${P}-${PR}.diff.gz",d)) | 502 | diff_file = os.path.join(diff_dir, bb.data.expand("${P}-${PR}.diff.gz",d)) |
485 | 503 | ||
486 | f = open(os.path.join(work_dir,'temp/exclude-from-file'), 'a') | 504 | f = open(os.path.join(work_dir,'temp/exclude-from-file'), 'a') |