# Verify that the checksums listed in the given file match the checksums of the files in the current directory. # If the checksum doesn't match an message is printed and the subshell is exited with a non-zero status, # in order to fail the build. # The macro should be the first statement in the %prep section. # # Control variables, flags and arguments: # -s path to the file containing the list of checksums. If not provided, the default value is 'sources' %verify_source_checksum(s:) %{expand: %define checksumresult %{expand:%(cksum --check --quiet "%{-s:%{-s*}}%{!-s:sources}" 2>/dev/null)} %[ %{len:%checksumresult} > 0 ? "echo -e 'ERROR: Checksums do not match\\n%{checksumresult}'; exit 1" : "%{nil}" ] } # Macro wrapping basename , so the extension can stripped %stripped_basename() %{expand:%(basename "%1" %2)} # Strip the path and .sh extension from the given string %binshellname() %{expand:%stripped_basename "%1" .sh}