def __copy_dependent_file(src_path, dst_path, tagfiles): if tagfiles == None or len(tagfiles) == 0: DataOper.copy_tree_ex(src_path, dst_path, [".svn"], ["*"], True) print "copy %s to %s" % (src_path, dst_path) return if not os.path.isdir(dst_path): os.makedirs(dst_path) for tagfile in tagfiles: if not os.path.exists(src_path + '/' + tagfile): print 'Can not found ' + src_path + '/' + tagfile sys.exit(Errors.file_or_dir_exists) shutil.copyfile(src_path + '/' + tagfile, dst_path + '/' + tagfile) print "copy %s to %s" % (src_path + '/' + tagfile, dst_path + '/' + tagfile) return
def __make_component_all_package(build_home, distribution, cmode): os.chdir(build_home) Util.execute_and_output('mkdir -p ' + build_home + os.sep + '.package') print "Create dir [.package] OK!" target_prefix = distribution["packname"] + \ '-' + distribution["version"] + \ '-' + Glo.CPU + \ '-' + Glo.SYSTEM + \ '-' + cmode[:2] + 'bit' + '-full' + Glo.PACK_SUFFIX src_path = build_home + os.sep + 'src' + os.sep + 'deps' dst_path = build_home + os.sep + '.package' + os.sep + target_prefix + os.sep + 'deps' DataOper.copy_tree_ex(src_path, dst_path, [".svn"], ["*"], True) print "copy %s to %s" % (src_path, dst_path) src_path = build_home + '/.build' dst_path = build_home + '/.package/' + target_prefix DataOper.copy_tree_ex(src_path, dst_path, [".svn"], ["*"], True) print "copy %s to %s" % (src_path, dst_path) shutil.copy2(build_home + '/src/VERSION', build_home + '/.package/' + target_prefix) os.chdir(build_home + os.sep + '.package') print "Cd " + build_home + os.sep + '.package' Util.execute_and_output('tar cvf ' + target_prefix + '.tar ' + target_prefix) print 'Generate ' + target_prefix + '.tar' + ' OK!' Util.execute_and_output('gzip ' + target_prefix + '.tar') print('Zip ' + target_prefix + '.tar' + ' OK!') os.chdir(build_home) print('Cd ' + build_home) Util.execute_and_output('mv .package/' + target_prefix + '.tar.gz ' + 'distributions') Util.execute_and_output('rm -fr ' + build_home + '/.package') print 'Del [.package] OK!' print 'Make target [' + target_prefix + '.tar.gz] OK!'
def __make_package(build_home, distribution, cmode): os.chdir(build_home) Util.execute_and_output('mkdir -p ' + build_home + os.sep + '.package') print "Create dir [.package] OK!" target_prefix = distribution["packname"] + \ '-' + distribution["version"] + \ '-' + Glo.CPU + \ '-' + Glo.SYSTEM + \ '-' + cmode[:2] + 'bit' + Glo.PACK_SUFFIX src_path = build_home + os.sep + 'src' dst_path = build_home + os.sep + '.package' + os.sep + target_prefix DataOper.copy_tree_ex(src_path, dst_path, [".svn"], ["*"], True) print "copy %s to %s" % (src_path, dst_path) os.chdir(build_home + os.sep + '.package') print "Cd " + build_home + os.sep + '.package' Util.execute_and_output('tar cvf ' + target_prefix + '.tar ' + target_prefix) print 'Generate ' + target_prefix + '.tar' + ' OK!' Util.execute_and_output('gzip ' + target_prefix + '.tar') print('Zip ' + target_prefix + '.tar' + ' OK!') os.chdir(build_home) print('Cd ' + build_home) des_path = 'distributions' if not os.path.exists(des_path): os.mkdir(des_path) Util.execute_and_output('mv .package/' + target_prefix + '.tar.gz ' + des_path) Util.execute_and_output('rm -fr ' + build_home + '/.package') print 'Del [.package] OK!' print('Make target [' + target_prefix + '.tar.gz] OK!')