예제 #1
0
파일: build.py 프로젝트: Tayyib/uludag
    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
예제 #2
0
        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)
예제 #3
0
        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)
예제 #4
0
파일: build.py 프로젝트: Tayyib/uludag
 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)
예제 #5
0
 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)
예제 #6
0
 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)