summaryrefslogtreecommitdiffstats
path: root/meta/classes/archiver.bbclass
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2012-08-24 14:06:59 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-08-29 16:02:09 -0700
commit44b8c1bb30883ebe71005b89b83ec7e43a957bad (patch)
tree8ee140f5d946b44a61e763ddc9436c31df5bb454 /meta/classes/archiver.bbclass
parent4396677ade349c01c8cd0d42b12618723099fbf8 (diff)
downloadpoky-44b8c1bb30883ebe71005b89b83ec7e43a957bad.tar.gz
archiver.bbclass: fix the remove error
* The "tar-package" is used for saving the "Source" list for rpmbuild, there is no such a file when "ARCHIVER_MODE[type] ?= srpm", and there would be errors, it hadn't happen before was becuase that the remove function didn't work. Let the "rpmbuild --rmsource" to remove the Sources, and the remove function will just remove the tar-package file. * Remove several unwanted "try ... exception" sentences, let the error raise rather than ignore them when the error happens. * Remove several un-needed code. [YOCTO #2619] (From OE-Core rev: 6ac3e8be0307ecaea5e92f8bda94f1cd2193a47a) Signed-off-by: Robert Yang <liezhi.yang@windriver.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.bbclass51
1 files changed, 20 insertions, 31 deletions
diff --git a/meta/classes/archiver.bbclass b/meta/classes/archiver.bbclass
index 19c5567714..3146d02b3c 100644
--- a/meta/classes/archiver.bbclass
+++ b/meta/classes/archiver.bbclass
@@ -359,26 +359,22 @@ def store_package(d, package_name):
359 """ 359 """
360 store tarbablls name to file "tar-package" 360 store tarbablls name to file "tar-package"
361 """ 361 """
362 try: 362 f = open(os.path.join(d.getVar('WORKDIR', True), 'tar-package'), 'a')
363 f = open(os.path.join(d.getVar('WORKDIR', True), 'tar-package'), 'a') 363 f.write(package_name + ' ')
364 f.write(package_name + ' ') 364 f.close()
365 f.close()
366 except IOError:
367 pass
368 365
369def get_package(d): 366def get_package(d):
370 """ 367 """
371 get tarballs name from "tar-package" 368 get tarballs name from "tar-package"
372 """ 369 """
373 work_dir = (d.getVar('WORKDIR', True)) 370 work_dir = (d.getVar('WORKDIR', True))
374 tarpackage = os.path.join(work_dir, 'tar-package') 371 tarlist = os.path.join(work_dir, 'tar-package')
375 try: 372 if os.path.exists(tarlist):
376 f = open(tarpackage, 'r') 373 f = open(tarlist, 'r')
377 line = list(set(f.readline().replace('\n', '').split())) 374 line = f.readline().rstrip('\n').split()
378 except UnboundLocalError, IOError: 375 f.close()
379 pass 376 return line
380 f.close() 377 return []
381 return line
382 378
383 379
384def archive_sources_patches(d, stage_name): 380def archive_sources_patches(d, stage_name):
@@ -407,9 +403,9 @@ def archive_sources_patches(d, stage_name):
407 if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True) != 'srpm': 403 if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True) != 'srpm':
408 move_tarball_deploy(d, [source_tar_name, patch_tar_name]) 404 move_tarball_deploy(d, [source_tar_name, patch_tar_name])
409 else: 405 else:
410 tarpackage = os.path.join(d.getVar('WORKDIR', True), 'tar-package') 406 tarlist = os.path.join(d.getVar('WORKDIR', True), 'tar-package')
411 if os.path.exists(tarpackage): 407 if os.path.exists(tarlist):
412 os.remove(tarpackage) 408 os.remove(tarlist)
413 for package in os.path.basename(source_tar_name), patch_tar_name: 409 for package in os.path.basename(source_tar_name), patch_tar_name:
414 if package: 410 if package:
415 store_package(d, str(package) + ' ') 411 store_package(d, str(package) + ' ')
@@ -558,18 +554,11 @@ python do_archive_linux_yocto(){
558do_kernel_checkout[postfuncs] += "do_archive_linux_yocto " 554do_kernel_checkout[postfuncs] += "do_archive_linux_yocto "
559 555
560# remove tarball for sources, patches and logs after creating srpm. 556# remove tarball for sources, patches and logs after creating srpm.
561python do_remove_tarball(){ 557python do_remove_tarlist(){
562 if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True) == 'srpm': 558 work_dir = d.getVar('WORKDIR', True)
563 work_dir = d.getVar('WORKDIR', True) 559 tarlist = os.path.join(work_dir, 'tar-package')
564 try: 560 if os.path.exists(tarlist):
565 for file in os.listdir(os.getcwd()): 561 os.remove(tarlist)
566 if file in get_package(d):
567 os.remove(file)
568 os.remove(os.path.join(work_dir, 'tar-package'))
569 except (TypeError, OSError):
570 pass
571} 562}
572do_remove_tarball[deptask] = "do_archive_scripts_logs" 563do_remove_tarlist[deptask] = "do_archive_scripts_logs"
573do_package_write_rpm[postfuncs] += "do_remove_tarball " 564do_package_write_rpm[postfuncs] += "do_remove_tarlist "
574export get_licenses
575export get_package