NetBSD Problem Report #44695

From cheusov@tut.by  Mon Mar  7 22:35:17 2011
Return-Path: <cheusov@tut.by>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id 607D663B874
	for <gnats-bugs@gnats.netbsd.org>; Mon,  7 Mar 2011 22:35:17 +0000 (UTC)
Message-Id: <877hcar23l.fsf@asrock.chizhovka.net>
Date: Tue, 08 Mar 2011 00:35:10 +0200
From: cheusov@tut.by
To: gnats-bugs@gnats.NetBSD.org
Subject: Please add build setting for multi-packages to _BUILD_DEFS [patch]
X-Send-Pr-Version: 3.95

>Number:         44695
>Category:       pkg
>Synopsis:       Please add build setting for multi-packages to _BUILD_DEFS [patch]
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Mar 07 22:40:00 +0000 2011
>Closed-Date:    Sun May 08 13:25:58 +0000 2011
>Last-Modified:  Sun May 08 13:25:58 +0000 2011
>Originator:     Aleksey Cheusov
>Release:        NetBSD 5.1
>Organization:
>Environment:
System: NetBSD asrock.chizhovka.net 5.1 NetBSD 5.1 (GENERIC) #0: Mon Jan 31 23:53:52 EET 2011 cheusov@asrock.chizhovka.net:/srv/obj/sys/arch/amd64/compile/GENERIC amd64
Architecture: x86_64
Machine: amd64
>Description:
Following mk/pbulk/pbulk-index.mk I'll call packages that can be built
with different versions of apache, python, ruby and PHP "multi-packages".

