Hi ports --

I was working on a new port, and ran portcheck -N before adding a DESCR
file (but after adding a PLIST file). To my surprise, portcheck passed.

Reading through portcheck, there appears to be a check for non-existent
DESCR/PFRAG/PLIST files. But it appears that the error message and the
logic don't sync: the error message leads me to believe the intent was
to catch when any of DESCR/PFRAG/PLIST are missing but the logic instead
catches the situation where all of DESCR/PFRAG/PLIST are missing--if you
have any one of those 3 files, the check passes.

This only seems to matter in the case where you have a PLIST but no
DESCR. If you have no PLIST, portcheck will later fail with this
message:
pkg_create: can't read packing-list /full/path/to/port

The attached diff catches both the have PLIST but no DESCR and the have
DESCR but no PLIST cases. This is my first time looking at portcheck so
if there's a better way, by all means I'm all ears.

OK?

~Brian

Index: portcheck
===================================================================
RCS file: /cvs/ports/infrastructure/bin/portcheck,v
retrieving revision 1.132
diff -u -p -r1.132 portcheck
--- portcheck	22 Mar 2020 17:16:30 -0000	1.132
+++ portcheck	23 May 2020 04:08:11 -0000
@@ -1661,6 +1661,7 @@ check_pkg_dir() {
 		subst_cmd=$1
 		shift
 	fi
+	local descr_empty=true
 	local empty=true
 	local F
 	local plist
@@ -1670,7 +1671,7 @@ check_pkg_dir() {
 	dir="${dir#./}"
 	for F in "$dir"/* "$dir"/.*; do case "${F##*/}" in
 	DESCR?(-*))
-		empty=false
+		descr_empty=false
 		[[ -f $F ]] ||
 			err "$F is not a file"
 		check_trailing_whitespace "$F"
@@ -1740,7 +1741,8 @@ check_pkg_dir() {
 		;;
 	esac; done
 
-	$empty && err "$dir directory does not contain either DESCR, PFRAG or PLIST files"
+	$descr_empty && err "Missing DESCR file in $dir directory"
+	$empty && err "$dir directory does not contain either PFRAG or PLIST files"
 }
 
 # Checks made:

Reply via email to