def split_build_log(iterable):
    """
    Split a build.log file in chunks.

    @return a list of pairs [(chunk_id, lines)]
    """
    chunks = []
    lines = []
    chunks.append(('None', lines))
    for line in iterable:
        if line.startswith('# Building package'):
            lines = [line]
            chunk_id = line.split()[3]
            chunks.append((chunk_id, lines))
        elif line.startswith('#### CMake'):
            lines = []
            chunk_id = line.split()[-2]
            chunks.append((chunk_id, lines))
        else:
            lines.append(line)
    if chunks[0] == ('None', []):
        chunks.pop(0)
    return chunks
