# Force pkgng to use a specific (software) version to depend on while installing



## icecoke (Nov 2, 2015)

Is there a way to 'tweak' `pkg` in the decision, which version of a software it should be used while finding dependencies for an installation? For example:

When installing databases/phpmyadmin with `pkg` it will try to install lang/php56 and some of its extensions since lang/php56 is the 'default' php version for some time.

While databases/phpmyadmin runs wonderfull with the installed lang/php55 version, I'm forced to upgrade to lang/php56 or to used the ports. 

So I wonder:
- Where is it saved, that lang/php56 is the default?
- Is there a way (e.g. with `pkg set -o ..`) to change this?

I know this is not advised to be done, but just in case - where is it written?

Many thanks in advance!


----------



## Beastie7 (Nov 2, 2015)

For any 'tweaking', iI suggest setting up custom poudriere builds, then pointing pkgng to that repository.


----------



## icecoke (Nov 2, 2015)

Ok, but assuming we can't use a local repository for some reasons? Any idea?


----------



## kpa (Nov 3, 2015)

icecoke said:


> So I wonder:
> - Where is it saved, that lang/php56 is the default?
> - Is there a way (e.g. with `pkg set -o ..`) to change this?



As far as I know the information about the default versions is not stored anywhere in the packages nor in the system. What gets chosen as dependencies comes completely from the remote repository and what's in the repository comes from what was in effect for the default versions at time the packages were built.

You can change the dependencies with `pkg set -o` but you have to know really well what kind of replacements can be done, only ABI/API compatible (from the point of view of the third party software, not FreeBSD base system) replacements can be done or you'll get some really spectacular failures when you try to run the software.


----------



## junovitch@ (Nov 4, 2015)

The default version is set in /usr/ports/Mk/bsd.default-versions.mk and is set when the package is compiled.  You'll need to either compile locally or use your own local repository with the following /etc/make.conf entry.

```
DEFAULT_VERSIONS+= php=5.5
```

If there is a hacky way to force the package to install you're only going to make life more difficult for yourself and likely never be able to safely type `pkg upgrade` without breaking how you expect the system to work.  Just set up a proper repository that is configured for your needs and you'll have much less trouble in the long term.


----------



## icecoke (Nov 4, 2015)

junovitch@ - thanks for your input, but I assume you are thinking about ports and not `pkg`, as the latter is not interested in settings from this file and /etc/make.conf. Using `truss` etc. it looks like these things are set in /var/db/pkg/repo-FreeBSD.sqlite - so, it looks like an overwriting here would be needed after each update of this db to get this work. Ok, I will have to think about it 

update: ok, found the 'deps' Table in there, which controls this. I guess some 'UPDATE ... WHERE' clauses might does the job. And yes, we have a hacked os at all, so everything is 'special'. I won't do this on a vanilla FreeBSD 

Thanks a lot, again!


----------



## junovitch@ (Nov 5, 2015)

I'm answering the intent of the question.  The proper answer is through ports be it compiling locally with the DEFAULT_VERSIONS variable set or long term through the eventual work to remove the hard dependency allowing a port to just depend on PHP and not a specific version as is the case now.


----------

