Example #1
0
def _findProgPath(prog, db, recipe, error=True):
    # ignore arguments
    prog = prog.split(' ')[0]
    if prog.startswith('/'):
        progPath = prog
    else:
        macros = recipe.macros
        searchPath = [macros.essentialbindir,
                      macros.bindir,
                      macros.essentialsbindir,
                      macros.sbindir]
        searchPath.extend([x for x in ['/bin', '/usr/bin', '/sbin', '/usr/sbin']
                           if x not in searchPath])
        searchPath.extend([x for x in os.getenv('PATH', '').split(os.path.pathsep)
                           if x not in searchPath])
        progPath = util.searchFile(prog, searchPath, error=error)

    if not progPath and not error:
        return None

    progTroveName =  [ x.getName() for x in db.iterTrovesByPath(progPath) ]
    if progTroveName:
        progTroveName = progTroveName[0]
        try:
            if progTroveName in recipe._getTransitiveBuildRequiresNames():
                recipe.reportExcessBuildRequires(progTroveName)
            else:
                recipe.reportMisingBuildRequires(progTroveName)
        except AttributeError:
            # older conary
            pass

    return progPath
Example #2
0
    def searchFilesystem(self, url):
        if url.filePath() == '/':
            return
        path = util.searchFile(url.filePath(), self.localDirs)

        if path:
            raise PathFound(path, False)
Example #3
0
    def searchFilesystem(self, url):
        if url.filePath() == '/':
            return
        path = util.searchFile(url.filePath(), self.localDirs)

        if path:
            raise PathFound(path, False)
Example #4
0
def _findProgPath(prog, db, recipe, error=True):
    # ignore arguments
    prog = prog.split(' ')[0]
    if prog.startswith('/'):
        progPath = prog
    else:
        macros = recipe.macros
        searchPath = [macros.essentialbindir,
                      macros.bindir,
                      macros.essentialsbindir,
                      macros.sbindir]
        searchPath.extend([x for x in ['/bin', '/usr/bin', '/sbin', '/usr/sbin']
                           if x not in searchPath])
        searchPath.extend([x for x in os.getenv('PATH', '').split(os.path.pathsep)
                           if x not in searchPath])
        progPath = util.searchFile(prog, searchPath, error=error)

    if not progPath and not error:
        return None

    progTroveName =  [ x.getName() for x in db.iterTrovesByPath(progPath) ]
    if progTroveName:
        progTroveName = progTroveName[0]
        try:
            if progTroveName in recipe._getTransitiveBuildRequiresNames():
                recipe.reportExcessBuildRequires(progTroveName)
            else:
                recipe.reportMisingBuildRequires(progTroveName)
        except AttributeError:
            # older conary
            pass

    return progPath
Example #5
0
def get_bootloader(parent, image_root, geometry, override=None):
    """
    Choose an appropriate bootloader for the given image and return a
    Bootloader instance used to prepare and install the bootloader.
    """

    grubpath = util.searchFile("grub", util.braceExpand("%s/{sbin,usr/sbin}" % image_root))
    if override == "extlinux" or (
        not override
        and os.path.exists(util.joinPaths(image_root, "sbin/bootman"))
        and os.path.exists(util.joinPaths(image_root, "sbin/extlinux"))
    ):
        return ExtLinuxInstaller(parent, image_root, geometry)
    elif override == "grub2" or (not override and os.path.exists(util.joinPaths(image_root, "usr/sbin/grub2-install"))):
        return Grub2Installer(parent, image_root, geometry)
    elif override == "grub" or (not override and grubpath):
        return GrubInstaller(parent, image_root, geometry, grubpath.replace(image_root, ""))
    log.warning("Could not find extlinux (with bootman) or grub")
    log.warning("No bootloader will be installed!")
    return DummyInstaller(parent, image_root, geometry)