Conary:loadSuperClass
From rPath Wiki
The loadSuperClass recipe module function loads into the module namespace the latest version of the named source package from the repository, without regard for which binary version of that package might be installed on the system. (This is in contrast to loadInstalled, which loads by preference the version of the source package corresponding to the version of the binary package that is installed on the system, if any, and falls back to the same behavior as loadSuperClass if no such package is installed on the system.)
The loadSuperClass recipe module function finds the superclass component by looking down the branch of the package it is in. That is, if the package you are working on is on a shadow like /contrib.rpath.org@rpl:devel//myproject.rpath.org@rpl:devel/, then loadSuperClass will look first in myproject.rpath.org@rpl:devel and then in contrib.rpath.org@rpl:devel for the component containing the superclass.
If the superclass component is not available, there are a few ways to make it available:
- Specify the version to load, like this:
loadSuperClass('somesuperclass=contrib.rpath.org@rpl:devel')
This is generally the easiest way; if you do not know why you would do anything else, do this.
- Create a shadow of
somesuperclasson the same label (say,myproject.rpath.org@rpl:devel) as your package:
$ cvc shadow myproject.rpath.org@rpl:devel somesuperclass:source=contrib.rpath.org@rpl:develThis is useful if you want to control what version of the superclass to use, or if you want to make changes to the superclass, and/or you are going to be creating many packages on your label which use the same superclass and you want to avoid having to specify the label in the package.
- Untested idea: Create a new
somesuperclasspackage on the same label as your package which itself loads the superclass:
$ cvc newpkg somesuperclass
$ cd somesuperclass
$ cat > somesuperclass.recipe <<EOF
loadSuperClass('somesuperclass=contrib.rpath.org@rpl:devel')
class Dummy(SomeSuperClass):
name = 'somesuperclass'
version = '0'
def setup(r):
pass
EOF
$ cvc add somesuperclass.recipe
$ cvc commit
This might be useful if you are going to build multiple packages on your label, and you do not want to have to maintain a shadow of the superclass but instead want to always have available the latest changes to the superclass on the label you are pointing to.
You may find some recipes that already exist that have loadSuperClass('foo', label='bar') intead of loadSuperClass('foo=bar'); this is an old syntax that is still supported for the sake of backwards compatibility with older recipes.
Categories: Needs Editing | Conary | Packaging | Recipe
