diff options
-rw-r--r-- | meta/classes/archive-configured-source.bbclass | 49 | ||||
-rw-r--r-- | meta/classes/archive-original-source.bbclass | 49 | ||||
-rw-r--r-- | meta/classes/archive-patched-source.bbclass | 49 | ||||
-rw-r--r-- | meta/classes/archiver.bbclass | 40 |
4 files changed, 167 insertions, 20 deletions
diff --git a/meta/classes/archive-configured-source.bbclass b/meta/classes/archive-configured-source.bbclass index 1eaaf4cf25..e492ce300d 100644 --- a/meta/classes/archive-configured-source.bbclass +++ b/meta/classes/archive-configured-source.bbclass | |||
@@ -8,10 +8,53 @@ | |||
8 | inherit archiver | 8 | inherit archiver |
9 | 9 | ||
10 | # Get archiving package with configured sources including patches | 10 | # Get archiving package with configured sources including patches |
11 | do_configure[postfuncs] += "do_archive_configured_sources " | 11 | addtask do_archive_configured_sources after do_configure |
12 | 12 | ||
13 | # Get archiving package with temp(logs) and scripts(.bb and inc files) | 13 | # Get archiving package with temp(logs) and scripts(.bb and inc files) |
14 | do_package_write_rpm[prefuncs] += "do_archive_scripts_logs " | 14 | addtask do_archive_scripts_logs after do_package_write_rpm |
15 | 15 | ||
16 | # Get dump date and create diff file | 16 | # Get dump date and create diff file |
17 | do_package_write_rpm[postfuncs] += "do_dumpdata_create_diff_gz " | 17 | addtask do_dumpdata_create_diff_gz after do_package_write_rpm before do_build |
18 | |||
19 | python () { | ||
20 | if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True) != 'srpm': | ||
21 | """ | ||
22 | If package type is not 'srpm' then add tasks to move archive packages of | ||
23 | configured sources and scripts/logs in ${DEPLOY_DIR}/sources. | ||
24 | """ | ||
25 | pn = d.getVar('PN', True) | ||
26 | d.appendVarFlag('do_compile', 'depends', ' %s:do_archive_configured_sources' %pn) | ||
27 | build_deps = ' %s:do_archive_configured_sources' %pn | ||
28 | build_deps += ' %s:do_archive_scripts_logs' %pn | ||
29 | d.appendVarFlag('do_build', 'depends', build_deps) | ||
30 | |||
31 | else: | ||
32 | d.prependVarFlag('do_configure', 'postfuncs', "do_archive_configured_sources") | ||
33 | d.prependVarFlag('do_package_write_rpm', 'prefuncs', "do_archive_scripts_logs") | ||
34 | } | ||
35 | |||
36 | ARCHIVE_SSTATE_OUTDIR = "${DEPLOY_DIR}/sources/" | ||
37 | ARCHIVE_SSTATE_SCRIPTS_LOGS_INDIR = "${WORKDIR}/script-logs/" | ||
38 | ARCHIVE_SSTATE_DIFFGZ_ENVDATA_INDIR = "${WORKDIR}/diffgz-envdata/" | ||
39 | |||
40 | SSTATETASKS += "do_archive_scripts_logs" | ||
41 | do_archive_scripts_logs[sstate-name] = "archive_scripts_logs" | ||
42 | do_archive_scripts_logs[sstate-inputdirs] = "${ARCHIVE_SSTATE_SCRIPTS_LOGS_INDIR}" | ||
43 | do_archive_scripts_logs[sstate-outputdirs] = "${ARCHIVE_SSTATE_OUTDIR}" | ||
44 | |||
45 | python do_archive_scripts_logs_setscene () { | ||
46 | sstate_setscene(d) | ||
47 | } | ||
48 | |||
49 | addtask do_archive_scripts_logs_setscene | ||
50 | |||
51 | SSTATETASKS += "do_dumpdata_create_diff_gz" | ||
52 | do_dumpdata_create_diff_gz[sstate-name] = "dumpdata_create_diff_gz" | ||
53 | do_dumpdata_create_diff_gz[sstate-inputdirs] = "${ARCHIVE_SSTATE_DIFFGZ_ENVDATA_INDIR}" | ||
54 | do_dumpdata_create_diff_gz[sstate-outputdirs] = "${ARCHIVE_SSTATE_OUTDIR}" | ||
55 | |||
56 | python do_dumpdata_create_diff_gz_setscene () { | ||
57 | sstate_setscene(d) | ||
58 | } | ||
59 | |||
60 | addtask do_dumpdata_create_diff_gz_setscene | ||
diff --git a/meta/classes/archive-original-source.bbclass b/meta/classes/archive-original-source.bbclass index 1b3f8d0b34..f123cafcb0 100644 --- a/meta/classes/archive-original-source.bbclass +++ b/meta/classes/archive-original-source.bbclass | |||
@@ -8,10 +8,53 @@ | |||
8 | inherit archiver | 8 | inherit archiver |
9 | 9 | ||
10 | # Get original sources archiving package with patches | 10 | # Get original sources archiving package with patches |
11 | do_unpack[postfuncs] += "do_archive_original_sources_patches " | 11 | addtask do_archive_original_sources_patches after do_unpack |
12 | 12 | ||
13 | # Get archiving package with temp(logs) and scripts(.bb and inc files) | 13 | # Get archiving package with temp(logs) and scripts(.bb and inc files) |
14 | do_package_write_rpm[prefuncs] += "do_archive_scripts_logs " | 14 | addtask do_archive_scripts_logs after do_package_write_rpm |
15 | 15 | ||
16 | # Get dump date and create diff file | 16 | # Get dump date and create diff file |
17 | do_package_write_rpm[postfuncs] += "do_dumpdata_create_diff_gz " | 17 | addtask do_dumpdata_create_diff_gz after do_package_write_rpm before do_build |
18 | |||
19 | python () { | ||
20 | if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True) != 'srpm': | ||
21 | """ | ||
22 | If package type is not 'srpm' then add tasks to move archive packages of | ||
23 | original sources and scripts/logs in ${DEPLOY_DIR}/sources. | ||
24 | """ | ||
25 | pn = d.getVar('PN', True) | ||
26 | d.appendVarFlag('do_patch', 'depends', ' %s:do_archive_original_sources_patches' %pn) | ||
27 | build_deps = ' %s:do_archive_original_sources_patches' %pn | ||
28 | build_deps += ' %s:do_archive_scripts_logs' %pn | ||
29 | d.appendVarFlag('do_build', 'depends', build_deps) | ||
30 | |||
31 | else: | ||
32 | d.prependVarFlag('do_unpack', 'postfuncs', "do_archive_original_sources_patches") | ||
33 | d.prependVarFlag('do_package_write_rpm', 'prefuncs', "do_archive_scripts_logs") | ||
34 | } | ||
35 | |||
36 | ARCHIVE_SSTATE_OUTDIR = "${DEPLOY_DIR}/sources/" | ||
37 | ARCHIVE_SSTATE_SCRIPTS_LOGS_INDIR = "${WORKDIR}/script-logs/" | ||
38 | ARCHIVE_SSTATE_DIFFGZ_ENVDATA_INDIR = "${WORKDIR}/diffgz-envdata/" | ||
39 | |||
40 | SSTATETASKS += "do_archive_scripts_logs" | ||
41 | do_archive_scripts_logs[sstate-name] = "archive_scripts_logs" | ||
42 | do_archive_scripts_logs[sstate-inputdirs] = "${ARCHIVE_SSTATE_SCRIPTS_LOGS_INDIR}" | ||
43 | do_archive_scripts_logs[sstate-outputdirs] = "${ARCHIVE_SSTATE_OUTDIR}" | ||
44 | |||
45 | python do_archive_scripts_logs_setscene () { | ||
46 | sstate_setscene(d) | ||
47 | } | ||
48 | |||
49 | addtask do_archive_scripts_logs_setscene | ||
50 | |||
51 | SSTATETASKS += "do_dumpdata_create_diff_gz" | ||
52 | do_dumpdata_create_diff_gz[sstate-name] = "dumpdata_create_diff_gz" | ||
53 | do_dumpdata_create_diff_gz[sstate-inputdirs] = "${ARCHIVE_SSTATE_DIFFGZ_ENVDATA_INDIR}" | ||
54 | do_dumpdata_create_diff_gz[sstate-outputdirs] = "${ARCHIVE_SSTATE_OUTDIR}" | ||
55 | |||
56 | python do_dumpdata_create_diff_gz_setscene () { | ||
57 | sstate_setscene(d) | ||
58 | } | ||
59 | |||
60 | addtask do_dumpdata_create_diff_gz_setscene | ||
diff --git a/meta/classes/archive-patched-source.bbclass b/meta/classes/archive-patched-source.bbclass index 40b2dcb0ea..f9f558e652 100644 --- a/meta/classes/archive-patched-source.bbclass +++ b/meta/classes/archive-patched-source.bbclass | |||
@@ -8,10 +8,53 @@ | |||
8 | inherit archiver | 8 | inherit archiver |
9 | 9 | ||
10 | # Get archiving package with patched sources including patches | 10 | # Get archiving package with patched sources including patches |
11 | do_patch[postfuncs] += "do_archive_patched_sources " | 11 | addtask do_archive_patched_sources after do_patch |
12 | 12 | ||
13 | # Get archiving package with logs(temp) and scripts(.bb and .inc files) | 13 | # Get archiving package with logs(temp) and scripts(.bb and .inc files) |
14 | do_package_write_rpm[prefuncs] += "do_archive_scripts_logs " | 14 | addtask do_archive_scripts_logs after do_package_write_rpm |
15 | 15 | ||
16 | # Get dump date and create diff file | 16 | # Get dump date and create diff file |
17 | do_package_write_rpm[postfuncs] += "do_dumpdata_create_diff_gz " | 17 | addtask do_dumpdata_create_diff_gz after do_package_write_rpm before do_build |
18 | |||
19 | python () { | ||
20 | if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True) != 'srpm': | ||
21 | """ | ||
22 | If package type is not 'srpm' then add tasks to move archive packages of | ||
23 | patched sources and scripts/logs in ${DEPLOY_DIR}/sources. | ||
24 | """ | ||
25 | pn = d.getVar('PN', True) | ||
26 | d.appendVarFlag('do_configure', 'depends', ' %s:do_archive_patched_sources' %pn) | ||
27 | build_deps = ' %s:do_archive_patched_sources' %pn | ||
28 | build_deps += ' %s:do_archive_scripts_logs' %pn | ||
29 | d.appendVarFlag('do_build', 'depends', build_deps) | ||
30 | |||
31 | else: | ||
32 | d.prependVarFlag('do_patch', 'postfuncs', "do_archive_patched_sources") | ||
33 | d.prependVarFlag('do_package_write_rpm', 'prefuncs', "do_archive_scripts_logs") | ||
34 | } | ||
35 | |||
36 | ARCHIVE_SSTATE_OUTDIR = "${DEPLOY_DIR}/sources/" | ||
37 | ARCHIVE_SSTATE_SCRIPTS_LOGS_INDIR = "${WORKDIR}/script-logs/" | ||
38 | ARCHIVE_SSTATE_DIFFGZ_ENVDATA_INDIR = "${WORKDIR}/diffgz-envdata/" | ||
39 | |||
40 | SSTATETASKS += "do_archive_scripts_logs" | ||
41 | do_archive_scripts_logs[sstate-name] = "archive_scripts_logs" | ||
42 | do_archive_scripts_logs[sstate-inputdirs] = "${ARCHIVE_SSTATE_SCRIPTS_LOGS_INDIR}" | ||
43 | do_archive_scripts_logs[sstate-outputdirs] = "${ARCHIVE_SSTATE_OUTDIR}" | ||
44 | |||
45 | python do_archive_scripts_logs_setscene () { | ||
46 | sstate_setscene(d) | ||
47 | } | ||
48 | |||
49 | addtask do_archive_scripts_logs_setscene | ||
50 | |||
51 | SSTATETASKS += "do_dumpdata_create_diff_gz" | ||
52 | do_dumpdata_create_diff_gz[sstate-name] = "dumpdata_create_diff_gz" | ||
53 | do_dumpdata_create_diff_gz[sstate-inputdirs] = "${ARCHIVE_SSTATE_DIFFGZ_ENVDATA_INDIR}" | ||
54 | do_dumpdata_create_diff_gz[sstate-outputdirs] = "${ARCHIVE_SSTATE_OUTDIR}" | ||
55 | |||
56 | python do_dumpdata_create_diff_gz_setscene () { | ||
57 | sstate_setscene(d) | ||
58 | } | ||
59 | |||
60 | addtask do_dumpdata_create_diff_gz_setscene | ||
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') |