def gen_files_xml(self, package): """Generetes files.xml using the path definitions in specfile and generated files by the build system.""" files = Files() install_dir = self.bctx.pkg_install_dir() collisions = check_path_collision(package, self.spec.packages) if collisions: raise Error(_('Path collisions detected')) d = {} for pinfo in package.paths: path = install_dir + pinfo.pathname for fpath, fhash in util.get_file_hashes(path, collisions, install_dir): frpath = util.removepathprefix(install_dir, fpath) # relative path ftype = get_file_type(frpath, package.paths) try: # broken links can cause problem fsize = str(os.path.getsize(fpath)) except OSError: fsize = "0" d[frpath] = FileInfo(frpath, ftype, fsize, fhash) for (p, fileinfo) in d.iteritems(): files.append(fileinfo) files_xml_path = os.path.join(self.bctx.pkg_dir(), ctx.const.files_xml) files.write(files_xml_path) self.files = files
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): frpath = util.removepathprefix(install_dir, fpath) # relative path ftype = get_file_type(frpath, package.files) try: # broken links and empty dirs can cause problem fsize = os.path.getsize(fpath) except OSError: fsize = None d[frpath] = FileInfo(path=frpath, type=ftype, 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 = 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)