Bug 54424 - portupgrade ignores ALT_PKGDEP
Summary: portupgrade ignores ALT_PKGDEP
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Daichi GOTO
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-07-13 06:00 UTC by bharat
Modified: 2005-10-19 08:49 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description bharat 2003-07-13 06:00:29 UTC
	
	pkgtools.conf contains a section called ALT_PKGDEP that allows you to 
	substitute one package dependency for another.  In my particular case,
	I want to install the "security/acid" port without having it install
	"databases/adodb", which is listed in the RUN_DEPENDS for the acid
	Makefile.

	In the ALT_PKGDEP section of pkgtools.conf I've tried the following
	settings:
	1.	'databases/adodb' => :delete,
	2.	'databases/adodb' => :skip,
	3.	'adodb' => :delete,
	4.	'adodb' => :skip,

	but none of them work.  A quick grep through the /usr/local/lib/ruby/site_ruby
	code shows that most of the other hashes defined in pkgtools.conf are
	referenced in the code, but ALT_PKGDEP isn't.  It looks like this feature
	was never implemented.

Fix: 

Implement this function, or document the fact that it doesn't work in pkgtools.conf
	so that folks don't waste their time trying to get it working!
How-To-Repeat: 	
	Edit pkgtools.conf and modify ALT_PKGDEP to be:
		  ALT_PKGDEP = { 
		    'databases/adodb' => :delete, 
		  } 

	then do "portinstall acid" and see that it still tries to install adodb.
Comment 1 Sergey A. Osokin freebsd_committer freebsd_triage 2003-07-16 10:25:31 UTC
Responsible Changed
From-To: freebsd-ports-bugs->knu

Over to maintainer.
Comment 2 Akinori MUSHA 2003-07-19 23:14:04 UTC
At Sat, 12 Jul 2003 21:52:02 -0700 (PDT),
Bharat Mediratta wrote:
> >Description:
> 	
> 	pkgtools.conf contains a section called ALT_PKGDEP that allows you to 
> 	substitute one package dependency for another.  In my particular case,
> 	I want to install the "security/acid" port without having it install
> 	"databases/adodb", which is listed in the RUN_DEPENDS for the acid
> 	Makefile.

ALT_PKGDEP does not work for that purpose.  It is, as described in the
comment section, for updating already installed packages'
depencencies.  If you thought it works when installing a new port, it
might be my English problem.  It was regrettable that I made you think
so without using the word "port(s)" in the section at all.

Actually, it is impossible to implement the function you possibly
want.  You can't make a port skip its dependencies and I wouldn't want
to do that even if it were possible.  You should instead ask the
maintainer to make the dependency optional, or propose and implement a
selective dependency feature in the ports system.

> 	In the ALT_PKGDEP section of pkgtools.conf I've tried the following
> 	settings:
> 	1.	'databases/adodb' => :delete,
> 	2.	'databases/adodb' => :skip,
> 	3.	'adodb' => :delete,
> 	4.	'adodb' => :skip,
> 
> 	but none of them work.  A quick grep through the /usr/local/lib/ruby/site_ruby
> 	code shows that most of the other hashes defined in pkgtools.conf are
> 	referenced in the code, but ALT_PKGDEP isn't.  It looks like this feature
> 	was never implemented.  

It is pkgdb(1) that refers to the variable and automatically replace
specified dependencies during a pkgdb -F session.

> >How-To-Repeat:
> 	
> 	Edit pkgtools.conf and modify ALT_PKGDEP to be:
> 		  ALT_PKGDEP = { 
> 		    'databases/adodb' => :delete, 
> 		  } 
> 
> 	then do "portinstall acid" and see that it still tries to install adodb.
> 
> >Fix:
> 	Implement this function, or document the fact that it doesn't work in pkgtools.conf
> 	so that folks don't waste their time trying to get it working!

Things are not always made as you want them to be.  I should have
documented that there are kinds of people who should not use
portupgrade only to blame and demotivate the author.

-- 
                     /
                    /__  __            Akinori.org / MUSHA.org
                   / )  )  ) )  /     FreeBSD.org / Ruby-lang.org
