From 44b8c1bb30883ebe71005b89b83ec7e43a957bad Mon Sep 17 00:00:00 2001 From: Robert Yang Date: Fri, 24 Aug 2012 14:06:59 +0800 Subject: 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 Signed-off-by: Saul Wold Signed-off-by: Richard Purdie --- meta/classes/package_rpm.bbclass | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) (limited to 'meta/classes/package_rpm.bbclass') 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 () { spec_files_bottom.append('%s' % "echo \"include logs and patches, Please check them in SOURCES\"") spec_files_bottom.append('') - # get the name of tarball for sources, patches and logs - def get_tarballs(d): - if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True) == 'srpm': - return get_package(d) - # append the name of tarball to key word 'SOURCE' in xxx.spec. - def tail_source(d,source_list=[],patch_list=None): + def tail_source(d): if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True) == 'srpm': + source_list = get_package(d) source_number = 0 - patch_number = 0 workdir = d.getVar('WORKDIR', True) for source in source_list: # The rpmbuild doesn't need the root permission, but it needs @@ -593,11 +588,6 @@ python write_specfile () { os.chown("%s/%s" % (workdir, source), 0, 0) spec_preamble_top.append('Source' + str(source_number) + ': %s' % source) source_number += 1 - if patch_list: - for patch in patch_list: - os.chown("%s/%s" % (workdir, patch), 0, 0) - print_deps(patch, "Patch" + str(patch_number), spec_preamble_top, d) - patch_number += 1 # We need a simple way to remove the MLPREFIX from the package name, # and dependency information... def strip_multilib(name, d): @@ -915,8 +905,7 @@ python write_specfile () { spec_preamble_top.append('Group: %s' % srcsection) spec_preamble_top.append('Packager: %s' % srcmaintainer) spec_preamble_top.append('URL: %s' % srchomepage) - source_list = get_tarballs(d) - tail_source(d,source_list,None) + tail_source(d) # Replaces == Obsoletes && Provides if srcrreplaces and srcrreplaces.strip() != "": @@ -1151,13 +1140,13 @@ python do_package_rpm () { cmd = cmd + " --define '_sourcedir " + workdir + "'" cmdsrpm = cmd + " --define '_srcrpmdir " + creat_srpm_dir(d) + "'" cmdsrpm = cmdsrpm + " -bs " + outspecfile - cmd = cmd + " -bb " + outspecfile - - # Build the source rpm package ! - if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True) == 'srpm': + # Build the .src.rpm d.setVar('SBUILDSPEC', cmdsrpm + "\n") d.setVarFlag('SBUILDSPEC', 'func', '1') bb.build.exec_func('SBUILDSPEC', d) + # Remove the source (SOURCE0, SOURCE1 ...) + cmd = cmd + " --rmsource " + cmd = cmd + " -bb " + outspecfile # Build the rpm package! d.setVar('BUILDSPEC', cmd + "\n") -- cgit v1.2.3-54-g00ecf