NetBSD Problem Report #44698

From cheusov@tut.by  Tue Mar  8 12:05:38 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 C5A9063B874
	for <gnats-bugs@gnats.netbsd.org>; Tue,  8 Mar 2011 12:05:38 +0000 (UTC)
Message-Id: <874o7dddgz.fsf@asrock.chizhovka.net>
Date: Tue, 08 Mar 2011 14:05:32 +0200
From: cheusov@tut.by
To: gnats-bugs@gnats.NetBSD.org
Subject: Alternative PKGFILE [patch]
X-Send-Pr-Version: 3.95

>Number:         44698
>Category:       pkg
>Synopsis:       Alternative PKGFILEs [patch]
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    pkg-manager
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Tue Mar 08 12:10:00 +0000 2011
>Closed-Date:    Sat Mar 19 09:48:29 +0000 2011
>Last-Modified:  Sat Mar 19 09:50:02 +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:
With minor fixes my bulk build tool wip/distbb provides a way to build
the same package with different options in one bulk build. The
following command

  distbb -p 'wm/fvwm
             wm/fvwm:PKG_OPTIONS.fvwm=-gtk~-rplay
             wm/fvwm:PKG_OPTIONS.fvwm=-gtk'

builds fvwm package in 3 different way: with default options, with
-gtk option and with -gtk -rplay options. The problem here is that all
three binaries have the same file name. So, the result of such bulk
build is unpredictable.

Unfortunately the only way to change the file name for the binary is
to change PKGNAME. I consider this way ugly and dangerous. Patch below
provides new variable FILEBASE overridable by user.  With this patch
applied the following command builds 3 fvwm packages normally.

  distbb -p 'wm/fvwm
             wm/fvwm:PKG_OPTIONS.fvwm=-gtk~-rplay,FILEBASE=fvwm%mini
             wm/fvwm:PKG_OPTIONS.fvwm=-gtk,FILEBASE=fvwm%nogtk'

Of course it can also be used when packages are build manually.

   cd /usr/pkgsrc/wm/fvwm
   make package PKG_OPTIONS.fvwm='-gtk -rplay' FILEBASE=fvwm%mini

>How-To-Repeat:

>Fix:
Index: mk/flavor/pkg/package.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/flavor/pkg/package.mk,v
retrieving revision 1.20
diff -u -r1.20 package.mk
--- mk/flavor/pkg/package.mk	9 Feb 2010 23:02:13 -0000	1.20
+++ mk/flavor/pkg/package.mk	8 Mar 2011 12:01:01 -0000
@@ -11,7 +11,8 @@
 .  endif
 .endif
 PKG_SUFX?=		.tgz
-PKGFILE?=		${PKGREPOSITORY}/${PKGNAME}${PKG_SUFX}
+FILEBASE?=		${PKGBASE}
+PKGFILE?=		${PKGREPOSITORY}/${FILEBASE}-${PKGVERSION}${PKG_SUFX}
 PKGREPOSITORY?=		${PACKAGES}/${PKGREPOSITORYSUBDIR}
 PKGREPOSITORYSUBDIR?=	All


>Release-Note:

>Audit-Trail:
From: David Holland <dholland-pbugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/44698: Alternative PKGFILE [patch]
Date: Wed, 9 Mar 2011 10:27:29 +0000

 On Tue, Mar 08, 2011 at 12:10:01PM +0000, cheusov@tut.by wrote:
  > @@ -11,7 +11,8 @@
  >  .  endif
  >  .endif
  >  PKG_SUFX?=		.tgz
  > -PKGFILE?=		${PKGREPOSITORY}/${PKGNAME}${PKG_SUFX}
  > +FILEBASE?=		${PKGBASE}
  > +PKGFILE?=		${PKGREPOSITORY}/${FILEBASE}-${PKGVERSION}${PKG_SUFX}
  >  PKGREPOSITORY?=		${PACKAGES}/${PKGREPOSITORYSUBDIR}
  >  PKGREPOSITORYSUBDIR?=	All

 So, much as it's useful to be able to build such packages
 automatically, I don't think this is the right way to handle them.

 The name of the resulting package should be derived deterministically
 from the options (and also, any other build switches resulting in a
 different package, like X11_TYPE) so that binary package tools have
 some hope of being able to process the results.

 That is, if you build a bunch of variant packages with options and
 upload them to a package repository it should be possible for people
 using pkg_install to download and install them without specifically
 having to know the special names; in fact, ideally, pkg_install would
 respond to non-default PKG_OPTIONS by looking for the corresponding
 variant binary package.

 This all hinges on getting the naming right so I think we need to
 first figure out what the naming scheme should be, which isn't
 entirely trivial to sort out, then arrange to have the package
 filename be set automatically rather than by user configuration.

 -- 
 David A. Holland
 dholland@netbsd.org