Akinori MUSHA aka / (_ /  ( (__(  @ iDaemons.org / and.or.jp

"It seems to me as we make our own few circles 'round the sun
          We get it backwards and our seven years go by like one"
Comment 3 bharat 2003-07-23 21:41:27 UTC
From: "Akinori MUSHA" <knu@iDaemons.org>
> ALT_PKGDEP does not work for that purpose.  It is, as described in the
> comment section, for updating already installed packages'
> depencencies.  If you thought it works when installing a new port, it
> might be my English problem.  It was regrettable that I made you think
> so without using the word "port(s)" in the section at all.

Obviously (from reading your entire email) by filing this bug I have
offended and demotivated you and for that I apologize.  The port 
tools that you have written are excellent and I appreciate them 
every time I use them.  Furthermore, your comments demonstrate
a mastery of the English language.

However, in the spirit of providing constructive criticism that
will hopefully lead to improving the experience for others, I
must point out that it was totally unclear to me (and to at least 
the one other person who I found via google who had this problem) 
from the documentation that this particular feature applies only 
to installed packages.  Even though you did not mention the 
word "port" in the description, I only found this particular 
configuration file from the portinstall/portupgrade(1) man page 
so it was a natural conclusion for me to assume that it applied to 
portinstall.

Furthermore, your example snippet:

  #     # If you install Apache from source (not from ports/packages)
  #     'apache' => :delete,

Appeared to have direct bearing upon my problem, where I have
Apache installed from my own source and not from a package, but
I cannot install other ports because they depend on apache.

> Actually, it is impossible to implement the function you possibly
> want.  You can't make a port skip its dependencies and I wouldn't want
> to do that even if it were possible.  You should instead ask the
> maintainer to make the dependency optional, or propose and implement a
> selective dependency feature in the ports system.

I am not by any means making the mistake of petulantly demanding
that you implement a feature just because I want it.  However, I
have certainly found that it is not only possible but beneficial
for me to ignore certain dependencies for certain packages.  I
use this capability judiciously and find it tremendously valuable.
Unfortunately, at the moment I have to do this by modifying the
RUN_DEPENDS defines in the Makefile.  I do agree though that the
portupgrade system is perhaps not capabable of intercepting and
making this change as appropriate and I should direct my energies
elsewhere to resolve this.  That's unfortunate, because pkgtools.conf 
would be a very nice place to capture this dependency modification.

> > >Fix:
> > Implement this function, or document the fact that it doesn't work 
> > in pkgtools.conf so that folks don't waste their time trying to get 
> > it working!
> 
> Things are not always made as you want them to be.  I should have
> documented that there are kinds of people who should not use
> portupgrade only to blame and demotivate the author.

Again I apologize for offending you.  But I humbly suggest that you
modify the comment to say something like this:

"This is a hash to define alternative package dependencies for
 installed packages.  It is not applicable when installing new
 ports"

That would have saved me an hour of my time, and perhaps it will
forestall bug reports like this in the future.

regards,
-Bharat
Comment 4 Daichi GOTO freebsd_committer freebsd_triage 2005-06-22 06:33:02 UTC
State Changed
From-To: open->feedback

Grab and over to new maintainer. 


Comment 5 Daichi GOTO freebsd_committer freebsd_triage 2005-06-22 06:33:02 UTC
Responsible Changed
From-To: knu->daichi

Grab and over to new maintainer.
Comment 6 KOMATSU Shinichiro 2005-10-18 07:40:09 UTC
Hello. I am a new maintainer of portupgrade.

I read ports/54424 and found that:

(1) PKG_ALTDEP does not work as expected, so apply the patch to fix it.
(2) It is unclear that PKG_ALTDEP is treated when "pkgdb -F" is executed,
    so clarify it in the document. 

If you do not find any problem, I will ask some committer to commit
this, and close this PR.


diff --exclude=CVS --exclude=*.log* -urN sysutils/portupgrade.old/Makefile sysutils/portupgrade/Makefile
--- sysutils/portupgrade.old/Makefile	Tue Aug  2 18:06:37 2005
+++ sysutils/portupgrade/Makefile	Tue Oct 18 12:48:02 2005
@@ -7,7 +7,7 @@
 
 PORTNAME=	portupgrade
 PORTVERSION=	20041226
-PORTREVISION=	7
+PORTREVISION=	8
 CATEGORIES=	sysutils
 MASTER_SITES=	ftp://ftp.iDaemons.org/pub/distfiles/ \
 		${MASTER_SITE_LOCAL}
diff --exclude=CVS --exclude=*.log* -urN sysutils/portupgrade.old/files/patch-bin-pkgdb sysutils/portupgrade/files/patch-bin-pkgdb
--- sysutils/portupgrade.old/files/patch-bin-pkgdb	Thu Jan  1 09:00:00 1970
+++ sysutils/portupgrade/files/patch-bin-pkgdb	Tue Oct 18 11:58:13 2005
@@ -0,0 +1,13 @@
+Index: bin/pkgdb
+===================================================================
+--- bin/pkgdb	(revision 38)
++++ bin/pkgdb	(working copy)
+@@ -615,7 +615,7 @@
+       next
+     end
+ 
+-    if $pkgdb.match?(pat, dep)
++    if File.fnmatch?(pat, dep)
+       case alt
+       when :delete, :skip
+ 	return [alt]
diff --exclude=CVS --exclude=*.log* -urN sysutils/portupgrade.old/files/patch-etc-pkgtools.conf sysutils/portupgrade/files/patch-etc-pkgtools.conf
--- sysutils/portupgrade.old/files/patch-etc-pkgtools.conf	Thu Jan  1 09:00:00 1970
+++ sysutils/portupgrade/files/patch-etc-pkgtools.conf	Tue Oct 18 12:47:34 2005
@@ -0,0 +1,16 @@
+Index: etc/pkgtools.conf
+===================================================================
+--- etc/pkgtools.conf	(revision 39)
++++ etc/pkgtools.conf	(revision 40)
+@@ -252,8 +252,10 @@
+   # be used as B values, instead of pkgname glob patterns.  <:delete>
+   # means to delete the dependency and <:skip> to skip it.
+   #
+-  # cf. pkg_glob(1)
++  # This replacement is done when "pkgdb -F" is executed.
+   #
++  # cf. pkg_glob(1), pkgdb(1)
++  #
+   # e.g.:
+   #   ALT_PKGDEP = {
+   #     # If you use apache13-modssl instead of apache13
Comment 7 Daichi GOTO freebsd_committer freebsd_triage 2005-10-19 08:48:31 UTC
State Changed
From-To: feedback->closed

Committed. Thanks!