# package: cache, dependencies and conflicts



## presario (Jul 28, 2010)

1. Why does pkg_add keeps downloading packages that were previously downloaded and installed? Isn't there a cache directory that stores packages fetched by pkg_add. The only workaround I've found is two use pkg_fetch first, and then pass the names of the downloaded packages to pkg_add. I would like to know if there is a way to make this process transparent to the user through pkg_add and a cache directory.

2. When package foo depends on package bar-1.2.3 does it mean foo requires that specific 1.2.3 version of bar or that version plus any higher versions? I'm trying to install package asterisk16, but it is trying to install postgresql-client-8.2.17_1 when I already have postgresql-client-8.4.0_1 installed.

3. What should I do if two different versions of the same software conflict with each other, but I need both of them (new version is for my own use and older version is a dependency for another package).

Thanks for reading.


----------



## SirDice (Jul 28, 2010)

presario said:
			
		

> 1. Why does pkg_add keeps downloading packages that were previously downloaded and installed?


Because "pkg_add -r" implies getting the package remotely.



> Isn't there a cache directory that stores packages fetched by pkg_add.


Nope.



> 2. When package foo depends on package bar-1.2.3 does it mean foo requires that specific 1.2.3 version of bar or that version plus any higher versions?


It means that foo was build against bar-1.2.3.



> 3. What should I do if two different versions of the same software conflict with each other, but I need both of them (new version is for my own use and older version is a dependency for another package).


Build from source. Then you can build said package against a different version of the dependency.


----------



## valuequest (Mar 14, 2011)

SirDice said:
			
		

> Build from source. Then you can build said package against a different version of the dependency.


When a user executes the make command in a package's ports directory s/he is instructing the system to build that package from source, right?  So how can a user instruct make to build the package with the versions of dependencies that are already installed rather than (what appears to be) make's default behavior of downloading and trying to install whatever version is in the makefile?


----------



## SirDice (Mar 14, 2011)

valuequest said:
			
		

> When a user executes the make command in a package's ports directory s/he is instructing the system to build that package from source, right?


Correct.



> So how can a user instruct make to build the package with the versions of dependencies that are already installed rather than (what appears to be) make's default behavior of downloading and trying to install whatever version is in the makefile?


It doesn't. It will only start building dependencies that are not yet installed. It does NOT update/upgrade existing, already installed, dependencies.

This is a slightly different behavior then typically done by tools like portmaster or portupgrade. Those tools typically will update/upgrade dependencies first.


----------



## kpedersen (Mar 14, 2011)

Rather than use *pkg_add -r* directly, I use *pkg_fetch -R* which can be found in the portupgrade package.

*pkg_fetch* basically caches the packages in /usr/ports/packages/All where then *pkg_add* can be used.


----------

