Exemple #1
0
    def from_name(name, authinfo = None):
        # download package and return an installer object
        # find package in repository
        sf, reponame = ctx.sourcedb.get_spec_repo(name)
        src = sf.source
        if src:    

            src_uri = URI(src.sourceURI)
            if src_uri.is_absolute_path():
                pkg_path = str(src_uri)
            else:
                repo = ctx.repodb.get_repo(reponame)
                src_path = os.path.join(os.path.dirname(repo.indexuri.get_uri()),
                                        str(src_uri.path()))
    
            ctx.ui.debug(_("Source URI: %s") % src_path)
    
            return Builder(src_path, authinfo)
        else:
            raise Error(_("Source %s not found in any active repository.") % name)
Exemple #2
0
 def from_name(name):
     # download package and return an installer object
     # find package in repository
     repo = packagedb.which_repo(name)
     if repo:
         repo = ctx.repodb.get_repo(repo)
         pkg = packagedb.get_package(name)
 
         # FIXME: let pkg.packageURI be stored as URI type rather than string
         pkg_uri = URI(pkg.packageURI)
         if pkg_uri.is_absolute_path():
             pkg_path = str(pkg.packageURI)
         else:
             pkg_path = os.path.join(os.path.dirname(repo.indexuri.get_uri()),
                                     str(pkg_uri.path()))
 
         ctx.ui.debug(_("Package URI: %s") % pkg_path)
 
         return Install(pkg_path)
     else:
         raise Error(_("Package %s not found in any active repository.") % name)
def install_single_name(name, upgrade = False):
    """install a single package from ID"""
    # find package in repository
    repo = packagedb.which_repo(name)
    if repo:
        repo = ctx.repodb.get_repo(repo)
        pkg = packagedb.get_package(name)

        # FIXME: let pkg.packageURI be stored as URI type rather than string
        pkg_uri = URI(pkg.packageURI)
        if pkg_uri.is_absolute_path():
            pkg_path = str(pkg.packageURI)
        else:
            pkg_path = os.path.join(os.path.dirname(repo.indexuri.get_uri()),
                                    str(pkg_uri.path()))

        ctx.ui.debug(_("Package URI: %s") % pkg_path)

        # Package will handle remote file for us!
        install_single_file(pkg_path, upgrade)
    else:
        raise Error(_("Package %s not found in any active repository.") % name)
Exemple #4
0
    def from_name(name):
        # download package and return an installer object
        # find package in repository
        sf, reponame = ctx.sourcedb.get_spec_repo(name)
        src = sf.source
        if src:

            src_uri = URI(src.sourceURI)
            if src_uri.is_absolute_path():
                src_path = str(src_uri)
            else:
                repo = ctx.repodb.get_repo(reponame)
                #FIXME: don't use dirname to work on URLs
                src_path = os.path.join(
                    os.path.dirname(repo.indexuri.get_uri()),
                    str(src_uri.path()))

            ctx.ui.debug(_("Source URI: %s") % src_path)

            return Builder(src_path)
        else:
            raise Error(
                _("Source %s not found in any active repository.") % name)
Exemple #5
0
    def from_name(name, ignore_dep=None):
        # download package and return an installer object
        # find package in repository
        repo = ctx.packagedb.which_repo(name)
        if repo:
            ctx.ui.info(_("Package %s found in repository %s") % (name, repo))
            repo = ctx.repodb.get_repo(repo)
            pkg = ctx.packagedb.get_package(name)

            # FIXME: let pkg.packageURI be stored as URI type rather than string
            pkg_uri = URI(pkg.packageURI)
            if pkg_uri.is_absolute_path():
                pkg_path = str(pkg.packageURI)
            else:
                pkg_path = os.path.join(
                    os.path.dirname(repo.indexuri.get_uri()),
                    str(pkg_uri.path()))

            ctx.ui.info(_("Package URI: %s") % pkg_path, verbose=True)

            return Install(pkg_path, ignore_dep)
        else:
            raise Error(
                _("Package %s not found in any active repository.") % name)