aboutsummaryrefslogtreecommitdiff
path: root/sbolint
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2023-12-23 01:54:26 -0500
committerB. Watson <urchlay@slackware.uk>2023-12-23 01:54:45 -0500
commite930dd2b0b82d133176e93a6a9855ac2a2d367c8 (patch)
tree4f15cb2ffe9d3225476c7b67c0bf70d2bcd3c9b1 /sbolint
parent20f713c2feaacedc150fc46531bfd9f409f2ed9c (diff)
downloadsbo-maintainer-tools-e930dd2b0b82d133176e93a6a9855ac2a2d367c8.tar.gz
Update NEWS; sbolint: check for CRLF in *.diff, *.patch.
Diffstat (limited to 'sbolint')
-rwxr-xr-xsbolint31
1 files changed, 29 insertions, 2 deletions
diff --git a/sbolint b/sbolint
index 2d69b74..bb7355b 100755
--- a/sbolint
+++ b/sbolint
@@ -291,6 +291,22 @@ cache must be checked before this command is run.
=back
+=item -
+
+Image files are checked for permissions (0644), filename (extension
+must match filetype, e.g. a GIF image must not be named image.jpg),
+and correctness (must not be truncated/corrupt).
+
+=item -
+
+Patch files (anything named *.diff or *.patch) are checked for
+permissions (0644) and DOS/Windows CRLF line endings. If a patch
+file has CRLF endings, it B<cannot> be checked into SBo's repository,
+because git will strip the CR (\r) from every line, meaning the patch
+will fail to apply. In this case, the best solution is to gzip the
+patch, and have the SlackBuild use e.g. "zcat $CWD/blah.diff.gz |
+patch -p1" to apply it.
+
=back
=head1 EXIT STATUS
@@ -721,6 +737,7 @@ sub run_checks {
\&check_script,
\&check_doinst,
\&check_images,
+ \&check_patches,
\&check_empty_hidden,
);
@@ -785,7 +802,14 @@ sub check_and_read {
}
}
- log_error("$file has DOS-style CRLF line endings") if $crlf_err;
+ if($crlf_err) {
+ if($file =~ /\.(diff|patch)$/i) {
+ log_error("$file has DOS-style CRLF line endings, git will mess it up unless you gzip it!") if $crlf_err;
+ } else {
+ log_error("$file has DOS-style CRLF line endings") if $crlf_err;
+ }
+ }
+
log_error("$file has no newline at EOF") if $lastline_nonl;
return @lines;
}
@@ -1738,8 +1762,11 @@ sub check_junkfiles {
# if anything *.diff or *.patch contains \r, warn the
# user about git stripping the \r's (better gzip it).
+# 20231223 bkw: this check relies on check_and_read special-casing
+# filenames ending in *.diff or *.patch.
sub check_patches {
- for(<*.diff>,<*.patch>) {
+ my $patches = `find . \\( -iname '*.diff' -o -iname '*.patch' \\) -print0`;
+ for(split /\x00/, $patches) {
check_and_read($_, 0644);
}
}