Monday, May 19, 2014

How to prevent an IPS package from being upgraded

Recently I had a situation where some incorporating package depends on a package, say foo, version 3.1 and I had to wait for the update exactly to 3.2 and do not allow 3.1.1, 3.1.2, ...
"Freeze" option doesn't help here (may be should?) but it's a possible to use some versioning tricks in incorporating  manifest.
First option is to ensure that required version of 'foo' is published with trailing zero:

    foo@3.1.0
    foo@3.1.1
    foo@3.1.2

Then we can use "depend fmri=foo@3.1.0 type=incorporate" line in incorporating manifest and only upgrade to this version will be allowed.

More reliable option (and you don't need trailing zeros) is to use the timestamp in incorporate dependency:

    depend type=incorporate fmri=foo@3.1:20140507T021327Z

Only upgrade to version 3.1 with specific timestamp will be allowed here.

If foo@3.2 will be published and we want to wait until 3.3, then we can publish a new version of the incorporating package using next dependencies:

depend type=require fmri=foo@3.2
depend type=incorporate fmri=foo@3.2.0

P.S. Many thanks to @binarycrusader

No comments: