# How can I check for the required version of dependent package



## tuor4eg (Nov 29, 2019)

Hello, everyone!
I have 2 created packages - package1 and package2.
Package1 has dependence from package2.
So, when I make package1, I add this string to the Makefile:

```
RUN_DEPENDS= package2>0:my_repo/package2
```
It works fine, but I want to check for package1 if it has new version - should I also upgrade package2? Or maybe new version package2 doesn't support package1 yet?
So I think it should be something like that (for example, package1 demand only minor changes of major version 0.1):

```
RUN_DEPENDS= package2=0.1.*:my_repo/package2
```
But I didn't find anything about this syntaxis
And another question - how to see suitable version of package2 for package1?
pkg rquery %do package1 shows name of package2
pkg rquery %dv package1 shows current version of package2
But I want to see is my installed version of package2 suitable for new version of package1! Not try to install, just to see. And also check, is new version of package2 suitable for new version of package1.
Thanks!


----------



## SirDice (Nov 29, 2019)

tuor4eg said:


> But I didn't find anything about this syntaxis


Porter's handbook: 5.9. Dependencies

You need to fix this in the port, not the package. If the port has been set up correctly (dependencies) the resulting package will be correct too.


----------



## tuor4eg (Nov 29, 2019)

SirDice said:


> Porter's handbook: 5.9. Dependencies
> 
> You need to fix this in the port, not the package. If the port has been set up correctly (dependencies) the resulting package will be correct too.



Ok, there is Minimal Version of a Dependency

```
p5-Spiffy>=0.26:devel/p5-Spiffy
```
And if I want to border dependence only current major version, should I write like this?

```
p5-Spiffy>=0.26:devel/p5-Spiffy \
p5-Spiffy<0.27:devel/p5-Spiffy
```


----------



## SirDice (Nov 29, 2019)

That's actually a good question and I don't know the answer to it. You can ask for an exact version (=), a minimal version (> or >=) or a maximum version (<) but I don't think you can combine them (version must be between A and B).

If the compatibility of PortA and PortB is really only guaranteed when their versions match then the obvious choice is to match on an exact version. As you are maintaining both ports this is something that you can easily take care of.


----------



## tuor4eg (Dec 2, 2019)

Thanks, at the moment we decided to make package2 with number of major version in the name. Maybe later will come more graceful solution)


----------

