# pkgdb errors break upgrades and require maintenance



## Beeblebrox (Jan 13, 2011)

I have had to mess around with pkgdb issues for some time, but now:

1. Enough of having to run this to fix pkgdb problems: `# pkgdb -FfLv`

2. Enough of correcting stuff like this. Gnome and other apps list these as depends in so many places that at this point I will insist on absolutely not installing the damned things.

```
math/atlas
	math/py-numpy
	math/lapack
	devel/py-nose
	math/blas
```
3. I already have bash installed, but its bash-static and in /bin.  I already specified  `# pkgdb -s /bash/bash-static/`
but bash depend errors keep coming up when running`# pkgdb -FfLv`

4. Enough of messages like this:

```
[: -le: argument expected
```
The main culprit is gnome-user-share asking for apache tools to use with avahi_mdns (or mod_dnssd?). Do not want Apache, so not installed by modifying Makefile of gnome-user-share, but it's only a temporary solution.

5. If I want to install a new port, I have to go through the exercise again, while editing the Makefile of the specific port does not work well, as
a. finding the depends of the depends is an adventure worthy of "Indiana Jones"
b. If you run c(v)sup the Makefile is re-set and you receive an invitation to start all over.

So the solution I would like is a global option or setting to specify somewhere (make.conf?) WITH / WITHOUT or something to avoid all this?  I tried some settings in /etc/make.conf but no results.

These issues were partially answered before here but answers there are now insufficient...


----------



## danbi (Jan 13, 2011)

Try portmaster instead of portupgrade. I gave up on portupgrade recently -- it depends on too much (ruby, db)and it's databases are so fragile. Both have their different unique features... Never missed portupgrade though 

Port dependency is another thing -- you need to understand these dependencies in order to support complex installation anyway. The WITH_/WITHOUT_ in /etc/make.conf really do work.


----------



## Beeblebrox (Jan 13, 2011)

Thanks danbi.  I have been using portmaster for some time now and its way better IMHO than the other choices. However, it still refers to pkgdb (from man file): 





> ...uses the existing ports infrastructure, including what is in /var/db/pkg


I have also been using WITH in my make.conf and already have specified, among other things, certain customizations in there:

```
WITHOUT_NLS="YES"
WITH_MYSQL_VER=55
NO_INET6="YES"
BUILD_OPTIMIZED="YES"
APACHE_PORT=www/lighttpd
ORBIT_PORT=devel/ORBit2
LIBXML_PORT=textproc/libxml2
SQLITE_PORT=databases/mysql55-server
SQLITE3_PORT=databases/mysql55-server
```

The problem now is:
1. How do I find (is there a list somewhere?) what is supposed to come after WITHOUT_ (like _NLS above).  In this specific case I would like to for example specify WITHOUT_PY-NUMPY="YES", but how do I cross-check whether that is indeed the correct syntax?
2. After install or portmaster, I would like to avoid having to regularly run pkgdb for the sole purpose of fixing blank entries in /var/db/pkg.  One might argue that such a thing is not a big deal and has no impact on performance but sometimes I do run into upgrade or install problems when the listed depend of a package is missing in the db.

I just figured out why bash is still giving problems (blank line message).  I think the reason could be (and would like confirmation of this) that `# pkgdb -s /bash/bash-static/` only fixes depends of existing packages and does nothing for packages installed after running this command.  I would therefore need to put into my make.config something like BASH_PORT=shells/bash-static, right?


----------



## kpa (Jan 13, 2011)

Portmaster does not use pkgdb file at all, the contents of /var/db/pkg/* directories are used but without any external index file or database. pkgdb(1) should not be used with portmaster because the database used by it won't be in sync with /var/db/pkg

These commands should be used to fix any inconsistencies in /var/db/pkg and /var/db/ports:

`# portmaster --check-depends`
`# portmaster --check-port-dbdir`


----------



## Beeblebrox (Jan 15, 2011)

Apparently I have overlooked some things previously. After running the commands by kpa (and considerable time), my system is now free of errors in this area.

To re-state the question from previous post however: 
1. What if a different port I try to install asks for the same depends which I just processed?  To prevent buildup of unwanted depends, I'm pretty sure I have to specify WITHOUT_ or something comparable in make.conf?  More specifically, how can I disable gnome-user-share from being re-built in the future by some other port I may install.

2. I am confused (which happens often) about how to specify yes in make.conf.  
	
	



```
XYZ="YES"
XYZ=YES
OR XYZ=yes ??
```

3. Any suggestions for question #1 from previous post?


----------



## wblock@ (Jan 15, 2011)

Beeblebrox said:
			
		

> 1. What if a different port I try to install asks for the same depends which I just processed?  To prevent buildup of unwanted depends, I'm pretty sure I have to specify WITHOUT_ or something comparable in make.conf?



Many dependencies aren't optional.  If you managed to build/install a port without those dependencies, or force-deleted them afterwards, then yes, they'll be installed the next time another port needs them.  This is actually a feature of the ports system.



> More specifically, how can I disable gnome-user-share from being re-built in the future by some other port I may install.



If it's an option, use WITHOUT_.  But it isn't an option for x11/gnome2.  Maybe use x11/gnome2-lite instead?



> 2. I am confused (which happens often) about how to specify yes in make.conf.
> 
> 
> 
> ...



The quotes are not needed.  In the ports Makefile system, variables are usually tested on whether they're defined at all, not the value.  So the last two would be equivalent.



> 3. Any suggestions for question #1 from previous post?



Others have already suggested portmaster to avoid using pkgdb at all.  As an alternate, keep using portupgrade and pkgdb, but don't override what it's trying to do.  If dependencies aren't options, it means they aren't optional as far as the port is concerned.  If some dependencies really aren't required, it would be nice to modify the port to make them optional, then submit the changes to the port maintainer.  Probably would be good to check with the maintainer first; there could be some non-intuitive reason for those dependencies.

The bash-static errors could be fixed by not using the regular bash.  If the reason for using bash-static--and putting it in /bin!--is to use it as root's shell, there are easier and safer ways to do that.


----------



## Beeblebrox (Jan 19, 2011)

@wblock:
Thanks for the explanation.  I Sometimes get a little ahead of myself, as I have done here.  I would still like to know, if possible, however:

1. How do I find (is there a list somewhere?) what is supposed to come after WITHOUT_ (like _NLS above). In this specific case I would like to for example specify 
	
	



```
WITHOUT_PY-NUMPY="YES"
```
 but how do I cross-check whether that is indeed the correct syntax?

This is what I meant by 





> Any suggestions for question #1 from previous post?


----------



## wblock@ (Jan 19, 2011)

My post above should have said


> The bash-static errors could be fixed by just using the regular bash.



As far as how to find the WITH_ and WITHOUT_ options... they're part of the ports Makefile system, automatically generated from the OPTIONS in a port's Makefile.  So if a port had an option menu with PY-NUMPY, the WITH_ and WITHOUT_ variables would be defined by the ports system and usable in Makefiles.

A suitable find(1)/grep(1) could find all the WITH_/WITHOUT_ variables defined.  A quick look doesn't find a NUMPY option.


----------

