cb424d7448
verify-patch-sanity.py validates every active recipe .patch has internally- consistent hunk line counts — catching the 'malformed patch at line N' failure at commit/CI/preflight time instead of hours into a cook. This cycle hit that class three times (qtwaylandscanner, sddm, xwayland), each only discovered when cookbook tried to apply the patch. Running it across the repo found 29 latent malformed patches (validated against GNU patch: e.g. relibc/P3-sysv-ipc reproduces 'malformed patch at line 22'). They were harmless only because they sit in vendored recipes (baked, not re- applied) — but would fail on any version-bump re-derivation. --fix recounts the hunk headers (body untouched) and repaired all 29. Wired into build-preflight.sh (Phase 1.0D) and redbear-ci.yml, with a unit test (test-patch-sanity.sh). Skips archived/legacy trees and unvalidatable formats (empty placeholders, bare-@@ git hunks).
37 lines
1.3 KiB
Python
Executable File
37 lines
1.3 KiB
Python
Executable File
#!/usr/bin/env python
|
|
|
|
# changelog:
|
|
# 10/13/2005b: replaced the # in tmp(.#*)* with alphanumeric and _, this will then remove
|
|
# nodes such as %tmp.1.i and %tmp._i.3
|
|
# 10/13/2005: exntended to remove variables of the form %tmp(.#)* rather than just
|
|
#%tmp.#, i.e. it now will remove %tmp.12.3.15 etc, additionally fixed a spelling error in
|
|
# the comments
|
|
# 10/12/2005: now it only removes nodes and edges for which the label is %tmp.# rather
|
|
# than removing all lines for which the lable CONTAINS %tmp.#
|
|
|
|
from __future__ import print_function
|
|
|
|
import re
|
|
import sys
|
|
|
|
if len(sys.argv) < 3:
|
|
print("usage is: ./DSAclean <dot_file_to_be_cleaned> <out_put_file>")
|
|
sys.exit(1)
|
|
# get a file object
|
|
input = open(sys.argv[1], "r")
|
|
output = open(sys.argv[2], "w")
|
|
# we'll get this one line at a time...while we could just put the whole thing in a string
|
|
# it would kill old computers
|
|
buffer = input.readline()
|
|
while buffer != "":
|
|
if re.compile('label(\s*)=(\s*)"\s%tmp(.\w*)*(\s*)"').search(buffer):
|
|
# skip next line, write neither this line nor the next
|
|
buffer = input.readline()
|
|
else:
|
|
# this isn't a tmp Node, we can write it
|
|
output.write(buffer)
|
|
# prepare for the next iteration
|
|
buffer = input.readline()
|
|
input.close()
|
|
output.close()
|