<commit_before>#!/usr/bin/python3
import subprocess
import os
import json
import shutil

def prepare (target):
    #clone the flatpak json
    cmd = ['git', 'submodule', 'update', 'contrib/flatpak']
    subprocess.run (cmd, check=True)

    #clone the submodules for that
    cmd = ['git', 'submodule', 'update', '--init', 'shared-modules/']
    subprocess.run (cmd, cwd='contrib/flatpak', check=True)

    #parse json
    if os.path.isdir ('build'):
        shutil.rmtree ('build')
    data = {}
    with open ('contrib/flatpak/org.freedesktop.fwupd.json', 'r') as rfd:
        data = json.load (rfd)
    platform = 'runtime/%s/x86_64/%s' % (data['runtime'], data['runtime-version'])
    sdk = 'runtime/%s/x86_64/%s' % (data['sdk'], data['runtime-version'])
    num_modules = len (data['modules'])

    #update to build from master
    data["branch"] = "master"
    for index in range(0, num_modules):
        module = data['modules'][index]
        if type (module) != dict or not 'name' in module:
            continue
        name = module['name']
        if not 'fwupd' in name:
            continue
        data['modules'][index]['sources'][0].pop ('url')
        data['modules'][index]['sources'][0].pop ('sha256')
        data['modules'][index]['sources'][0]['type'] = 'dir'
        data['modules'][index]['sources'][0]['skip'] = [".git"]
        data['modules'][index]['sources'][0]['path'] = ".."

    #write json
    os.mkdir('build')
    with open (target, 'w') as wfd:<commit_msg>trivial: ci: fix flatpak build<commit_after>#!/usr/bin/python3
import subprocess
import os
import json
import shutil

def prepare (target):
    #clone the flatpak json
    cmd = ['git', 'submodule', 'update', '--remote', 'contrib/flatpak']
    subprocess.run (cmd, check=True)

    #clone the submodules for that
    cmd = ['git', 'submodule', 'update', '--init', '--remote', 'shared-modules/']
    subprocess.run (cmd, cwd='contrib/flatpak', check=True)

    #parse json
    if os.path.isdir ('build'):
        shutil.rmtree ('build')
    data = {}
    with open ('contrib/flatpak/org.freedesktop.fwupd.json', 'r') as rfd:
        data = json.load (rfd)
    platform = 'runtime/%s/x86_64/%s' % (data['runtime'], data['runtime-version'])
    sdk = 'runtime/%s/x86_64/%s' % (data['sdk'], data['runtime-version'])
    num_modules = len (data['modules'])

    #update to build from master
    data["branch"] = "master"
    for index in range(0, num_modules):
        module = data['modules'][index]
        if type (module) != dict or not 'name' in module:
            continue
        name = module['name']
        if not 'fwupd' in name:
            continue
        data['modules'][index]['sources'][0].pop ('url')
        data['modules'][index]['sources'][0].pop ('sha256')
        data['modules'][index]['sources'][0]['type'] = 'dir'
        data['modules'][index]['sources'][0]['skip'] = [".git"]
        data['modules'][index]['sources'][0]['path'] = ".."

    #write json
    os.mkdir('build')
    with open (target, 'w') as wfd:
{'fraction_non_alphanumeric': 0.19425173439048563, 'fraction_numerical': 0.011892963330029732, 'mean_word_length': 3.130968622100955, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3585507', 'n_tokens_mistral': 996, 'n_tokens_neox': 986, 'n_words': 239}