示例#1
0
文件: cacher.py 项目: 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
示例#2
0
文件: cacher.py 项目: argp/aosd
    def access(cls, release_type, release_info_dict):
        found_manifest = False
        packages = []
        if release_type != None and release_info_dict != None:
            cls.fetch(release_type, release_info_dict.get('name', None))
            release_plist_name = utilities.createcachefilename(release_info_dict.get('prefix', None), release_info_dict.get('version', None))
            cached_file_path = utilities.getcachefile(release_plist_name)

            if os.path.exists(cached_file_path) == True:
                found_manifest = True
                version_manifest_dict = plistlib.readPlist(cached_file_path)
                projects_list = version_manifest_dict.get('projects', None)
                if projects_list != None:
                    for key in projects_list:
                        packages.append(key)
        else:
            logging_helper.getLogger().error('Must supply a release type, set this using the "type" command.')
        return (found_manifest, packages)
示例#3
0
文件: cacher.py 项目: 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)
示例#4
0
文件: cacher.py 项目: 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)