def gen_metadata_xml(self, package): """Generate the metadata.xml file for build source. metadata.xml is composed of the information from specfile plus some additional information.""" metadata = MetaData() metadata.from_spec(self.spec.source, package) metadata.package.distribution = ctx.config.values.general.distribution metadata.package.distributionRelease = ctx.config.values.general.distribution_release metadata.package.architecture = "Any" # FIXME: Bu hatalı. installsize'ı almak için tüm # pkg_install_dir()'ın boyutunu hesaplayamayız. Bir source # birden fazla kaynak üretebilir. package.paths ile # karşılaştırarak file listesinden boyutları hesaplatmalıyız. d = self.bctx.pkg_install_dir() size = util.dir_size(d) metadata.package.installedSize = str(size) # build no if ctx.config.options.ignore_build_no: metadata.package.build = None # means, build no information n/a ctx.ui.warning('build number is not available.') else: metadata.package.build = self.calc_build_no(metadata.package.name) metadata_xml_path = os.path.join(self.bctx.pkg_dir(), ctx.const.metadata_xml) metadata.write(metadata_xml_path) self.metadata = metadata
def gen_metadata_xml(self, package, build_no=None): """Generate the metadata.xml file for build source. metadata.xml is composed of the information from specfile plus some additional information.""" metadata = MetaData() metadata.from_spec(self.spec.source, package) metadata.package.distribution = ctx.config.values.general.distribution metadata.package.distributionRelease = ctx.config.values.general.distribution_release metadata.package.architecture = "Any" metadata.package.packageFormat = ctx.get_option('package_format') size = 0 if package.debug_package: d = self.pkg_debug_dir() else: d = self.pkg_install_dir() for path in package.files: for p in glob.glob(util.join_path(d, path.path)): size += util.dir_size(p) metadata.package.installedSize = size self.metadata = metadata
def gen_metadata_xml(self, package): """Generate the metadata.xml file for build source. metadata.xml is composed of the information from specfile plus some additional information.""" metadata = MetaData() metadata.from_spec(self.spec.source, package) metadata.package.distribution = ctx.config.values.general.distribution metadata.package.distributionRelease = ctx.config.values.general.distribution_release metadata.package.architecture = "Any" size, d = 0, self.pkg_install_dir() for path in package.files: size += util.dir_size(util.join_path(d, path.path)) metadata.package.installedSize = size # build no if ctx.config.options.ignore_build_no: metadata.package.build = None # means, build no information n/a ctx.ui.warning(_('Build number is not available due to --ignore-build')) elif (not ctx.config.values.build.buildno): metadata.package.build = None ctx.ui.warning(_('Build number is not available. For repo builds you must enable buildno in pisi.conf.')) else: metadata.package.build = self.calc_build_no(metadata.package.name) metadata_xml_path = util.join_path(self.pkg_dir(), ctx.const.metadata_xml) metadata.write(metadata_xml_path) self.metadata = metadata
def gen_metadata_xml(self, package, build_no=None): """Generate the metadata.xml file for build source. metadata.xml is composed of the information from specfile plus some additional information.""" metadata = MetaData() metadata.from_spec(self.spec.source, package) metadata.package.distribution = ctx.config.values.general.distribution metadata.package.distributionRelease = ctx.config.values.general.distribution_release metadata.package.architecture = "Any" metadata.package.packageFormat = ctx.get_option('package_format') size = long(0) if package.debug_package: d = self.pkg_debug_dir() else: d = self.pkg_install_dir() for path in package.files: for p in glob.glob(util.join_path(d, path.path)): size += util.dir_size(p) metadata.package.installedSize = size metadata.package.build = build_no metadata_xml_path = util.join_path(self.pkg_dir(), ctx.const.metadata_xml) metadata.write(metadata_xml_path) self.metadata = metadata
def add_path(path): # add the files under material path for fpath, fhash in util.get_file_hashes(path, collisions, install_dir): if ctx.get_option('create_static') \ and fpath.endswith(ctx.const.ar_file_suffix) \ and not package.name.endswith(ctx.const.static_name_suffix) \ and util.is_ar_file(fpath): # if this is an ar file, and this package is not a static package, # don't include this file into the package. continue frpath = util.removepathprefix(install_dir, fpath) # relative path ftype, permanent = get_file_type(frpath, package.files) fsize = long(util.dir_size(fpath)) if not os.path.islink(fpath): st = os.stat(fpath) else: st = os.lstat(fpath) d[frpath] = pisi.files.FileInfo(path=frpath, type=ftype, permanent=permanent, size=fsize, hash=fhash, uid=str(st.st_uid), gid=str(st.st_gid), mode=oct( stat.S_IMODE(st.st_mode))) if stat.S_IMODE(st.st_mode) & stat.S_ISUID: ctx.ui.warning(_("/%s has suid bit set") % frpath)
def add_path(path): # add the files under material path for fpath, fhash in util.get_file_hashes(path, collisions, install_dir): if ( ctx.get_option("create_static") and fpath.endswith(ctx.const.ar_file_suffix) and not package.name.endswith(ctx.const.static_name_suffix) and util.is_ar_file(fpath) ): # if this is an ar file, and this package is not a static package, # don't include this file into the package. continue frpath = util.removepathprefix(install_dir, fpath) # relative path ftype, permanent = get_file_type(frpath, package.files) fsize = long(util.dir_size(fpath)) if not os.path.islink(fpath): st = os.stat(fpath) else: st = os.lstat(fpath) fileinfo = pisi.files.FileInfo( path=frpath, type=ftype, permanent=permanent, size=fsize, hash=fhash, uid=str(st.st_uid), gid=str(st.st_gid), mode=oct(stat.S_IMODE(st.st_mode)), ) files.append(fileinfo) if stat.S_IMODE(st.st_mode) & stat.S_ISUID: ctx.ui.warning(_("/%s has suid bit set") % frpath)
def add_path(path): # add the files under material path for fpath, fhash in util.get_file_hashes(path, collisions, install_dir): if ctx.get_option('create_static') \ and fpath.endswith(ctx.const.ar_file_suffix) \ and not package.name.endswith(ctx.const.static_name_suffix) \ and util.is_ar_file(fpath): # if this is an ar file, and this package is not a static package, # don't include this file into the package. continue frpath = util.removepathprefix(install_dir, fpath) # relative path ftype, permanent = get_file_type(frpath, package.files, install_dir) fsize = util.dir_size(fpath) d[frpath] = FileInfo(path=frpath, type=ftype, permanent=permanent, size=fsize, hash=fhash)
def add_path(path): # add the files under material path for fpath, fhash in util.get_file_hashes(path, collisions, install_dir): if ctx.get_option('create_static') \ and fpath.endswith(ctx.const.ar_file_suffix) \ and not package.name.endswith(ctx.const.static_name_suffix) \ and util.is_ar_file(fpath): # if this is an ar file, and this package is not a static package, # don't include this file into the package. continue frpath = util.removepathprefix(install_dir, fpath) # relative path ftype, permanent = get_file_type(frpath, package.files, install_dir) fsize = long(util.dir_size(fpath)) d[frpath] = FileInfo(path=frpath, type=ftype, permanent=permanent, size=fsize, hash=fhash)