Hi ports,
During an out-of-band discussion with afresh1@, he told me that he found
out that portcheck can't find a missing pkg/DESCR.
With the current portcheck, if a PLIST is present then DESCR detection
is not really done (and the opposite is true), because they share the
same variable to assert their presence.
As a result, i'm proposing a diff that splits PLIST/PFRAG and DESCR
detection, and adds similar support for subpackages as well.
It has been tested by torturing x11/qt4 and x11/dwm, but there may be
corner cases in the ports tree that my changes don't cover.
Comments and feedback are welcome!
Charlène.
Index: portcheck
===================================================================
RCS file: /cvs/ports/infrastructure/bin/portcheck,v
retrieving revision 1.126
diff -u -p -r1.126 portcheck
--- portcheck 16 Nov 2018 10:08:38 -0000 1.126
+++ portcheck 7 Feb 2019 12:25:40 -0000
@@ -831,6 +831,15 @@ sub_checks() {
local dir=$1; shift
local subpkg=$1; shift
local flavor
+ local pkgitem
+
+ # DESCR/PLIST existence for ports without FLAVOR/SUBPACKAGE is tested
+ # in check_pkg_dir() already.
+ for pkgitem in DESCR PLIST; do
+ [[ $subpkg != "-" && ! -f "pkg/$pkgitem$subpkg" ]] &&
+ err "$pkgitem$subpkg missing in pkg (or not a file)"
+ done
+
for flavor in "$@"; do
# avoid extra noise
[[ ${flavor#no_} != ${flavor} &&
@@ -1636,7 +1645,8 @@ check_pkg_dir() {
subst_cmd=$1
shift
fi
- local empty=true
+ local empty_descr=true
+ local empty_plist=true
local F
local plist
@@ -1645,7 +1655,7 @@ check_pkg_dir() {
dir="${dir#./}"
for F in "$dir"/* "$dir"/.*; do case "${F##*/}" in
DESCR?(-*))
- empty=false
+ empty_descr=false
[[ -f $F ]] ||
err "$F is not a file"
check_trailing_whitespace "$F"
@@ -1658,7 +1668,7 @@ check_pkg_dir() {
;;
PFRAG.shared?(-*))
- empty=false
+ empty_plist=false
[[ -n $subst_cmd ]] && check_subst_vars "$F" "$subst_cmd"
check_plist_file "$F"
plist=PLIST${F##*/PFRAG.+([!-])}
@@ -1666,7 +1676,7 @@ check_pkg_dir() {
;;
PFRAG.*|PLIST?(-*))
- empty=false
+ empty_plist=false
[[ -n $subst_cmd ]] && check_subst_vars "$F" "$subst_cmd"
check_plist_file "$F"
;;
@@ -1714,8 +1724,10 @@ check_pkg_dir() {
handle_extra_file "$F"
;;
esac; done
-
- $empty && err "$dir directory does not contain either DESCR, PFRAG or
PLIST files"
+
+ [[ "$empty_descr" = true ]] && err "$dir does not contain a DESCR file"
+ [[ "$empty_plist" = true ]] && err "$dir does not contain PFRAG or
PLIST files"
+
}
# Checks made: