コード例 #1
0
ファイル: pisitools.py プロジェクト: hknyldz/pisitools
def doman(*sourceFiles):
    '''inserts the man pages in the list of files into /usr/share/man/'''

    '''example call: pisilinuxtools.doman("man.1", "pardus.*")'''
    manDIR = join_path(get.installDIR(), get.manDIR())
    if not can_access_directory(manDIR):
        makedirs(manDIR)

    for sourceFile in sourceFiles:
        sourceFileGlob = glob.glob(sourceFile)
        if len(sourceFileGlob) == 0:
            raise FileError(_("No file matched pattern \"%s\"") % sourceFile)

        for source in sourceFileGlob:
            compressed = source.endswith("gz") and source
            if compressed:
                source = source[:-3]
            try:
                pageName, pageDirectory = source[:source.rindex('.')], \
                                          source[source.rindex('.')+1:]
            except ValueError:
                error(_('ActionsAPI [doman]: Wrong man page file: %s') % (source))

            manPDIR = join_path(manDIR, '/man%s' % pageDirectory)
            makedirs(manPDIR)
            if not compressed:
                system('install -m0644 %s %s' % (source, manPDIR))
            else:
                uncompress(compressed, targetDir=manPDIR)
コード例 #2
0
ファイル: build.py プロジェクト: hknyldz/pisitools
    def apply_patches(self):
        files_dir = os.path.abspath(util.join_path(self.specdir, ctx.const.files_dir))

        for patch in self.spec.source.patches:
            patchFile = util.join_path(files_dir, patch.filename)
            relativePath = patch.filename
            reverseApply = patch.reverse and patch.reverse.lower() == "true"
            if patch.compressionType:
                patchFile = util.uncompress(
                    patchFile, compressType=patch.compressionType, targetDir=ctx.config.tmp_dir()
                )
                relativePath = relativePath.rsplit(".%s" % patch.compressionType, 1)[0]

            ctx.ui.action(_("Applying patch: %s") % patch.filename)
            util.do_patch(self.pkg_src_dir(), patchFile, level=patch.level, name=relativePath, reverse=reverseApply)
        return True