From: Aleksey Cheusov <cheusov@tut.by>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/44698: Alternative PKGFILE [patch]
Date: Wed, 09 Mar 2011 14:01:11 +0200

 >  That is, if you build a bunch of variant packages with options and
 >  upload them to a package repository it should be possible for people
 >  using pkg_install to download and install them without specifically
 >  having to know the special names;
 A couple of years ago, pkg_summary(5) was introduced for pkgsrc which is
 provided by all bulk build tools and uploaded to the repository together
 with binary packages. Both PKGNAME and PKG_OPTIONS are specified in
 pkg_summary(5). So whatever naming convention you use -- who cares?  It
 doesn't matter at all. With a help of PKGNAME, PKG_OPTIONS and FILE_NAME
 (also present in package summary) you can easily find the filename for
 your favourite binary with a set of options you need.

 BTW, FILEBASE variable I propose to add doesn't prevent anybody from
 creating One True Naming Conventions for binary packages in the future.
 It can easily be implemented *on top* of FILEBASE.

 >  This all hinges on getting the naming right so I think we need to
 >  first figure out what the naming scheme should be, which isn't
 >  entirely trivial to sort out, then arrange to have the package
 >  filename be set automatically rather than by user configuration.
 Naming convention for binaries was discussed at least two times and we
 had no success. The same for bulk builds producing binaries built with
 different options. With a bunch of tools for pkgsrc I have got, notably
 pkgnih, distbb and pkg_summary-utils, I believe I'm closer to the goal
 than anybody else. So, yes, I'm *slowly* moving to this direction and
 need some minor support from pkgsrc side. I believe two lines of code
 cannot break anything in pkgsrc and provide some flexibility to users
 until developer have no final decision about binaries naming convention.
 More over, as I said above new variable FILEBASE can and probably will
 be used for implementing One True Naming Convention. So, it is a small
 step forward. Also, this trivial 3-lines patch allows to do research in
 this area.

 -- 
 Best regards, Aleksey Cheusov.

From: Thomas Klausner <wiz@NetBSD.org>
To: NetBSD bugtracking <gnats-bugs@NetBSD.org>
Cc: 
Subject: Re: pkg/44698: Alternative PKGFILE [patch]
Date: Fri, 18 Mar 2011 10:38:30 +0100

 On Tue, Mar 08, 2011 at 12:10:01PM +0000, cheusov@tut.by wrote:
 > Index: mk/flavor/pkg/package.mk
 > ===================================================================
 > RCS file: /cvsroot/pkgsrc/mk/flavor/pkg/package.mk,v
 > retrieving revision 1.20
 > diff -u -r1.20 package.mk
 > --- mk/flavor/pkg/package.mk	9 Feb 2010 23:02:13 -0000	1.20
 > +++ mk/flavor/pkg/package.mk	8 Mar 2011 12:01:01 -0000
 > @@ -11,7 +11,8 @@
 >  .  endif
 >  .endif
 >  PKG_SUFX?=		.tgz
 > -PKGFILE?=		${PKGREPOSITORY}/${PKGNAME}${PKG_SUFX}
 > +FILEBASE?=		${PKGBASE}
 > +PKGFILE?=		${PKGREPOSITORY}/${FILEBASE}-${PKGVERSION}${PKG_SUFX}
 >  PKGREPOSITORY?=		${PACKAGES}/${PKGREPOSITORYSUBDIR}
 >  PKGREPOSITORYSUBDIR?=	All
 >  
 > 

 Shouldn't the "tarup-pkg" target be changed as well?
  Thomas

