def parse_next_block(args, path, lines, start):
    """
    Parse the next block in an APKINDEX.

    :param path: to the APKINDEX.tar.gz
    :param start: current index in lines, gets increased in this
                  function. Wrapped into a list, so it can be modified
                  "by reference". Example: [5]
    :param lines: all lines from the "APKINDEX" file inside the archive
    :returns: a dictionary with the following structure:
              { "arch": "noarch",
                "depends": ["busybox-extras", "lddtree", ... ],
                "origin": "postmarketos-mkinitfs",
                "pkgname": "postmarketos-mkinitfs",
                "provides": ["mkinitfs=0.0.1"],
                "timestamp": "1500000000",
                "version": "0.0.4-r10" }
              NOTE: "depends" is not set for packages without any dependencies,
                    e.g. musl.
              NOTE: "timestamp" and "origin" are not set for virtual packages
                    (#1273). We use that information to skip these virtual
                    packages in parse().
    :returns: None, when there are no more blocks
    """
    ret = {}
    mapping = {'A': 'arch', 'D': 'depends', 'o': 'origin', 'P': 'pkgname',
        'p': 'provides', 't': 'timestamp', 'V': 'version'}
    end_of_block_found = False
    for i in range(start[0], len(lines)):
        start[0] = i + 1
        line = lines[i]
        if not isinstance(line, str):
            line = line.decode()
        if line == '\n':
            end_of_block_found = True
            break
        for letter, key in mapping.items():
            if line.startswith(letter + ':'):
                if key in ret:
                    raise RuntimeError('Key ' + key + ' (' + letter +
                        ':) specified twice in block: ' + str(ret) +
                        ', file: ' + path)
                ret[key] = line[2:-1]
    if end_of_block_found:
        for key in ['arch', 'pkgname', 'version']:
            if key not in ret:
                raise RuntimeError("Missing required key '" + key +
                    "' in block " + str(ret) + ', file: ' + path)
        for key in ['provides', 'depends']:
            if key in ret and ret[key] != '':
                values = ret[key].split(' ')
                ret[key] = []
                for value in values:
                    if value.startswith('!'):
                        continue
                    for operator in ['>', '=', '<', '~']:
                        if operator in value:
                            value = value.split(operator)[0]
                            break
                    ret[key].append(value)
            else:
                ret[key] = []
        return ret
    elif ret != {}:
        raise RuntimeError('Last block in ' + path +
            ' does not end with a new line! Delete the file and try again. Last block: '
             + str(ret))
    return None
