Changes

Jump to navigation Jump to search
Line 278: Line 278:  
  main = bin/launch
 
  main = bin/launch
 
  arch = build
 
  arch = build
 +
 +
== Slots ==
 +
 +
Slots make sense only for binary services when they could be built against several compatibility ranges of their dependencies and these dependencies could be installed from native packages.
 +
 +
Assume that service requires pycairo and source code uses pycairo feature that appeared only in v1.8 but source code can fallback to previous pycairo verisons too. If pycairo can be installed from 0install feeds, there is no need in slots since service can declare "pycairo >= 1.8" dependency and such pycairo will be installed from 0install feeds. But if pycairo could be installed from native packages there are no chances to know in advance what pycairo version will present and service should have two implementations, one for pycairo < 1.8 and one for pycairo >= 1.8. In this case, slots will be useful.
 +
 +
There are two methods to define slots:
 +
* in service that uses dependency with slots
 +
* in dependency itself
 +
 +
In first case, ''slots'' and appropriate ''requires'' options should be placed to ''[Service]'' section that uses dependency:
 +
 +
  requires = <dependency>
 +
  slots[<dependency>] = <versions-range>
 +
 +
In second case, ''slots'' option should be placed to ''[Service]'' section that is used:
 +
 +
  slots = <versions-range>
 +
 +
In both cases, ''slots'' option will declare compatibility ranges for particular dependency. Only one, closed from both sides, range could be used. For example in pycairo case, it could be:
 +
 +
  1.0, 1.8, 2.0
 +
 +
1.0 (it could be 0.0 as well) version restrict ranges from the left and 2.0 (most likely v2.0 will be not backwards compatibility with v1.x) from the right, so only two ranges could be chosen, 1.0 >= x < 1.8, 1.8 >= x < 2.0. While building binaries for ''0sugar build'' command, 0sugar will detect what current pycairo version is (service is building/linking against), and will choose proper slot or fail otherwise.
    
== Predefined options ==
 
== Predefined options ==

Navigation menu