Package conary :: Package build :: Module packagepolicy :: Class Requires
[hide private]
[frames] | no frames]

Class Requires

source code

  action.Action --+                
                  |                
action.RecipeAction --+            
                      |            
      policy.BasePolicy --+        
                          |        
              policy.Policy --+    
                              |    
                       _addInfo --+
                                  |
  action.Action --+               |
                  |               |
action.RecipeAction --+           |
                      |           |
      policy.BasePolicy --+       |
                          |       |
              policy.Policy --+   |
                              |   |
                    _dependency --+
                                  |
                                 Requires
Known Subclasses:
derivedpolicy.Requires, _basePluggableRequires

NAME

r.Requires() - Creates dependency requirements

SYNOPSIS

r.Requires([/path/to/file, filterexp] || [packagename:component[(FLAGS)], filterexp] || [exceptions=filterexp)])

DESCRIPTION

The r.Requires() policy adds requirements for a file. You can pass in exceptions that should not have automatic requirement discovery done, such as example shell scripts outside of %(docdir)s.

Note: Components are the only troves which can be required.

For executables executed only through wrappers that use LD_LIBRARY_PATH to find the libraries instead of embedding an RPATH in the binary, you will need to provide a synthetic RPATH using r.Requires(rpath='RPATH') or r.Requires(rpath=('filterExp', 'RPATH')) calls, which are tested in the order provided.

The RPATH is a standard Unix-style path string containing one or more directory names, separated only by colon characters, except for one significant change: Each path component is interpreted using shell-style globs, which are checked first in the %(destdir)s and then on the installed system. (The globs are useful for cases like perl where statically determining the entire content of the path is difficult. Use globs only for variable parts of paths; be as specific as you can without using the glob feature any more than necessary.)

Executables that use dlopen() to open a shared library will not automatically have a dependency on that shared library. If the program unconditionally requires that it be able to dlopen() the shared library, encode that requirement by manually creating the requirement by calling r.Requires('soname: libfoo.so', 'filterexp') or r.Requires('soname: /path/to/libfoo.so', 'filterexp') depending on whether the library is in a system library directory or not. (It should be the same as how the soname dependency is expressed by the providing package.)

For unusual cases where a system library is not listed in ld.so.conf but is instead found through a search through special subdirectories with architecture-specific names (such as i686 and tls), you can pass in a string or list of strings specifying the directory or list of directories. with r.Requires(sonameSubtrees='/directoryname') or r.Requires(sonameSubtrees=['/list', '/of', '/dirs'])

Note: These are not regular expressions. They will have macro expansion expansion performed on them.

For unusual cases where Conary finds a false or misleading dependency, or in which you need to override a true dependency, you can specify r.Requires(exceptDeps='regexp') to override all dependencies matching a regular expression, r.Requires(exceptDeps=('filterexp', 'regexp')) to override dependencies matching a regular expression only for files matching filterexp, or r.Requires(exceptDeps=(('filterexp', 'regexp'), ...)) to specify multiple overrides.

EXAMPLES

r.Requires('mailbase:runtime', '%(sbindir)s/sendmail')

Demonstrates using r.Requires to specify a manual requirement of the file %(sbindir)s/sendmail to the :runtime component of package mailbase.

r.Requires('file: %(sbindir)s/sendmail', '%(datadir)s/squirrelmail/index.php')

Specifies that conary should require the file %(sbindir)s/sendmail to be present when trying to install %(datadir)s/squirrelmail/index.php.

r.Requires('soname: %(libdir)/kde3/kgreet_classic.so', '%(bindir)/kdm')

Demonstrates using r.Requires to specify a manual soname requirement of the file %(bindir)s/kdm to the soname %(libdir)/kde3/kgreet_classic.so.

r.Requires(exceptions='/usr/share/vim/.*/doc/')

Demonstrates using r.Requires to specify that files in the subdirectory /usr/share/vim/.*/doc are excepted from being marked as requirements.

Nested Classes [hide private]
  dbDepCacheClass
Instance Methods [hide private]
 
__init__(self, *args, **keywords) source code
 
updateArgs(self, *args, **keywords)
Call as:
source code
 
preProcess(self) source code
 
postProcess(self) source code
 
doFile(self, path) source code
 
_addJavaRequirements(self, path, m, pkg) source code
 
whiteOut(self, path, pkg) source code
 
unionDeps(self, path, pkg, f) source code
 
_addELFRequirements(self, path, m, pkg)
Add ELF and abi dependencies, including paths when not shlibs
source code
 
_getPythonRequiresSysPath(self, pathName) source code
 
_getPythonRequiresModuleFinder(self, pythonPath, destdir, libdir, sysPath, bootstrapPython) source code
 
_delPythonRequiresModuleFinder(self) source code
 
_addPythonRequirements(self, path, fullpath, pkg, script=False) source code
 
_checkPackagePythonDeps(self, pkg, depPath, depNames, flags) source code
 
_checkSystemPythonDeps(self, depNames, flags) source code
 
_normalizePythonDep(self, depName) source code
 
_addRubyRequirements(self, path, fullpath, pkg, script=False) source code
 
_fetchPerl(self)
Cache the perl path and @INC path with %(destdir)s prepended to each element if necessary
source code
 
_getPerlReqs(self, path, fullpath) source code
 
_markManualRequirement(self, info, path, pkg, m) source code
 
_checkInclusion(self, info, path) source code
 
_addRequirement(self, path, info, flags, pkg, depClass) source code

Inherited from _addInfo: doProcess, runInfo

Inherited from policy.Policy: compileFilters, do, filterExpArgs, filterExpression, mtimeChanged, policyException, policyInclusion, walkDir

Inherited from policy.BasePolicy: dbg, error, info, postInit, postPolicy, warn

Inherited from policy.BasePolicy (private): _addClassName, _pathAllowed

Inherited from action.RecipeAction: doAction, doPrep, doSuggestAutoBuildReqs, init_error

Inherited from action.Action: addArgs

Inherited from action.Action (private): _applyDefaults

Class Variables [hide private]
  bucket = 8
  requires = (('PackageSpec', 7), ('SharedLibrary', 7), ('Provid...
  filetree = 4
where to look for files to which to apply the policy: policy.DESTDIR, the default, walks the files in the destdir, policy.BUILDDIR walks the files in the build directory, and policy.PACKAGE iterates over the packaged files rather than walking the destdir, which besides being possibly faster also applies to files that are not on the filesystem (like device nodes).
  invariantexceptions = ('%(docdir)s/')
subclasses may set to a list of exception filters that are always applied regardless of what other exceptions may be provided by the recipe; these exceptions being applied is an invariant condition of the doFile method.

Inherited from _addInfo: keywords, processUnmodified

Inherited from policy.Policy: invariantinclusions, invariantsubtrees, recursive, rootdir

Inherited from policy.BasePolicy: allowUnusedFilters

Method Details [hide private]

__init__(self, *args, **keywords)
(Constructor)

source code 
Overrides: policy.Policy.__init__
(inherited documentation)

updateArgs(self, *args, **keywords)

source code 
Call as:
   C{I{ClassName}(I{info}, I{filterexp})}
or:
   C{I{ClassName}(I{info}, exceptions=I{filterexp})}
where filterexp is either a regular expression or a tuple of (regexp[, setmodes[, unsetmodes]])
Overrides: _addInfo.updateArgs
(inherited documentation)

preProcess(self)

source code 
Overrides: _dependency.preProcess

doFile(self, path)

source code 
Overrides: _addInfo.doFile

Class Variable Details [hide private]

requires

Value:
(('PackageSpec', 7), ('SharedLibrary', 7), ('Provides', 7))