示例#1
0
    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 = pisi.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'] = u'Ar files for %s' % (self.spec.source.name)
        static_package_obj.description['en'] = u'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(pisi.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(
                pisi.dependency.Dependency(package = p.name))

        return static_package_obj
示例#2
0
    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 = pisi.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'] = u'Ar files for %s' % (
            self.spec.source.name)
        static_package_obj.description['en'] = u'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(
                pisi.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(
                pisi.dependency.Dependency(package=p.name))

        return static_package_obj
示例#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)

                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)
示例#4
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)
示例#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)