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 = int(util.dir_size(fpath)) if not os.path.islink(fpath): st = os.stat(fpath) else: st = os.lstat(fpath) d[frpath] = pisilinux.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 generate_static_package_object(self): ar_files = [] for root, dirs, files in os.walk(self.pkg_install_dir()): for f in files: if f.endswith(ctx.const.ar_file_suffix) and util.is_ar_file(util.join_path(root, f)): ar_files.append(util.join_path(root, f)) if not len(ar_files): return None static_package_obj = pisilinux.specfile.Package() static_package_obj.name = self.spec.source.name + ctx.const.static_name_suffix # FIXME: find a better way to deal with the summary and description constants. static_package_obj.summary["en"] = "Ar files for %s" % (self.spec.source.name) static_package_obj.description["en"] = "Ar files for %s" % (self.spec.source.name) static_package_obj.partOf = self.spec.source.partOf for f in ar_files: static_package_obj.files.append( pisilinux.specfile.Path(path=f[len(self.pkg_install_dir()) :], fileType="library") ) # append all generated packages to dependencies for p in self.spec.packages: static_package_obj.packageDependencies.append(pisilinux.dependency.Dependency(package=p.name)) return static_package_obj