Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Mar 2014 19:08:52 +0100
From:      Michael Gmelin <freebsd@grem.de>
To:        kdeguchi@sz.tokoha-u.ac.jp, <ports@freebsd.org>
Subject:   pkg_replace and detecting pkg(ng)
Message-ID:  <20140318190852.7b093b00@bsd64.grem.de>

next in thread | raw e-mail | index | archive | help
Hi,

In the past I've been able to use pkg_replace on machine that didn't
have the ports collection installed.

With the current version of pkg_replace this doesn't seem to be
possible anymore, since pkg(ng) detection breaks in those cases:

: ${use_pkgng="`/usr/bin/make -f/usr/share/mk/bsd.port.mk -V
WITH_PKGNG`"}
if [ "x${use_pkgng}" = "xdevel" ]; then
  use_pkgng="yes"
fi

bsd.port.mk requires /usr/ports/Mk/...

One of the main motivations to use pkg_replace for me is to not having
a ports tree on the machines I use it on.

I would suggest to replace this with a detection mechanism similar to
what ports does:

If sysctl -n kern.osreldate >= 1000017
 use_pkgng=yes, unless WITHOUT_PKGNG is defined
else if defined(WITH_PKGNG) (any value, not just ==yes)
 use_pkgng=yes
else
 use_pkgng=no

Determining WITH_PKGNG/WITHOUT_PKGNG should be done using make -V VAR
(without specifying a Makefile, so /etc/make.conf is read).

- Michael

-- 
Michael Gmelin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140318190852.7b093b00>