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>
This commit is contained in:
Robert Yang
2012-08-24 14:06:59 +08:00
committed by Richard Purdie
parent 4396677ade
commit 44b8c1bb30
2 changed files with 27 additions and 49 deletions

View File

@@ -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")