Subject: RFC: recommended dependencies (diffs attached)
To: None <tech-pkg@netbsd.org>
From: Rene Hexel <rh@netbsd.org>
List: tech-pkg
Date: 01/08/2004 16:15:45
--Apple-Mail-1-746064603
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=US-ASCII;
	format=flowed

   Hi Folks,

   There has been some discussion lately about what to do
about PKGREVISION bumps that might cause incompatible
binary packages.  Without reproducing the whole
discussion, here is a quick summary:

   Current practice is to bump PKGREVISIONs and
dependencies for all directly or indirectly dependent
packages, regardless of whether there actually is any
technical requirement to bump dependencies or not.

   While this helps binary package consistency, it also
causes a lot of overhead with users/developers who compile
packages from source.  Often huge portions of an installed
package base need to be recompiled unnecessarily.

   I have attached diffs to pkgsrc that do the following:

   - Introduce a new variable, RECOMMENDED, that has
     the same syntax as DEPENDS.

   - Introduce BUILDINK_RECOMMENDED.<foo> that sets
     the recommended version of a package through
     buildlink the same way BUILDLINK_DEPENDS.<foo>
     sets dependencies.

   - Introduce a switch IGNORE_RECOMMENDED (defaults
     to "no") that causes recommendations to be
     ignored and a corresponding warning to be
     printed.

   The default behaviour is to simply add all
recommendations (RECOMMENDED and
BUILDLINK_RECOMMENDED.*) to the the list of
dependencies (DEPENDS).  This allows us to bump
PKGREVISIONS and update RECOMMENDED whenever a change
occurs that requires a new set of binary packages.

   If IGNORE_RECOMMENDED is set to "yes", the
list of RECOMMENDED prerequisites will be ignored
and only 'hard' DEPENDS will be used.  A warning
will be printed upon creation of a binary package
that recommendations are ignored and such a package
should not be uploaded or otherwise be used where
an inconsistent mix of binary packages could cause
problems.

   Here is an example: for the latest tiff update,
we could have left BUILDLINK_DEPENDS.tiff>=3.5.4
as all our packages compile and work nicely with
this version of tiff.

   Since tiff-3.6.1 may have introduced an ABI change,
a setting of BUILDLINK_RECOMMENDED.tiff>=3.6.1 plus
bumping PKGREVISIONs (the same way it was done during
the update) will then cause the same set of binary
package to be built as during the last update.

   If someone doesn't want to (or can't afford to)
update tiff and a huge number of packages straight
away, they can set IGNORE_RECOMMENDED=yes and still
compile perfectly working binaries against their
installed package base.  But they will be warned
that their binaries may be incompatible with
binaries compiled against the latest version of
tiff and should therefore not be uploaded.

   Comments?  Suggestions?  Flames?

   If nobody objects, I'd like to commit this in
the next days ...

   Cheers
       ,
    Rene


--Apple-Mail-1-746064603
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="pkgsrc.diff"
Content-Disposition: attachment;
	filename=pkgsrc.diff

Index: mk/bsd.pkg.defaults.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/bsd.pkg.defaults.mk,v
retrieving revision 1.200
diff -u -r1.200 bsd.pkg.defaults.mk
--- mk/bsd.pkg.defaults.mk	7 Jan 2004 21:45:18 -0000	1.200
+++ mk/bsd.pkg.defaults.mk	8 Jan 2004 05:04:03 -0000
@@ -85,6 +85,14 @@
 # Possible: defined, not defined
 # Default: not defined
 
+IGNORE_RECOMMENDED?=	no
+# ignore package prerequisite recommendations.  If this is set to
+# "no", all entries in RECOMMENDED will be added to DEPENDS.
+# If set to "yes", a warning will be printed if recommendations
+# are possibly ignored.
+# Possible: yes, no
+# Default: no
+
 #PKG_REGISTER_SHELLS= YES
 # Automatically register shells in /etc/shells
 # Possible: YES, NO
