Ejemplo n.º 1
0
    def post(self):
        try:
            req = json.loads(self.request.body)
            if req['method'] != "get_all_builds":
                raise Exception("Unknown method")

            folder_info = backend.get_folder_info(req['params']['device'])
            info = []
            for f in folder_info:
                filename = f['filename']
                if not filename.startswith("cm-13"):
                    continue
                if "delta" in filename:
                    continue

                rom, version, date, channel, device = filename.replace(
                    ".zip", "").split("-")
                version = version.replace(".", "-")
                build_id = 'ghsr.%s.%s-%s.%s' % (device, rom, version, date)

                changelog = backend.get_changelog_url(filename, device)
                download_url = localstore.get_file(filename, device)
                if not download_url:
                    download_url = f['url']

                info.append({
                    'incremental':
                    None,
                    'api_level':
                    23,
                    'url':
                    download_url,
                    'timestamp':
                    backend.timestamp_from_build_date(date),
                    'md5sum':
                    f['md5sum'],
                    'changes':
                    changelog,
                    'channel':
                    'nightly',
                    'filename':
                    filename,
                })
            result = {
                'id': None,
                'result': info,
                'error': None,
            }
            self.response.write(json.dumps(result))
        except Exception, e:
            logging.error("Exception " + str(e))
            self.response.write(json.dumps({'id': None, 'error': str(e)}))
Ejemplo n.º 2
0
    def post(self):
        try:
            req = json.loads(self.request.body)
            if req['method'] != "get_all_builds":
                raise Exception("Unknown method")

            vendor, device, rom, date = backend.extract_version(req['params']['source_incremental'])
            folder_info = backend.get_folder_info(device, rom)
            info = []
            for f in folder_info:
                filename = f['filename']
                if not filename.startswith("cm-12"):
                    continue
                if "delta" in filename:
                    continue

                rom, version, date, channel, device = filename.strip(".zip").split("-")
                version = version.replace(".", "-")
                build_id = 'pawitp.%s.%s-%s.%s' % (device, rom, version, date)
                rom_version = "%s-%s" % (rom, version)

                download_url = localstore.get_file(filename, rom_version)
                if not download_url:
                    download_url = f['url']

                info.append({
                    'incremental': build_id,
                    'api_level': backend.api_level_from_rom(rom_version),
                    'url': download_url,
                    'timestamp': backend.timestamp_from_build_date(date),
                    'md5sum': f['md5sum'],
                    'changes': 'https://%s/changelog/%s' % (os.environ['HTTP_HOST'], build_id),
                    'channel': 'nightly',
                    'filename': filename,
                })
            result = {
                'id': None,
                'result': info,
                'error': None,
            }
            self.response.write(json.dumps(result))
        except Exception, e:
            logging.error("Exception " + str(e))
            self.response.write(json.dumps({'id': None, 'error': str(e)}))
Ejemplo n.º 3
0
    def post(self):
        try:
            req = json.loads(self.request.body)
            if req['method'] != "get_all_builds":
                raise Exception("Unknown method")

            folder_info = backend.get_folder_info(req['params']['device'])
            info = []
            for f in folder_info:
                filename = f['filename']
                if not filename.startswith("cm-13"):
                    continue
                if "delta" in filename:
                    continue

                rom, version, date, channel, device = filename.replace(".zip", "").split("-")
                version = version.replace(".", "-")
                build_id = 'ghsr.%s.%s-%s.%s' % (device, rom, version, date)

                changelog = backend.get_changelog_url(filename, device)
                download_url = localstore.get_file(filename, device)
                if not download_url:
                    download_url = f['url']

                info.append({
                    'incremental': None,
                    'api_level': 23,
                    'url': download_url,
                    'timestamp': backend.timestamp_from_build_date(date),
                    'md5sum': f['md5sum'],
                    'changes': changelog,
                    'channel': 'nightly',
                    'filename': filename,
                })
            result = {
                'id': None,
                'result': info,
                'error': None,
            }
            self.response.write(json.dumps(result))
        except Exception, e:
            logging.error("Exception " + str(e))
            self.response.write(json.dumps({'id': None, 'error': str(e)}))
Ejemplo n.º 4
0
    def post(self):
        try:
            req = json.loads(self.request.body)

            # ghsr.i9105p.cm-13-0.20160616
            vendor, device, rom, date = req['source_incremental'].split(".")
            target_date = req['target_incremental'].split(".")[3]
            target_file = "%s-%s_from_%s_delta-UNOFFICIAL-%s.zip" % (
                backend.get_rom_filename(rom), target_date, date, device)
            logging.info("Looking for " + target_file)

            folder_info = backend.get_folder_info(device)
            info = {}
            for f in folder_info:
                filename = f['filename']
                if filename != target_file:
                    continue

                # Check local GCS bucket
                download_url = localstore.get_file(filename, device)
                if not download_url:
                    download_url = f['url']

                logging.info("Returning: " + download_url)

                info = {
                    'filename':
                    filename,
                    'download_url':
                    download_url,
                    'md5sum':
                    f['md5sum'],
                    'date_created_unix':
                    backend.timestamp_from_build_date(target_date),
                    'incremental':
                    req['target_incremental'],
                }
                break

            self.response.write(json.dumps(info))
        except Exception, e:
            logging.error("Exception " + str(e))
            self.response.write(json.dumps({'errors': str(e)}))
Ejemplo n.º 5
0
    def post(self):
        try:
            req = json.loads(self.request.body)

            # pawitp.i9082.cm-12.20141216
            vendor, device, rom, date = backend.extract_version(req['source_incremental'])
            target_date = backend.extract_version(req['target_incremental'])[3]
            target_file = "%s-%s_from_%s_delta-UNOFFICIAL-%s.zip" % (backend.get_rom_filename(rom), target_date, date, device)
            logging.info("Looking for " + target_file)

            folder_info = backend.get_folder_info(device, rom)
            info = {}
            for f in folder_info:
                filename = f['filename']
                if filename != target_file:
                    continue

                # Check local GCS bucket
                download_url = localstore.get_file(filename, rom)
                if not download_url:
                    download_url = f['url']

                logging.info("Returning: " + download_url)

                info = {
                    'filename': filename,
                    'download_url': download_url,
                    'md5sum': f['md5sum'],
                    'date_created_unix': backend.timestamp_from_build_date(target_date),
                    'incremental': req['target_incremental'],
                }
                break

            self.response.write(json.dumps(info))
        except Exception, e:
            logging.error("Exception " + str(e))
            self.response.write(json.dumps({'errors': str(e)}))