"""
store tarbablls name to file "tar-package"
"""
- try:
- f = open(os.path.join(d.getVar('WORKDIR', True), 'tar-package'), 'a')
- f.write(package_name + ' ')
- f.close()
- except IOError:
- pass
+ f = open(os.path.join(d.getVar('WORKDIR', True), 'tar-package'), 'a')
+ f.write(package_name + ' ')
+ f.close()
def get_package(d):
"""
get tarballs name from "tar-package"
"""
work_dir = (d.getVar('WORKDIR', True))
- tarpackage = os.path.join(work_dir, 'tar-package')
- try:
- f = open(tarpackage, 'r')
- line = list(set(f.readline().replace('\n', '').split()))
- except UnboundLocalError, IOError:
- pass
- f.close()
- return line
+ tarlist = os.path.join(work_dir, 'tar-package')
+ if os.path.exists(tarlist):
+ f = open(tarlist, 'r')
+ line = f.readline().rstrip('\n').split()
+ f.close()
+ return line
+ return []
def archive_sources_patches(d, stage_name):
if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True) != 'srpm':
move_tarball_deploy(d, [source_tar_name, patch_tar_name])
else:
- tarpackage = os.path.join(d.getVar('WORKDIR', True), 'tar-package')
- if os.path.exists(tarpackage):
- os.remove(tarpackage)
+ tarlist = os.path.join(d.getVar('WORKDIR', True), 'tar-package')
+ if os.path.exists(tarlist):
+ os.remove(tarlist)
for package in os.path.basename(source_tar_name), patch_tar_name:
if package:
store_package(d, str(package) + ' ')
do_kernel_checkout[postfuncs] += "do_archive_linux_yocto "
# remove tarball for sources, patches and logs after creating srpm.
-python do_remove_tarball(){
- if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True) == 'srpm':
- work_dir = d.getVar('WORKDIR', True)
- try:
- for file in os.listdir(os.getcwd()):
- if file in get_package(d):
- os.remove(file)
- os.remove(os.path.join(work_dir, 'tar-package'))
- except (TypeError, OSError):
- pass
+python do_remove_tarlist(){
+ work_dir = d.getVar('WORKDIR', True)
+ tarlist = os.path.join(work_dir, 'tar-package')
+ if os.path.exists(tarlist):
+ os.remove(tarlist)
}
-do_remove_tarball[deptask] = "do_archive_scripts_logs"
-do_package_write_rpm[postfuncs] += "do_remove_tarball "
-export get_licenses
-export get_package
+do_remove_tarlist[deptask] = "do_archive_scripts_logs"
+do_package_write_rpm[postfuncs] += "do_remove_tarlist "
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
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):
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() != "":
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")