Index: mk/bsd.pkg.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/bsd.pkg.mk,v
retrieving revision 1.1340
diff -u -r1.1340 bsd.pkg.mk
--- mk/bsd.pkg.mk	7 Jan 2004 15:30:54 -0000	1.1340
+++ mk/bsd.pkg.mk	8 Jan 2004 05:04:06 -0000
@@ -406,6 +406,10 @@
 BUILD_DEPENDS+=		gettext>=0.10.35nb1:../../devel/gettext
 .endif
 
+.if defined(RECOMMENDED) && !empty(IGNORE_RECOMMENDED:M[nN][oO])
+DEPENDS+=		${RECOMMENDED}
+.endif
+
 EXTRACT_COOKIE=		${WRKDIR}/.extract_done
 BUILDLINK_COOKIE=	${WRKDIR}/.buildlink_done
 CONFIGURE_COOKIE=	${WRKDIR}/.configure_done
@@ -2477,6 +2481,11 @@
 	@${ECHO_MSG} "${_PKGSRC_IN}> Warning: ${PKGNAME} may not be made available through FTP:"
 	@${ECHO_MSG} "${_PKGSRC_IN}>         " ${NO_BIN_ON_FTP:Q}
 .  endif
+.  if defined(RECOMMENDED) && !empty(IGNORE_RECOMMENDED:M[yY][eE][sS])
+	@${ECHO_MSG} "${_PKGSRC_IN}> Warning: dependency recommendations are being ignored!"
+	@${ECHO_MSG} "${_PKGSRC_IN}>          ${PKGNAME} should not be uploaded nor"
+	@${ECHO_MSG} "${_PKGSRC_IN}>          otherwise be used as a binary package!"
+.  endif
 .endif
 
 # Some support rules for real-su-package
Index: mk/buildlink2/bsd.buildlink2.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/buildlink2/bsd.buildlink2.mk,v
retrieving revision 1.104
diff -u -r1.104 bsd.buildlink2.mk
--- mk/buildlink2/bsd.buildlink2.mk	19 Dec 2003 19:22:28 -0000	1.104
+++ mk/buildlink2/bsd.buildlink2.mk	8 Jan 2004 05:04:06 -0000
@@ -6,6 +6,7 @@
 # BUILDLINK_PACKAGES+=		foo
 # BUILDLINK_PKGBASE.foo=	foo-lib
 # BUILDLINK_DEPENDS.foo?=	foo-lib>=1.0
+# BUILDLINK_RECOMMENDED.foo?=	foo-lib>=1.0nb1
 # BUILDLINK_PKGSRCDIR.foo?=	../../category/foo-lib
 #
 # EVAL_PREFIX+=			BUILDLINK_PREFIX.foo=foo-lib
@@ -140,6 +141,7 @@
 .  endif
 .  if !empty(BUILDLINK_DEPMETHOD.${_pkg_}:Mfull)
 _BUILDLINK_DEPMETHOD.${_pkg_}=	DEPENDS
+_BUILDLINK_RECMETHOD.${_pkg_}=	RECOMMENDED
 .  elif !empty(BUILDLINK_DEPMETHOD.${_pkg_}:Mbuild)
 _BUILDLINK_DEPMETHOD.${_pkg_}=	BUILD_DEPENDS
 .  endif
@@ -150,6 +152,14 @@
 	${_depends_}:${BUILDLINK_PKGSRCDIR.${_pkg_}}
 .    endfor
 .  endif
+.  if defined(BUILDLINK_RECOMMENDED.${_pkg_}) && \
+      defined(_BUILDLINK_RECMETHOD.${_pkg_}) && \
+      defined(BUILDLINK_PKGSRCDIR.${_pkg_})
+.    for _rec_ in ${BUILDLINK_RECOMMENDED.${_pkg_}}
+${_BUILDLINK_RECMETHOD.${_pkg_}}+= \
+	${_rec_}:${BUILDLINK_PKGSRCDIR.${_pkg_}}
+.    endfor
+.  endif
 #
 # BUILDLINK_PLIST_CMD.<pkg> is a sequence of shell commands that extracts
 # a list of all of the files installed by <pkg>.  This list is relative to

--Apple-Mail-1-746064603--