mirror of
https://git.yoctoproject.org/poky
synced 2026-09-20 03:49:32 +02:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
8e849a23e9
commit
2b1afa10bc
@@ -94,9 +94,11 @@ def get_bb_inc(d):
|
||||
work_dir = d.getVar('WORKDIR', True)
|
||||
bbfile = d.getVar('FILE', True)
|
||||
bbdir = os.path.dirname(bbfile)
|
||||
script_logs = os.path.join(work_dir, 'script-logs')
|
||||
target_sys = d.getVar('TARGET_SYS', True)
|
||||
pf = d.getVar('PF', True)
|
||||
licenses = get_licenses(d)
|
||||
script_logs = os.path.join(work_dir, 'script-logs/'+ target_sys + '/' + licenses + '/' + pf + '/script-logs')
|
||||
bb_inc = os.path.join(script_logs, 'bb_inc')
|
||||
bb.mkdirhier(script_logs)
|
||||
bb.mkdirhier(bb_inc)
|
||||
|
||||
def find_file(dir, file):
|
||||
@@ -124,6 +126,18 @@ def get_bb_inc(d):
|
||||
for bbincfile in bbinc:
|
||||
shutil.copy(bbincfile, bb_inc)
|
||||
|
||||
return script_logs
|
||||
|
||||
def get_logs(d):
|
||||
"""
|
||||
create a directory "script-logs" in ${WORKDIR}
|
||||
"""
|
||||
work_dir = d.getVar('WORKDIR', True)
|
||||
target_sys = d.getVar('TARGET_SYS', True)
|
||||
pf = d.getVar('PF', True)
|
||||
licenses = get_licenses(d)
|
||||
script_logs = os.path.join(work_dir, 'script-logs/'+ target_sys + '/' + licenses + '/' + pf + '/script-logs')
|
||||
|
||||
try:
|
||||
bb.mkdirhier(os.path.join(script_logs, 'temp'))
|
||||
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):
|
||||
work_dir = d.getVar('WORKDIR', True)
|
||||
log_dir = os.path.basename(logdir)
|
||||
tarname = pf + '-' + log_dir + ".tar.gz"
|
||||
tarname = do_tarball(work_dir, log_dir, tarname)
|
||||
archive_dir = os.path.join( logdir, '..' )
|
||||
tarname = do_tarball(archive_dir, log_dir, tarname)
|
||||
if bbinc:
|
||||
shutil.rmtree(logdir, ignore_errors=True)
|
||||
return tarname
|
||||
@@ -414,6 +429,7 @@ def archive_scripts_logs(d):
|
||||
archive scripts and logs. scripts include .bb and .inc files and
|
||||
logs include stuff in "temp".
|
||||
"""
|
||||
import shutil
|
||||
|
||||
if tar_filter(d):
|
||||
return
|
||||
@@ -421,18 +437,20 @@ def archive_scripts_logs(d):
|
||||
temp_dir = os.path.join(work_dir, 'temp')
|
||||
source_archive_log_with_scripts = d.getVar('SOURCE_ARCHIVE_LOG_WITH_SCRIPTS', True)
|
||||
if source_archive_log_with_scripts == 'logs_with_scripts':
|
||||
logdir = get_logs(d)
|
||||
logdir = get_bb_inc(d)
|
||||
tarlog = archive_logs(d, logdir, True)
|
||||
elif source_archive_log_with_scripts == 'logs':
|
||||
if os.path.exists(temp_dir):
|
||||
tarlog = archive_logs(d, temp_dir, False)
|
||||
logdir = get_logs(d)
|
||||
else:
|
||||
return
|
||||
|
||||
if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True) != 'srpm':
|
||||
move_tarball_deploy(d, [tarlog])
|
||||
tarlog = archive_logs(d, logdir, True)
|
||||
|
||||
else:
|
||||
if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True) == 'srpm':
|
||||
if os.path.exists(work_dir+ '/' + tarlog):
|
||||
os.remove(work_dir+ '/' + tarlog)
|
||||
shutil.move(os.path.join(logdir, '..', tarlog), work_dir)
|
||||
shutil.rmtree(os.path.join(work_dir,'script-logs'))
|
||||
store_package(d, tarlog)
|
||||
|
||||
def dumpdata(d):
|
||||
@@ -449,7 +467,7 @@ def dumpdata(d):
|
||||
pf = d.getVar('PF', True)
|
||||
target_sys = d.getVar('TARGET_SYS', True)
|
||||
licenses = get_licenses(d)
|
||||
dumpdir = d.getVar('DEPLOY_DIR', True) + '/sources/' + target_sys + '/' + licenses + '/' + pf
|
||||
dumpdir = os.path.join(workdir, 'diffgz-envdata/'+ target_sys + '/' + licenses + '/' + pf )
|
||||
if not os.path.exists(dumpdir):
|
||||
bb.mkdirhier(dumpdir)
|
||||
|
||||
@@ -480,7 +498,7 @@ def create_diff_gz(d):
|
||||
pf = d.getVar('PF', True)
|
||||
licenses = get_licenses(d)
|
||||
target_sys = d.getVar('TARGET_SYS', True)
|
||||
diff_dir = d.getVar('DEPLOY_DIR', True) + '/sources/' + target_sys + '/' + licenses + '/' + pf
|
||||
diff_dir = os.path.join(work_dir, 'diffgz-envdata/'+ target_sys + '/' + licenses + '/' + pf )
|
||||
diff_file = os.path.join(diff_dir, bb.data.expand("${P}-${PR}.diff.gz",d))
|
||||
|
||||
f = open(os.path.join(work_dir,'temp/exclude-from-file'), 'a')
|
||||
|
||||
Reference in New Issue
Block a user