File: check-missing-install-tag.py

package info (click to toggle)
glib2.0 2.86.1-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental, sid
  • size: 67,012 kB
  • sloc: ansic: 544,596; python: 9,702; sh: 1,612; xml: 1,482; perl: 1,222; cpp: 535; makefile: 321; javascript: 11
file content (51 lines) | stat: -rwxr-xr-x 1,278 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env python3
#
# Copyright © 2022-2024 Collabora, Ltd.
#
# SPDX-License-Identifier: LGPL-2.1-or-later
#
# Original author: Xavier Claessens

"""
This script checks Meson configuration logs to verify no installed file is
missing installation tag.
"""

import argparse
import json
from pathlib import Path


def main():
    parser = argparse.ArgumentParser()
    parser.add_argument("builddir", type=Path, nargs="?", default=".")
    args = parser.parse_args()

    print("# TAP version 13")

    count = 0
    bad = 0
    path = args.builddir / "meson-info" / "intro-install_plan.json"
    with path.open(encoding="utf-8") as f:
        install_plan = json.load(f)
        for target in install_plan.values():
            for info in target.values():
                count += 1

                if not info["tag"]:
                    bad += 1
                    dest = info["destination"]
                    print(f"not ok {bad} - Missing install_tag for {dest}")

    if bad == 0:
        print(f"ok 1 - All {count} installed files have install_tag")
        print("1..1")
        return 0
    else:
        print(f"# {bad}/{count} installed files do not have install_tag")
        print(f"1..{bad}")
        return 1


if __name__ == "__main__":
    exit(main())