ports/171406: [Patch] Make PORTAUDIT work with PKGNG
Stefan Esser
se at FreeBSD.org
Fri Sep 7 10:30:05 UTC 2012
>Number: 171406
>Category: ports
>Synopsis: [Patch] Make PORTAUDIT work with PKGNG
>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: Fri Sep 07 10:30:04 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator: Stefan Esser
>Release: FreeBSD 10.0-CURRENT amd64
>Organization:
FreeBSD.Org
>Environment:
System: FreeBSD xyzzy 10.0-CURRENT FreeBSD 10.0-CURRENT #33 r239375M: Sun Aug 19 00:18:08 CEST 2012 root at xyzzy:/sys/amd64/compile/SE amd64
>Description:
The portaudit tool has not been converted to work with PKGNG.
The attached patch adds support for PKGNG. The new pkg tools
are used, if /var/db/pkg/local.sqlite exists. If that is the
case, "pkg info" and "pkg version" are used throughout the
script (instead of pkg_info and pkg_version). In my testing
this suffices to make portaudit use PKGNG.
The actual change (indentation changes omitted, whitespace not preserved) is:
-----------------------------------------------------------
--- portaudit-cmd.sh~ 2012-09-03 12:41:14.020639095 +0200
+++ portaudit-cmd.sh 2012-09-03 12:41:14.020639095 +0200
@@ -120,6 +120,10 @@
return 0
fi
+ if [ -f "%%DATABASEDIR%%/../pkg/local.sqlite" ]; then
+ pkg_info="%%LOCALBASE%%/sbin/pkg info"
+ pkg_version="%%LOCALBASE%%/sbin/pkg version"
+ else
if [ -z "${pkg_info:-}" ]; then
if [ -x "%%LOCALBASE%%/sbin/pkg_info" ]; then
pkg_info="%%LOCALBASE%%/sbin/pkg_info"
@@ -142,6 +146,7 @@
echo "$pkg_info is too old, please update port sysutils/pkg_install-devel"
return 1
fi
+ fi
if [ ! -r "$portaudit_dir/$portaudit_filename" ]; then
echo "portaudit: Database missing, run \`portaudit -F' to update." >&2
-----------------------------------------------------------
I did not introduce a new substitution parameter for the location
of the PKGNG SQlite database. Instead "%%DATABASEDIR%%/../pkg" is
used, which is clearly sub-optimal. But I wanted to provide the
smallest patch (without additional changes to the port's Makefile).
>How-To-Repeat:
Run unmodified portaudit command on system with WITH_PKGNG.
>Fix:
Apply the patch contained in the following UUENCODED chunk.
It is identical to the above diff but fixes the indentation, too.
Patch attached with submission follows:
# This is a shell archive. Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file". Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
# /tmp/patch-portaudit-cmd.sh
#
echo x - /tmp/patch-portaudit-cmd.sh
sed 's/^X//' >/tmp/patch-portaudit-cmd.sh << 'd0647a32b451421e98a36b979b972812'
X--- portaudit-cmd.sh 2012-09-03 12:41:14.020639095 +0200
X+++ portaudit-cmd.sh-SE 2012-09-03 12:17:25.076889421 +0200
X@@ -120,27 +120,32 @@
X return 0
X fi
X
X- if [ -z "${pkg_info:-}" ]; then
X- if [ -x "%%LOCALBASE%%/sbin/pkg_info" ]; then
X- pkg_info="%%LOCALBASE%%/sbin/pkg_info"
X- else
X- pkg_info="/usr/sbin/pkg_info"
X+ if [ -f "%%DATABASEDIR%%/../pkg/local.sqlite" ]; then
X+ pkg_info="%%LOCALBASE%%/sbin/pkg info"
X+ pkg_version="%%LOCALBASE%%/sbin/pkg version"
X+ else
X+ if [ -z "${pkg_info:-}" ]; then
X+ if [ -x "%%LOCALBASE%%/sbin/pkg_info" ]; then
X+ pkg_info="%%LOCALBASE%%/sbin/pkg_info"
X+ else
X+ pkg_info="/usr/sbin/pkg_info"
X+ fi
X fi
X- fi
X
X- if [ -z "${pkg_version:-}"]; then
X- case "$pkg_info" in
X- */*)
X- pkg_version="${pkg_info%/*}/pkg_version";;
X- *)
X- pkg_version="pkg_version";;
X- esac
X- fi
X+ if [ -z "${pkg_version:-}"]; then
X+ case "$pkg_info" in
X+ */*)
X+ pkg_version="${pkg_info%/*}/pkg_version";;
X+ *)
X+ pkg_version="pkg_version";;
X+ esac
X+ fi
X
X- PKG_INSTALL_VER=`$pkg_info -qP 2>/dev/null`
X- if [ -z "$PKG_INSTALL_VER" -o "$PKG_INSTALL_VER" -lt %%REQPKGVER%% ]; then
X- echo "$pkg_info is too old, please update port sysutils/pkg_install-devel"
X- return 1
X+ PKG_INSTALL_VER=`$pkg_info -qP 2>/dev/null`
X+ if [ -z "$PKG_INSTALL_VER" -o "$PKG_INSTALL_VER" -lt %%REQPKGVER%% ]; then
X+ echo "$pkg_info is too old, please update port sysutils/pkg_install-devel"
X+ return 1
X+ fi
X fi
X
X if [ ! -r "$portaudit_dir/$portaudit_filename" ]; then
d0647a32b451421e98a36b979b972812
exit
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list