Exemplo n.º 1
0
Arquivo: cacher.py Projeto: argp/aosd
    def get(cls, release_type, release_version):
        files = None
        if release_type != None:
            if release_version != None:
                release_info_dict = releases.getInfo(release_type, release_version)
                release_plist_name = utilities.createcachefilename(release_info_dict['prefix'], release_info_dict['version'])
                cached_file_path = utilities.getcachefile(release_plist_name)

                if os.path.exists(cached_file_path) == True:
                    return cached_file_path

            else:
                files = []
                type_versions = versions.get(release_type)
                for version in type_versions:
                    release_version_info = releases.getInfo(release_type, version)
                    path = cls.get(release_type, release_version_info['name'])
                    if path != None:
                        files.append(path)
        else:
            files = {}
            types = releases.get()
            for type_name in types:
                packages = cls.get(type_name, None)
                if len(packages) > 0:
                    files[type_name] = packages
        return files
Exemplo n.º 2
0
Arquivo: cacher.py Projeto: argp/aosd
    def fetch(cls, release_type, release_version):
        if release_type != None:
            if release_version != None:
                release_info_dict = releases.getInfo(release_type, release_version)
                release_plist_name = utilities.createcachefilename(release_info_dict['prefix'], release_info_dict['version'])
                cached_file_path = utilities.getcachefile(release_plist_name)

                if os.path.exists(cached_file_path) == False:
                    logging_helper.getLogger().info('Downloading version manifest ('+release_plist_name+')...')
                    manager.DownloadPackageManifest(cached_file_path)
            else:
                type_versions = versions.get(release_type)
                for version in type_versions:
                    release_version_info = releases.getInfo(release_type, version)
                    cls.fetch(release_type, release_version_info['name'])
        else:
            types = releases.get()
            for type_name in types:
                cls.fetch(type_name, None)
Exemplo n.º 3
0
 def get(cls, release_type, version):
     packages = []
     if version == None:
         packages = cls.list(release_type)
     else:
         release_info = releases.getInfo(release_type, version)
         cache_result = cacher.access(release_type, release_info)
         if cache_result[0] == True:
             packages = cache_result[1]
         else:
             logging_helper.getLogger().error('Could not find any packages. If you think this is an error, please run the "cache rebuild" command.')
     return sorted(packages)
Exemplo n.º 4
0
Arquivo: cacher.py Projeto: argp/aosd
    def flush(cls, release_type, release_version):
        if release_type == None and release_version == None:
            settings = config.read()
            settings['first_run'] = True
            config.write(settings)
        if release_type != None:
            if release_version != None:
                release_info_dict = releases.getInfo(release_type, release_version)
                release_plist_name = utilities.createcachefilename(release_info_dict['prefix'], release_info_dict['version'])
                cached_file_path = utilities.getcachefile(release_plist_name)

                if os.path.exists(cached_file_path) == True:
                    logging_helper.getLogger().info('Removing version manifest ('+release_plist_name+')...')
                    manager.RemovePackageManifest(cached_file_path)
            else:
                type_versions = versions.get(release_type)
                for version in type_versions:
                    release_version_info = releases.getInfo(release_type, version)
                    cls.flush(release_type, release_version_info['name'])
        else:
            types = releases.get()
            for type_name in types:
                cls.flush(type_name, None)