in shared/lib/check_src_headers.py [0:0]
def check_headers(dir):
logger.info("Checking path: " + dir)
file_provider = FileProvider()
os.chdir(file_provider.repo_dir)
file_provider.set_exclude_files([
".*\.css$",
".*\.csv$",
".*\.diff$",
".*\.f$",
".*\.JPG$",
".*\.jpg$",
".*\.md$",
".*\.patch$",
".*\.PNG$",
".*\.png$",
".*\.pdf$",
".*\.pptx$",
".*\.txt$",
".*\.xdc$",
".*\.xlsx$",
".*\.xml$",
".*\.fio$",
".*\.gitignore$",
".*\.gitmodules$",
".*Jenkinsfile.*",
".*supported_vivado_versions\.txt$",
"hdk/.*/ccf_ctl\.v$",
"hdk/.*/design_error\.inc$",
"hdk/.*/flop_ccf\.sv$",
"hdk/.*/flop_fifo_2\.sv$",
"hdk/.*/flop_fifo_lu\.sv$",
"hdk/.*/flop_fifo\.sv$",
"hdk/.*/ft_fifo_p2\.v$",
"hdk/.*/ft_fifo_p\.v$",
"hdk/.*/ft_fifo\.v$",
"hdk/.*/gray\.inc$",
"hdk/.*/lib_pipe\.sv$",
"hdk/.*/push_2_fifo_double_pop\.sv$",
"hdk/.*/push_2_fifo_guts\.inc$",
"hdk/.*/push_2_fifo\.sv$",
"hdk/.*/ram_2p_bit_en\.v$",
"hdk/.*/ram_2p_dc\.v$",
"hdk/.*/ram_2p_syn\.v$",
"hdk/.*/ram_2p_trial_synth\.v$",
"hdk/.*/ram_2p\.v$",
"hdk/.*/rr_arb\.sv$",
"hdk/.*/sync\.v$",
"hdk/.*/README$",
"hdk/.*/hdk_version\.txt$",
"hdk/.*/dest_register_slice\.v$",
"hdk/.*/src_register_slice\.v$",
"hdk/cl/examples/cl_.+/\.critical_warnings",
"hdk/cl/examples/cl_.+/\.warnings",
"hdk/cl/examples/cl_sde/ft_fifo_p.v",
"hdk/cl/examples/cl_sde/ft_fifo.v",
"hdk/cl/examples/cl_sde/rr_arb.sv",
"sdk/linux_kernel_drivers/xdma/10-xdma\.rules",
"sdk/linux_kernel_drivers/xocl/10-xocl\.rules",
"sdk/linux_kernel_drivers/xocl/LICENSE$",
"sdk/apps/virtual-ethernet/scripts/pktgen-ena-range.pkt",
"sdk/apps/virtual-ethernet/scripts/pktgen-ena.pkt",
"SDAccel/userspace/src/test",
"SDAccel/examples/aws/kernel_3ddr_bandwidth/description.json",
"SDAccel/examples/aws/helloworld_ocl_runtime/helloworld",
"SDAccel/examples/aws/helloworld_ocl_runtime/sdaccel.ini",
"SDAccel/examples/aws/helloworld_ocl_runtime/vector_addition.hw.xilinx_aws-vu9p-f1-04261818_dynamic_5_0.awsxclbin",
"SDAccel/examples/aws/helloworld_ocl_runtime/2018.3_2019.1/helloworld",
"SDAccel/examples/aws/helloworld_ocl_runtime/2018.3_2019.1/sdaccel.ini",
"SDAccel/examples/aws/helloworld_ocl_runtime/2018.3_2019.1/vector_addition.hw.xilinx_aws-vu9p-f1-04261818_dynamic_5_0.awsxclbin"
])
file_provider.set_exclude_paths([
"\.git$",
"hdk/common/shell_.*/design/ip$",
"hdk/cl/examples/cl_.*/build/checkpoints$",
"hdk/cl/examples/cl_sde/ip$",
"hdk/.+/xsim\.dir$",
"SDAccel/aws_platform",
"SDAccel/examples/3rd_party",
"SDAccel/examples/xilinx",
"Vitis/aws_platform",
"Vitis/examples/xilinx",
"Vitis/docs/Alveo_to_AWS_F1_Migration/example",
])
file_path_list = sorted(file_provider.get_files(dir))
assert file_path_list, "No files found in {}".format(dir)
logger.info("Checking {} files".format(len(file_path_list)))
files_with_bad_headers = []
for file_path in file_path_list:
if os.path.islink(file_path):
continue
logger.debug("Checking {}".format(file_path))
if not find_header(file_path):
logger.error("Invalid or missing header in {}".format(file_path))
files_with_bad_headers.append(file_path)
rc = 0
if files_with_bad_headers:
rc = 1
logger.error("Following files didn't have the correct header:\n {}".format(
"\n ".join(files_with_bad_headers)))
logger.info("Checked {} files".format(len(file_path_list)))
logger.info("{} errors".format(len(files_with_bad_headers)))
return rc