summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/archiver.bbclass51
-rw-r--r--meta/classes/package_rpm.bbclass25
2 files changed, 27 insertions, 49 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
diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass
index d44ab4c693..2c4c89a256 100644
--- a/meta/classes/package_rpm.bbclass
+++ b/meta/classes/package_rpm.bbclass
@@ -575,16 +575,11 @@ python write_specfile () {
575 spec_files_bottom.append('%s' % "echo \"include logs and patches, Please check them in SOURCES\"") 575 spec_files_bottom.append('%s' % "echo \"include logs and patches, Please check them in SOURCES\"")
576 spec_files_bottom.append('') 576 spec_files_bottom.append('')
577 577
578 # get the name of tarball for sources, patches and logs
579 def get_tarballs(d):
580 if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True) == 'srpm':
581 return get_package(d)
582
583 # append the name of tarball to key word 'SOURCE' in xxx.spec. 578 # append the name of tarball to key word 'SOURCE' in xxx.spec.
584 def tail_source(d,source_list=[],patch_list=None): 579 def tail_source(d):
585 if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True) == 'srpm': 580 if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True) == 'srpm':
581 source_list = get_package(d)
586 source_number = 0 582 source_number = 0
587 patch_number = 0
588 workdir = d.getVar('WORKDIR', True) 583 workdir = d.getVar('WORKDIR', True)
589 for source in source_list: 584 for source in source_list:
590 # The rpmbuild doesn't need the root permission, but it needs 585 # The rpmbuild doesn't need the root permission, but it needs
@@ -593,11 +588,6 @@ python write_specfile () {
593 os.chown("%s/%s" % (workdir, source), 0, 0) 588 os.chown("%s/%s" % (workdir, source), 0, 0)
594 spec_preamble_top.append('Source' + str(source_number) + ': %s' % source) 589 spec_preamble_top.append('Source' + str(source_number) + ': %s' % source)
595 source_number += 1 590 source_number += 1
596 if patch_list:
597 for patch in patch_list:
598 os.chown("%s/%s" % (workdir, patch), 0, 0)
599 print_deps(patch, "Patch" + str(patch_number), spec_preamble_top, d)
600 patch_number += 1
601 # We need a simple way to remove the MLPREFIX from the package name, 591 # We need a simple way to remove the MLPREFIX from the package name,
602 # and dependency information... 592 # and dependency information...
603 def strip_multilib(name, d): 593 def strip_multilib(name, d):
@@ -915,8 +905,7 @@ python write_specfile () {
915 spec_preamble_top.append('Group: %s' % srcsection) 905 spec_preamble_top.append('Group: %s' % srcsection)
916 spec_preamble_top.append('Packager: %s' % srcmaintainer) 906 spec_preamble_top.append('Packager: %s' % srcmaintainer)
917 spec_preamble_top.append('URL: %s' % srchomepage) 907 spec_preamble_top.append('URL: %s' % srchomepage)
918 source_list = get_tarballs(d) 908 tail_source(d)
919 tail_source(d,source_list,None)
920 909
921 # Replaces == Obsoletes && Provides 910 # Replaces == Obsoletes && Provides
922 if srcrreplaces and srcrreplaces.strip() != "": 911 if srcrreplaces and srcrreplaces.strip() != "":
@@ -1151,13 +1140,13 @@ python do_package_rpm () {
1151 cmd = cmd + " --define '_sourcedir " + workdir + "'" 1140 cmd = cmd + " --define '_sourcedir " + workdir + "'"
1152 cmdsrpm = cmd + " --define '_srcrpmdir " + creat_srpm_dir(d) + "'" 1141 cmdsrpm = cmd + " --define '_srcrpmdir " + creat_srpm_dir(d) + "'"
1153 cmdsrpm = cmdsrpm + " -bs " + outspecfile 1142 cmdsrpm = cmdsrpm + " -bs " + outspecfile
1154 cmd = cmd + " -bb " + outspecfile 1143 # Build the .src.rpm
1155
1156 # Build the source rpm package !
1157 if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True) == 'srpm':
1158 d.setVar('SBUILDSPEC', cmdsrpm + "\n") 1144 d.setVar('SBUILDSPEC', cmdsrpm + "\n")
1159 d.setVarFlag('SBUILDSPEC', 'func', '1') 1145 d.setVarFlag('SBUILDSPEC', 'func', '1')
1160 bb.build.exec_func('SBUILDSPEC', d) 1146 bb.build.exec_func('SBUILDSPEC', d)
1147 # Remove the source (SOURCE0, SOURCE1 ...)
1148 cmd = cmd + " --rmsource "
1149 cmd = cmd + " -bb " + outspecfile
1161 1150
1162 # Build the rpm package! 1151 # Build the rpm package!
1163 d.setVar('BUILDSPEC', cmd + "\n") 1152 d.setVar('BUILDSPEC', cmd + "\n")