Let's suppose we have the following task. We have a binary file for a
multi-package for which update is available in pkgsrc tree and we want
to build new version of the package. This package is not installed on
the system, therefore we cannot detect installed version of
ruby/python/php/apache (in case it is checked in
lang/*/{apache,{py,php,ruby}version}.mk files).

Patch below provides a way to do this by adding new field "MULTI" to
"Build information" in the binary file and pkgdb (pkg_info -B). At
build time the variable MULTI is modified in
lang/*/{apache,{py,php,ruby}version}.mk files and then (if defined) is
added to _BUILD_DEFS.

Commands useful for testing:

pkg_add pkg_summary-utils
pkg_src_summary -m -f PKGPATH,PKGNAME,MULTI www/ap2-python www/ap-{ruby,php}

>How-To-Repeat:

>Fix:
Index: mk/apache.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/apache.mk,v
retrieving revision 1.25
diff -u -r1.25 apache.mk
--- mk/apache.mk	17 Dec 2007 22:09:58 -0000	1.25
+++ mk/apache.mk	7 Mar 2011 20:46:38 -0000
@@ -135,4 +135,8 @@
 .  include "../../devel/apr-util/buildlink3.mk"
 .endif

+#
+# Variable assignment for multi-apache packages
+MULTI+=	PKG_APACHE=${PKG_APACHE}
+
 .endif	# APACHE_MK
Index: mk/bsd.pkg.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/bsd.pkg.mk,v
retrieving revision 1.1976
diff -u -r1.1976 bsd.pkg.mk
--- mk/bsd.pkg.mk	7 Feb 2011 10:32:32 -0000	1.1976
+++ mk/bsd.pkg.mk	7 Mar 2011 20:46:38 -0000
@@ -205,6 +205,13 @@
 PKG_FAIL_REASON+=	"DEPOT_SUBDIR may not be empty."
 .endif

+# Store the build options for multi-packages, i.e. packages that can
+# be built with multiple versions of Apache, Python, Ruby, PHP etc.
+#
+.if defined(MULTI)
+_BUILD_DEFS+=            MULTI
+.endif
+
 # ZERO_FILESIZE_P exits with a successful return code if the given file
 #	has zero length.
 # NONZERO_FILESIZE_P exits with a successful return code if the given file
Index: lang/python/pyversion.mk
===================================================================
RCS file: /cvsroot/pkgsrc/lang/python/pyversion.mk,v
retrieving revision 1.86
diff -u -r1.86 pyversion.mk
--- lang/python/pyversion.mk	25 Feb 2011 09:47:24 -0000	1.86
+++ lang/python/pyversion.mk	7 Mar 2011 20:46:38 -0000
@@ -112,6 +112,10 @@
 . endif
 .endif

+#
+# Variable assignment for multi-python packages
+MULTI+=	PYTHON_VERSION_REQD=${_PYTHON_VERSION}
+
 # No supported version found, annotate to simplify statements below.
 .if !defined(_PYTHON_VERSION)
 _PYTHON_VERSION=	none
Index: lang/php/phpversion.mk
===================================================================
RCS file: /cvsroot/pkgsrc/lang/php/phpversion.mk,v
retrieving revision 1.13
diff -u -r1.13 phpversion.mk
--- lang/php/phpversion.mk	23 Sep 2010 07:38:05 -0000	1.13
+++ lang/php/phpversion.mk	7 Mar 2011 20:46:38 -0000
@@ -136,6 +136,10 @@
 _PHP_VERSION=	${_PHP_VERSION_FIRSTACCEPTED}
 .endif

+#
+# Variable assignment for multi-PHP packages
+MULTI+=	PHP_VERSION_REQD=${_PHP_VERSION}
+
 # export some of internal variables
 PKG_PHP_VERSION:=	${_PHP_VERSION:C/\.[0-9]//}
 PKG_PHP:=		PHP${_PHP_VERSION:C/([0-9])([0-9])/\1.\2/}
Index: lang/ruby/rubyversion.mk
===================================================================
RCS file: /cvsroot/pkgsrc/lang/ruby/rubyversion.mk,v
retrieving revision 1.59
diff -u -r1.59 rubyversion.mk
--- lang/ruby/rubyversion.mk	21 Feb 2011 15:00:34 -0000	1.59
+++ lang/ruby/rubyversion.mk	7 Mar 2011 20:46:38 -0000
@@ -61,6 +61,10 @@
 RUBY_ABI_VERSION=	${RUBY19_API_VERSION}
 .endif

+#
+# Variable assignment for multi-ruby packages
+MULTI+=	RUBY_VERSION_REQD=${RUBY_VERSION_REQD:U${_RUBY_VERSION_DEFAULT}}
+
 # RUBY_VERSION_SUPPORTED defines the list of ${RUBY_VER} which is
 #	supported by the package.  It should be defined by the packages
 #	for specific Ruby versions.

>Release-Note:

>Audit-Trail:
From: Thomas Klausner <wiz@NetBSD.org>
To: NetBSD bugtracking <gnats-bugs@NetBSD.org>
Cc: 
Subject: Re: pkg/44695: Please add build setting for multi-packages to
 _BUILD_DEFS [patch]
Date: Tue, 8 Mar 2011 10:03:32 +0100

 On Mon, Mar 07, 2011 at 10:40:00PM +0000, cheusov@tut.by wrote:
 > Patch below provides a way to do this by adding new field "MULTI" to
 > "Build information" in the binary file and pkgdb (pkg_info -B). At
 > build time the variable MULTI is modified in
 > lang/*/{apache,{py,php,ruby}version}.mk files and then (if defined) is
 > added to _BUILD_DEFS.

 Why not add it to BUILD_DEFS in apache.mk, ... directly?
  Thomas

From: Aleksey Cheusov <cheusov@tut.by>
To: gnats-bugs@NetBSD.org
Cc: pkg-manager@netbsd.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org
Subject: Re: pkg/44695: Please add build setting for multi-packages to _BUILD_DEFS [patch]
Date: Tue, 08 Mar 2011 11:16:03 +0200

  >> Patch below provides a way to do this by adding new field "MULTI" to
  >> "Build information" in the binary file and pkgdb (pkg_info -B). At
  >> build time the variable MULTI is modified in
  >> lang/*/{apache,{py,php,ruby}version}.mk files and then (if defined) is
  >> added to _BUILD_DEFS.
 >  Why not add it to BUILD_DEFS in apache.mk, ... directly?

 Do you mean

   BUILD_DEFS += MULTI

 in lang/*/{apache,{py,php,ruby}version}.mk?

 If it doesn't cause multiple MULTI= entires in binaries for, e.g.,
 multi-python multi-php packages, I'm fine with it.

 -- 
 Best regards, Aleksey Cheusov.

From: Thomas Klausner <wiz@NetBSD.org>
To: NetBSD bugtracking <gnats-bugs@NetBSD.org>
Cc: 
Subject: Re: pkg/44695: Please add build setting for multi-packages to
 _BUILD_DEFS [patch]
Date: Tue, 8 Mar 2011 10:25:20 +0100

 On Tue, Mar 08, 2011 at 11:16:03AM +0200, Aleksey Cheusov wrote:
 > Do you mean
 > 
 >   BUILD_DEFS += MULTI
 > 
 > in lang/*/{apache,{py,php,ruby}version}.mk?
 > 
 > If it doesn't cause multiple MULTI= entires in binaries for, e.g.,
 > multi-python multi-php packages, I'm fine with it.

 No, I mean
 	BUILD_DEFS+=	PYTHON_VERSION_REQD=${_PYTHON_VERSION}
 (and similar)
  Thomas

From: Aleksey Cheusov <cheusov@tut.by>
To: gnats-bugs@NetBSD.org
Cc: pkg-manager@netbsd.org, gnats-admin@netbsd.org, pkgsrc-bugs@netbsd.org
Subject: Re: pkg/44695: Please add build setting for multi-packages to _BUILD_DEFS [patch]
Date: Tue, 08 Mar 2011 11:48:36 +0200

 >  No, I mean
 >  	BUILD_DEFS+=	PYTHON_VERSION_REQD=${_PYTHON_VERSION}
 >  (and similar)

 This is bad because in this case build tool must have knowledge about
 pkgsrc internals (python/php/ruby/apache list). What if in a few months
 emacses, Lua or something else become a part of this list? The main idea
 for variable MULTI was to hide this magic list (php, ruby, apache,
 apache) and to apply all setting from it for building without any
 hardcoding.

 -- 
 Best regards, Aleksey Cheusov.

From: Thomas Klausner <wiz@NetBSD.org>
To: NetBSD bugtracking <gnats-bugs@NetBSD.org>
Cc: 
Subject: Re: pkg/44695: Please add build setting for multi-packages to
 _BUILD_DEFS [patch]
Date: Tue, 8 Mar 2011 10:54:27 +0100

 On Mon, Mar 07, 2011 at 10:40:00PM +0000, cheusov@tut.by wrote:
 > Let's suppose we have the following task. We have a binary file for a
 > multi-package for which update is available in pkgsrc tree and we want
 > to build new version of the package. This package is not installed on
 > the system, therefore we cannot detect installed version of
 > ruby/python/php/apache (in case it is checked in
 > lang/*/{apache,{py,php,ruby}version}.mk files).

 Judging from your replies to emails, I seem not to understand what you
 want here.
 For example, which version(s) do you want to build in this case?

 Also, what new information does your patch give tools vs. the existing
 lines, e.g. from apache.mk:
 BUILD_DEFS+=                    PKG_APACHE_DEFAULT
 BUILD_DEFS_EFFECTS+=            PKG_APACHE APACHE_PKG_PREFIX

 Thanks,
  Thomas

From: Aleksey Cheusov <cheusov@tut.by>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/44695: Please add build setting for multi-packages to _BUILD_DEFS [patch]
Date: Tue, 08 Mar 2011 12:09:56 +0200

 >  Judging from your replies to emails, I seem not to understand what you
 >  want here.
 >  For example, which version(s) do you want to build in this case?
 I hope the following will explain my idea.

 0 ~>path=`pkg_info -QPKGPATH /srv/pkgsrc_bin/NetBSD/All/ap13-php53-5.3.5.tgz`

 0 ~>multi=`pkg_info -QMULTI /srv/pkgsrc_bin/NetBSD/All/ap13-php53-5.3.5.tgz`

 0 ~>echo $path
 www/ap-php

 0 ~>echo $multi
 PHP_VERSION_REQD=53 PKG_APACHE=apache13

 0 ~>cd /srv/pkgsrc/$path

 0 ap-php>make list-vars VARS=PKGNAME
 PKGNAME=ap22-php5-5.2.17

 0 ap-php>make list-vars VARS=PKGNAME $multi
 PKGNAME=ap13-php53-5.3.5

 0 ap-php>make build $multi
 ...

 >  Also, what new information does your patch give tools vs. the existing
 >  lines, e.g. from apache.mk:
 >  BUILD_DEFS+=                    PKG_APACHE_DEFAULT
 PKG_APACHE_DEFAULT is useless for package rebuilding.
 It is not garanteed that *_DEFAULT is in *_ACCEPTED.

 >  BUILD_DEFS_EFFECTS+=            PKG_APACHE APACHE_PKG_PREFIX
 PKG_APACHE is not a part of "Build information".

 -- 
 Best regards, Aleksey Cheusov.

From: Aleksey Cheusov <cheusov@tut.by>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/44695: Please add build setting for multi-packages to _BUILD_DEFS [patch]
Date: Tue, 08 Mar 2011 14:19:36 +0200

 >  0 ~>path=`pkg_info -QPKGPATH /srv/pkgsrc_bin/NetBSD/All/ap13-php53-5.3.5.tgz`
 >  0 ~>multi=`pkg_info -QMULTI /srv/pkgsrc_bin/NetBSD/All/ap13-php53-5.3.5.tgz`
 >  0 ~>echo $path
 >  www/ap-php
 >  0 ~>echo $multi
 >  PHP_VERSION_REQD=53 PKG_APACHE=apache13
 >  0 ~>cd /srv/pkgsrc/$path
 >  0 ap-php>make list-vars VARS=PKGNAME
 >  PKGNAME=ap22-php5-5.2.17
 >  0 ap-php>make list-vars VARS=PKGNAME $multi
 >  PKGNAME=ap13-php53-5.3.5
 >  0 ap-php>make build $multi
 >  ...

 Alternative scenario

 0 ~>path=`pkg_info -QPKGPATH /srv/pkgsrc_bin/NetBSD/All/ap13-php53-5.3.5.tgz`
 0 ~>multi=`pkg_info -QMULTI /srv/pkgsrc_bin/NetBSD/All/ap13-php53-5.3.5.tgz`
 0 ~>test -n "$multi" && multi=:$multi
 0 ~>distbb -p $path`echo $multi | tr ' ' ,`

 As you can see I don't care about Python, Ruby, PHP and Apache at all.

 -- 
 Best regards, Aleksey Cheusov.

From: Joerg Sonnenberger <joerg@britannica.bec.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/44695: Please add build setting for multi-packages to
 _BUILD_DEFS [patch]
Date: Tue, 8 Mar 2011 13:33:31 +0100

 On Mon, Mar 07, 2011 at 10:40:00PM +0000, cheusov@tut.by wrote:
 > +# Store the build options for multi-packages, i.e. packages that can
 > +# be built with multiple versions of Apache, Python, Ruby, PHP etc.
 > +#
 > +.if defined(MULTI)
 > +_BUILD_DEFS+=            MULTI
 > +.endif
 > +

 This is wrong, since MULTI is not a property that changes the build of
 the package.

 Joerg

From: Aleksey Cheusov <cheusov@tut.by>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/44695: Please add build setting for multi-packages to _BUILD_DEFS [patch]
Date: Tue, 08 Mar 2011 14:48:43 +0200

  >> +# Store the build options for multi-packages, i.e. packages that can
  >> +# be built with multiple versions of Apache, Python, Ruby, PHP etc.
  >> +#
  >> +.if defined(MULTI)
  >> +_BUILD_DEFS+=            MULTI
  >> +.endif
  >> +
 >  
 >  This is wrong, since MULTI is not a property that changes the build of
 >  the package.
 "Build information" contains a lot of things that do not affect the
 build, for example, FILE_NAME, LICENSE, MAINTAINER, BUILD_DATE,
 BUILD_HOST and so on. MULTI *contains* build settings for
 multi-packages, all of them in just one variable.

 -- 
 Best regards, Aleksey Cheusov.

State-Changed-From-To: open->feedback
State-Changed-By: wiz@NetBSD.org
State-Changed-When: Sat, 12 Mar 2011 14:08:14 +0000
State-Changed-Why:
I've committed the patch, thank you.
Shouldn't there be a MULTI setting for emacs also?


From: "Thomas Klausner" <wiz@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/44695 CVS commit: pkgsrc
Date: Sat, 12 Mar 2011 14:07:14 +0000

 Module Name:	pkgsrc
 Committed By:	wiz
 Date:		Sat Mar 12 14:07:14 UTC 2011

 Modified Files:
 	pkgsrc/lang/php: phpversion.mk
 	pkgsrc/lang/python: pyversion.mk
 	pkgsrc/lang/ruby: rubyversion.mk
 	pkgsrc/mk: apache.mk bsd.pkg.mk

 Log Message:
 Add MULTI variable, and add it to BUILD_DEFS, to more easily find
 variable settings affecting binary packages.

 From Aleksey Cheusov in PR 44695.


 To generate a diff of this commit:
 cvs rdiff -u -r1.13 -r1.14 pkgsrc/lang/php/phpversion.mk
 cvs rdiff -u -r1.86 -r1.87 pkgsrc/lang/python/pyversion.mk
 cvs rdiff -u -r1.59 -r1.60 pkgsrc/lang/ruby/rubyversion.mk
 cvs rdiff -u -r1.25 -r1.26 pkgsrc/mk/apache.mk
 cvs rdiff -u -r1.1976 -r1.1977 pkgsrc/mk/bsd.pkg.mk

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Aleksey Cheusov <cheusov@tut.by>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/44695 (Please add build setting for multi-packages to _BUILD_DEFS [patch])
Date: Sun, 13 Mar 2011 14:27:46 +0200

 > I've committed the patch, thank you.
 Thanks!

 > Shouldn't there be a MULTI setting for emacs also?
 My original intention was to specify only *_REQD and PKG_APACHE settings
 in MULTI because they are not controlled by mk.conf and packages built
 for different versions of e.g. python can coexist on the same system.
 On the one hand, if we follow "rebuild package easily with original
 settings" task, we should also add X11_TYPE and EMACS_TYPE to MULTI. On
 the other hand neither emacs packages nor X packages are true
 "multi-packages". Only one variant of them is built by official bulk
 builds and by users too. So, it is unlikely to see packages built for
 different flavours of emacs and native/modular X on single system.
 I have no strong opinion here but it seems to me it is safer to *not*
 add X11_TYPE and EMACS_TYPE, at least for now.

 As to EMACS_TYPE I think our emacses need to be improved. At the moment
 emacs modules have only one variant in official binary repository.
 Solution may be:
 1) Make GNU emacs and xemacs modules "multi-packages" by introducing
   EMACS_DEFAULT, EMACS_ACCEPTED and EMACS_REQD, for example,
   and then add EMACS_REQD to MULTI.
 2) Move installation of .el and generation of .elc files to INSTALL
   script, that is to move some tasks from package build time to
   installation time and to have only one binary package for all flavours
   of emacses just like Linuxes do.
 Personally, I think that variant 2 is much better, however this is a
 completely different question.

 And. What do you guys think about converting multi-packages to OPTIONS
 framework in a long run?

 -- 
 Best regards, Aleksey Cheusov.

From: "OBATA Akio" <obache@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/44695 (Please add build setting for multi-packages to
 _BUILD_DEFS [patch])
Date: Mon, 14 Mar 2011 10:45:58 +0900

 On Sun, 13 Mar 2011 21:30:04 +0900, Aleksey Cheusov <cheusov@tut.by> wrote:

 >  2) Move installation of .el and generation of .elc files to INSTALL
 >    script, that is to move some tasks from package build time to
 >    installation time and to have only one binary package for all flavours
 >    of emacses just like Linuxes do.

 Please look at elisp packages carefully.
 Some packages have different dependency and PLIST entries for each emacsen
 variants.

 -- 
 OBATA Akio / obache@NetBSD.org

State-Changed-From-To: feedback->closed
State-Changed-By: cheusov@NetBSD.org
State-Changed-When: Sun, 08 May 2011 13:25:58 +0000
State-Changed-Why:
patch was commited and works fine.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.