From: Aleksey Cheusov <cheusov@tut.by>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/44698: Alternative PKGFILE [patch]
Date: Fri, 18 Mar 2011 14:31:44 +0200

  >> Index: mk/flavor/pkg/package.mk
  >> ===================================================================
  >> RCS file: /cvsroot/pkgsrc/mk/flavor/pkg/package.mk,v
  >> retrieving revision 1.20
  >> diff -u -r1.20 package.mk
  >> --- mk/flavor/pkg/package.mk	9 Feb 2010 23:02:13 -0000	1.20
  >> +++ mk/flavor/pkg/package.mk	8 Mar 2011 12:01:01 -0000
  >> @@ -11,7 +11,8 @@
  >>  .  endif
  >>  .endif
  >>  PKG_SUFX?=		.tgz
  >> -PKGFILE?=		${PKGREPOSITORY}/${PKGNAME}${PKG_SUFX}
  >> +FILEBASE?=		${PKGBASE}
  >> +PKGFILE?=		${PKGREPOSITORY}/${FILEBASE}-${PKGVERSION}${PKG_SUFX}
  >>  PKGREPOSITORY?=		${PACKAGES}/${PKGREPOSITORYSUBDIR}
  >>  PKGREPOSITORYSUBDIR?=	All
  >>  
  >> 
 >  
 >  Shouldn't the "tarup-pkg" target be changed as well?

 Yes, target tarup-pkg needs to be modifed too to accept value of
 FILEBASE.  I overlooked it.  For this to work pkg_tarup command needs to
 be modified too (e.g., new option -f <filebase>)

 -- 
 Best regards, Aleksey Cheusov.

From: "Thomas Klausner" <wiz@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/44698 CVS commit: pkgsrc/pkgtools/pkg_tarup
Date: Sat, 19 Mar 2011 09:44:17 +0000

 Module Name:	pkgsrc
 Committed By:	wiz
 Date:		Sat Mar 19 09:44:17 UTC 2011

 Modified Files:
 	pkgsrc/pkgtools/pkg_tarup: Makefile
 	pkgsrc/pkgtools/pkg_tarup/files: pkg_tarup pkg_tarup.1

 Log Message:
 Add filebase support, allowing to choose the filename for the resulting
 package; from Aleksey Cheusov in relation to PR 44698.

 Bump version to 1.9.


 To generate a diff of this commit:
 cvs rdiff -u -r1.37 -r1.38 pkgsrc/pkgtools/pkg_tarup/Makefile
 cvs rdiff -u -r1.23 -r1.24 pkgsrc/pkgtools/pkg_tarup/files/pkg_tarup
 cvs rdiff -u -r1.4 -r1.5 pkgsrc/pkgtools/pkg_tarup/files/pkg_tarup.1

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

State-Changed-From-To: open->closed
State-Changed-By: wiz@NetBSD.org
State-Changed-When: Sat, 19 Mar 2011 09:48:29 +0000
State-Changed-Why:
Committed patch sent in private mail. Thank you!


From: "Thomas Klausner" <wiz@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/44698 CVS commit: pkgsrc/mk/flavor/pkg
Date: Sat, 19 Mar 2011 09:45:24 +0000

 Module Name:	pkgsrc
 Committed By:	wiz
 Date:		Sat Mar 19 09:45:24 UTC 2011

 Modified Files:
 	pkgsrc/mk/flavor/pkg: package.mk

 Log Message:
 Add FILEBASE support for choosing the file name for a binary package.
 From Aleksey Cheusov in relation to PR 44698.


 To generate a diff of this commit:
 cvs rdiff -u -r1.20 -r1.21 pkgsrc/mk/flavor/pkg/package.mk

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

>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.