tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Modifications to INSTALL/DEINSTALL (mk/pkginstall)



On Sun, Feb 12, 2017 at 03:28:07PM +0100, Joerg Sonnenberger wrote:
> On Thu, Feb 09, 2017 at 02:02:04AM +0000, Johnny C. Lam wrote:
> > There is a third way that wiz@ asked me to look into -- we can move the
> > scripts in mk/pkginstall into an "install-scripts" package that is a
> > dependency for packages that use the pkgsrc-provided install scripts.
> 
> One variant, don't create a single monolithic script package, but it
> group by functionalities. That dramatically reduces the impact of
> potential changes. That said, I don't think optimising for the latter is
> otherwise a huge necessity. I think this is the only reasonable way
> forward.

I've committed a replacement for the existing "pkginstall"
framework that is currently used to generate +DEINSTALL and
+INSTALL scripts for package.  The new code exists in three new
pieces:

    pkgsrc/mk/pkgtasks
	Generates data files for install and deinstall scripts
	based on the usual variables, e.g., PKG_USERS,
	PKG_GROUPS, CONF_FILES, etc., defined in package
	Makefiles.

    pkgsrc/mk/init
	Provides support for different init script systems and
	hooks into "pkgtasks" framework to copy files into the
	correct locations for the system's init process to find.
	Currently supports rc.d and SMF.

    pkgsrc/pkgformat/pkg/scripts.mk
	Generates +DEINSTALL and +INSTALL scripts for the "pkg"
	format, using templates that invoke pkgtasks to make
	changes to the system, and data files generated by the
	"pkgtasks" framework.

The new code can be toggled by setting _USE_NEW_PKGINSTALL=yes
in /etc/mk.conf.  The existing pkgsrc/mk/pkginstall framework
and a few other bits can be removed at a later time.

The actual package tasks are encapsulated in a new package,
pkgsrc/pkgtools/pkgtasks, that is installed as needed as a
dependency of packages that use the generated deinstall and
install scripts.  The output of these tasks differs from the
existing output from the script templates under
pkgsrc/mk/pkginstall due to different design choices.  One useful
new feature is that it's possible to duplicate all of the package
task output to a file by setting the TASK_LOGFILE environment
variable.  The output is still sent to standard output, but it's
duplicated to a user-settable logfile.

I have also added some kyua tests under pkgsrc/mk to exercise the
new code and that helped immensely during development.  Many
thanks to jmmv%NetBSD.org@localhost for answering my kyua questions to help
me get started on using this great tool for improving pkgsrc.

I would appreciate review, testing, and feedback of the new
frameworks.
-- 
Johnny C. Lam
jlam%NetBSD.org@localhost


Home | Main Index | Thread Index | Old Index