ports/185147: [patch] ports-mgmt/portaudit complain if pkg-ng is in use

Olli Hauer ohauer at FreeBSD.org
Mon Dec 23 21:50:00 UTC 2013


>Number:         185147
>Category:       ports
>Synopsis:       [patch] ports-mgmt/portaudit complain if pkg-ng is in use
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Dec 23 21:50:00 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     Olli Hauer
>Release:        
>Organization:
>Environment:

>Description:
In case a system is running already with the new pkg tools portaudit is useless.

If now also some leftovers are found in /var/db/pkg strange results can be presented
to the user. For example see PR ports/184976

I suspect this can abd will be happend to more users migrating to the new pkg tools.

The fix is not optimal but a starting point for the maintainers.


>How-To-Repeat:
See PR ports/184976

>Fix:


--- portaudit.diff begins here ---
Index: portaudit/files/portaudit-cmd.sh
===================================================================
--- portaudit/files/portaudit-cmd.sh	(revision 337284)
+++ portaudit/files/portaudit-cmd.sh	(working copy)
@@ -53,6 +53,10 @@
 
 	: ${portaudit_fixed=""}
 	: ${portaudit_openssl:="/usr/bin/openssl"}
+
+	# check if new pkg tools are in use
+	: ${pkgng_db:="/var/db/pkg/local.sqlite"}
+	: ${PKGSTATIC:="%%PREFIX%%/sbin/pkg-static"}
 }
 
 extract_auditfile_raw()
@@ -438,6 +442,18 @@
 	echo "portaudit version %%PORTVERSION%%"
 fi
 
+if [ -e $pkgng_db -a -x $PKGSTATIC ]; then
+	IPKGNG=`echo 'select count() from packages;' | $PKGSTATIC shell`
+	if [ $IPKGNG -ge 1 ]; then
+		echo " It seems this system use already the new pkg tools"
+		echo "  $pkgng_db and $IPKGNG installed packages found ..."
+		echo
+		echo "  Please use the command 'pkg audit' instead"
+		echo "  For more information see man pkg-audit(8)"
+		exit 1
+	fi
+fi
+
 if $opt_fetch; then
 	if $opt_quiet ; then
 		portaudit_fetch_cmd="${portaudit_fetch_cmd} -q"
--- portaudit.diff ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-ports-bugs mailing list