[Git][reproducible-builds/reproducible-notes][master] Add auto-classify script.

Chris Lamb gitlab at salsa.debian.org
Tue Feb 16 11:45:47 UTC 2021



Chris Lamb pushed to branch master at Reproducible Builds / reproducible-notes


Commits:
6f5acfc5 by Chris Lamb at 2021-02-16T11:44:25+00:00
Add auto-classify script.

- - - - -


1 changed file:

- + bin/auto-classify


Changes:

=====================================
bin/auto-classify
=====================================
@@ -0,0 +1,127 @@
+#!/usr/bin/env python3
+
+import re
+import json
+import fileinput
+
+
+def walk_json(elem):
+    if isinstance(elem, list):
+        for x in elem:
+            for y in walk_json(x):
+                yield y
+        return
+
+    if not isinstance(elem, dict):
+        return
+
+    for k, v in elem.items():
+        for y in walk_json(v):
+            yield y
+
+        if k != "source1":
+            continue
+
+        if v.endswith(".qch"):
+            yield "timestamps_in_qhc"
+
+        if v.endswith(".h5ad"):
+            yield "captures_build_path_in_hd5_database_files"
+
+        if v.endswith(".3d"):
+            yield "timestamps_in_3d_files_created_by_survex"
+
+        if v.endswith("/direct_url.json"):
+            yield "build_path_in_direct_url_json_file_generated_by_flit"
+
+        if v.endswith(".cmt"):
+            yield "randomness_in_ocaml_cmti_files"
+
+        if v.endswith(".bc"):
+            yield "randomness_in_postgres_opcodes"
+
+        if v.endswith("/searchindex.js"):
+            yield "randomness_in_documentation_generated_by_sphinx"
+
+        if v.endswith("/navtreeindex2.js"):
+            yield "nondeterministic_ordering_in_documentation_generated_by_doxygen"
+
+        diff = elem["unified_diff"]
+
+        if not diff:
+            continue
+
+        if v.endswith(".ppu") and "202" in diff:
+            yield "timestamps_in_ppu_generated_by_fpc"
+
+        if "qt_resource_data" in diff:
+            yield "timestamps_in_source_generated_by_rcc"
+
+        if v.endswith(".html") and "/build/1st/" in diff and "Doxygen" in diff:
+            yield "absolute_build_dir_in_docs_generated_by_doxygen_ref"
+
+        if v.endswith(".beam") and "/build/1st/" in diff:
+            yield "captures_build_path_in_beam_cma_cmt_files"
+
+        if (
+            v.endswith(".py")
+            and "Form implementation generated from reading ui file" in diff
+        ):
+            yield "build_path_captured_by_pyuic5"
+
+        if "hevea" in diff and "/build/1st/" in diff:
+            yield "hevea_captures_build_path"
+
+        if v.endswith(".pdf") and "CreationDate" in diff and "DAPS" in diff:
+            yield "timestamps_in_pdf_generated_by_daps"
+
+        if v.endswith(".el") and "Generated package description" in diff:
+            yield "build_path_captured_in_emacs_el_file"
+
+        if v.endswith(".prl") and "/build/1st/" in diff:
+            yield "captures_build_dir_in_qmake_prl_files"
+
+        if v.endswith("ppudump {}") and "2021/" in diff:
+            yield "timestamps_in_ppu_generated_by_fpc"
+
+        if v.startswith("msgunfmt {}") and "PO-Revision-Date" in diff:
+            yield "different_pot_creation_date_in_gettext_mo_files"
+
+        if v.startswith("msgunfmt {}") and "PO-Revision-Date" in diff:
+            yield "different_pot_creation_date_in_gettext_mo_files"
+
+        if v.startswith("readelf "):
+            if "note.go.buildid" in diff:
+                yield "randomness_in_binaries_generated_by_golang"
+
+            if "/build/1st/octave-" in diff:
+                yield "build_path_captured_by_octave"
+
+        if v.startswith("objdump "):
+            if "../../../../../usr/" in diff:
+                yield "captures_varying_number_of_build_path_directory_components"
+
+            if re.search(r"-/build/1st/[^\n]+/\w+\.(c|h|cpp)]:\d+\n", diff):
+                yield "captures_build_path_via_assert"
+
+            elif re.search(r"-/build/1st/", diff):
+                if "caml" in diff:
+                    yield "ocaml_captures_build_path"
+                elif "octave-" in diff:
+                    yield "build_path_captured_by_octave"
+                else:
+                    yield "captures_build_path"
+
+        if v.startswith("strings "):
+            if "__pyx" in diff:
+                yield "random_hashes_in_cython_output"
+
+            if "-ffile-prefix-map=/build/" in diff:
+                yield "records_build_flags"
+
+
+if __name__ == "__main__":
+    raw = "".join(fileinput.input())
+
+    for x in walk_json(json.loads(raw)):
+        print(x)



View it on GitLab: https://salsa.debian.org/reproducible-builds/reproducible-notes/-/commit/6f5acfc5a95df1c4f355a0a7902ec14c2126b300

-- 
View it on GitLab: https://salsa.debian.org/reproducible-builds/reproducible-notes/-/commit/6f5acfc5a95df1c4f355a0a7902ec14c2126b300
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20210216/f37fd30c/attachment.htm>


More information about the rb-commits mailing list