tech-pkg archive

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

Preserving binary packages



In May 2013, the default of preserving binary packages at package install
time was changed, from yes to no.  The change was made to stop
overwriting existing binary packages (although the "replace" example
given surprises me, as the existing binary package is placed in the
WRKDIR, not in the packages dir).

	PatchSet 295
	Date: 2013/05/22 23:18:56
	Author: obache
	Branch: HEAD
	Tag: pkgsrc-2013Q3-base
	Log:
	prevent to generate binary package in ${PACKAGES} from the side effect of
	`install' with USE_DESTDIR=yes.
	This changes prevent to unwanted overwite of existing binary packages with
	test installation (`stage-install', `replace' & `undo-replace', and so on).

	To do both `install' and `package', you can still use `package-install' target,
	same as USE_DESTDIR=no.

	Members:
		bsd.install.mk:1.13->1.14
		replace.mk:1.14->1.15

A number of times since then, I've wanted to re-use a binary package,
but found it extremely difficult to do when it's not preserved any
more.  I've heard others express similar feelings, and finding out how
to change this is not easy -- you need to use the package-install
target -- and the docs continue to reflect the old behavior prior to
this change.

Unfortunately, my muscle memory does not remember this easily.  I've
become used, over the years to just typing "make install".  I'd really
prefer it if we could use a definition in mk.conf to drive the
decision to preserve binary packages or not.  Using a definition means
that I can set it once in mk.conf, and have it DTRT.  It would prevent
me trying desperately to stop "make install" after I've executed it,
only to delete it, and type "make package-install".  Similarily for
pre-requisite packages, which are built for me - I would not have to go
back and re-make them.

So I've come up with the attached diff which does exactly this. I'm
not wedded to the names; however, I'm convinced that a definition would
benefit a number of us.

Does anyone have any objections to this approach?

Thanks,
Alistair
Index: mk/bsd.prefs.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/bsd.prefs.mk,v
retrieving revision 1.348
diff -u -r1.348 bsd.prefs.mk
--- mk/bsd.prefs.mk	14 Aug 2014 11:08:37 -0000	1.348
+++ mk/bsd.prefs.mk	9 Nov 2014 18:46:43 -0000
@@ -506,6 +506,13 @@
 DESTDIR=
 .endif
 
+# controls whether binary packages are preserved in pkgsrc/paclages/All
+# default is no (???? - original default was yes, changed 2013/05/23 to no)
+_KEEP_BIN_PKGS?= no
+.if !empty(PKGSRC_KEEP_BIN_PKGS:M[Yy][Ee][Ss])
+_KEEP_BIN_PKGS=	yes
+.endif
+
 _MAKE_CLEAN_AS_ROOT?=	no
 # Whether to run the clean target as root.
 _MAKE_INSTALL_AS_ROOT?=	yes
Index: mk/install/bsd.install.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/install/bsd.install.mk,v
retrieving revision 1.14
diff -u -r1.14 bsd.install.mk
--- mk/install/bsd.install.mk	23 May 2013 13:18:56 -0000	1.14
+++ mk/install/bsd.install.mk	9 Nov 2014 18:46:43 -0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.install.mk,v 1.14 2013/05/23 13:18:56 obache Exp $
+# $NetBSD: bsd.install.mk,v 1.13 2010/02/24 22:53:34 joerg Exp $
 #
 # This Makefile fragment is included by bsd.pkg.mk and provides all
 # variables and targets related to installing packages.
@@ -24,8 +24,10 @@
 .PHONY: install
 .if ${_USE_DESTDIR} == "no"
 install: stage-install
-.else
+.elif ${_KEEP_BIN_PKGS} == "no"
 install: stage-package-install
+.else
+install: package-install
 .endif
 
 ######################################################################
Index: mk/install/replace.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/install/replace.mk,v
retrieving revision 1.15
diff -u -r1.15 replace.mk
--- mk/install/replace.mk	23 May 2013 13:18:56 -0000	1.15
+++ mk/install/replace.mk	9 Nov 2014 18:46:43 -0000
@@ -1,4 +1,4 @@
-# $NetBSD: replace.mk,v 1.15 2013/05/23 13:18:56 obache Exp $
+# $NetBSD: replace.mk,v 1.14 2011/10/15 00:23:09 reed Exp $
 #
 # Public targets:
 #
@@ -27,8 +27,10 @@
 
 .if ${_USE_DESTDIR} == "no"
 _REPLACE_TARGETS+=	${_PKGSRC_BUILD_TARGETS}
-.else
+.elif ${_KEEP_BIN_PKGS} == "no"
 _REPLACE_TARGETS+=	stage-package-create
+.else
+_REPLACE_TARGETS+=	package
 .endif
 _REPLACE_TARGETS+=	replace-message
 _REPLACE_TARGETS+=	unprivileged-install-hook
Index: doc/guide/files/configuring.xml
===================================================================
RCS file: /cvsroot/pkgsrc/doc/guide/files/configuring.xml,v
retrieving revision 1.44
diff -u -r1.44 configuring.xml
--- doc/guide/files/configuring.xml	16 May 2014 03:16:40 -0000	1.44
+++ doc/guide/files/configuring.xml	9 Nov 2014 18:46:43 -0000
@@ -125,7 +125,10 @@
 	    By default, dependencies are only installed, and no binary
 	    package is created for them. You can set this variable to
 	    <literal>package-install</literal> to automatically create binary
-	    packages after installing dependencies.</para>
+	    packages after installing dependencies. Please note that the
+	    <varname>PKGSRC_KEEP_BIN_PKGS</varname>can be set to
+	    <literal>yes</literal> to preserve binary packages when
+	    using the <literal>install</literal> as well.</para>
 	</listitem>
 
 	<!--	DISTDIR -->


Home | Main Index | Thread Index | Old Index