def info_name(package_name, useinstalldb=False): """Fetch package information for the given package.""" installdb = pisi.db.installdb.InstallDB() packagedb = pisi.db.packagedb.PackageDB() if useinstalldb: package = installdb.get_package(package_name) repo = None else: package, repo = packagedb.get_package_repo(package_name) metadata = pisi.metadata.MetaData() metadata.package = package #FIXME: get it from sourcedb if available metadata.source = None #TODO: fetch the files from server if possible (wow, you maniac -- future exa) if useinstalldb and installdb.has_package(package.name): try: files = installdb.get_files(package.name) except pisi.Error as e: ctx.ui.warning(e) files = None else: files = None return metadata, files, repo
def fetch(packages=[], path=os.path.curdir): """ Fetches the given packages from the repository without installing, just downloads the packages. @param packages: list of package names -> list_of_strings @param path: path to where the packages will be downloaded. If not given, packages will be downloaded to the current working directory. """ packagedb = pisi.db.packagedb.PackageDB() repodb = pisi.db.repodb.RepoDB() for name in packages: package, repo = packagedb.get_package_repo(name) ctx.ui.info( _("%s package found in %s repository") % (package.name, repo)) uri = pisi.uri.URI(package.packageURI) output = os.path.join(path, uri.path()) if os.path.exists( output) and package.packageHash == pisi.util.sha1_file(output): ctx.ui.warning(_("%s package already fetched") % uri.path()) continue if uri.is_absolute_path(): url = str(pkg_uri) else: url = os.path.join(os.path.dirname(repodb.get_repo_url(repo)), str(uri.path())) fetcher.fetch_url(url, path, ctx.ui.Progress)
def fetch(packages=[], path=os.path.curdir): """ Fetches the given packages from the repository without installing, just downloads the packages. @param packages: list of package names -> list_of_strings @param path: path to where the packages will be downloaded. If not given, packages will be downloaded to the current working directory. """ packagedb = pisi.db.packagedb.PackageDB() repodb = pisi.db.repodb.RepoDB() for name in packages: package, repo = packagedb.get_package_repo(name) uri = pisi.uri.URI(package.packageURI) if uri.is_absolute_path(): url = str(pkg_uri) else: url = os.path.join(os.path.dirname(repodb.get_repo_url(repo)), str(uri.path())) fetcher.fetch_url(url, path, ctx.ui.Progress)
def info_name(package_name, useinstalldb=False): """Fetch package information for the given package.""" installdb = pisi.db.installdb.InstallDB() packagedb = pisi.db.packagedb.PackageDB() if useinstalldb: package = installdb.get_package(package_name) repo = None else: package, repo = packagedb.get_package_repo(package_name) metadata = pisi.metadata.MetaData() metadata.package = package #FIXME: get it from sourcedb if available metadata.source = None #TODO: fetch the files from server if possible (wow, you maniac -- future exa) if useinstalldb and installdb.has_package(package.name): try: files = installdb.get_files(package.name) except pisi.Error, e: ctx.ui.warning(e) files = None
def fetch(packages=[], path=os.path.curdir): """ Fetches the given packages from the repository without installing, just downloads the packages. @param packages: list of package names -> list_of_strings @param path: path to where the packages will be downloaded. If not given, packages will be downloaded to the current working directory. """ packagedb = pisi.db.packagedb.PackageDB() repodb = pisi.db.repodb.RepoDB() for name in packages: package, repo = packagedb.get_package_repo(name) ctx.ui.info(_("%s package found in %s repository") % (package.name, repo)) uri = pisi.uri.URI(package.packageURI) output = os.path.join(path, uri.path()) if os.path.exists(output) and package.packageHash == pisi.util.sha1_file(output): ctx.ui.warning(_("%s package already fetched") % uri.path()) continue if uri.is_absolute_path(): url = str(pkg_uri) else: url = os.path.join(os.path.dirname(repodb.get_repo_url(repo)), str(uri.path())) fetcher.fetch_url(url, path, ctx.ui.Progress)