Package conary :: Package build :: Module source :: Class addSource
[hide private]
[frames] | no frames]

Class addSource

source code

  action.Action --+            
                  |            
action.RecipeAction --+        
                      |        
             _AnySource --+    
                          |    
                    _Source --+
                              |
                             addSource

NAME

r.addSource() - Copy a file into build or destination directory

SYNOPSIS

r.addSource(sourcename, [apply=,] [dest=,] [dir=,] [httpHeaders=,] [keyid=,] [macros=,] [mode=,] [package=,] [rpm=,] [use=,] [sourceDir=])

DESCRIPTION

The r.addSource() class copies a file into the build directory or destination directory.

KEYWORDS

The following keywords are recognized by r.addSource:

apply : A command line to run after storing the file. Macros will be interpolated into this command.

dest : If set, provides the target name of the file in the build directory. A full pathname can be used. Use either dir, or dest to specify directory information, but not both. Useful mainly when fetching the file from an source outside your direct control, such as a URL to a third-party web site, or copying a file out of an RPM package. An absolute dest value will be considered relative to %(destdir)s, whereas a relative dest value will be considered relative to %(builddir)s.

dir : The directory in which to store the file, relative to the build directory. An absolute dir value will be considered relative to %(destdir)s, whereas a relative dir value will be considered relative to %(builddir)s. Defaults to storing file directly in the build directory.

keyid : Using the keyid keyword indicates the eight-digit GNU Privacy Guard (GPG) key ID, without leading 0x for the source code archive signature should be sought, and checked. If you provide the keyid keyword, r.addSource will search for a file named sourcename.{sig,sign,asc}, and ensure it is signed with the appropriate GPG key. A missing signature results in a warning; a failed signature check is fatal.

macros : If True, interpolate recipe macros in the body of a patch before applying it. For example, you might have a patch that changes CFLAGS = -O2 to CFLAGS = %(cflags)s, which will cause %(cflags)s to be replaced with the current setting of recipe.macros.cflags. Defaults to False.

mode: If set, provides the mode to set on the file.

rpm : If the rpm keyword is used, addSource looks in the file, or URL specified by rpm for an RPM containing sourcename.

use : A Use flag or boolean, or a tuple of Use flags and/or booleans, that determine whether the archive is actually unpacked or merely stored in the archive.

httpHeaders : A dictionary containing a list of headers to send with the http request to download the source archive. For example, you could set Authorization credentials, fudge a Cookie, or, if direct links are not allowed for some reason (e.g. a click through EULA), a Referer can be provided.

package : (None) If set, must be a string that specifies the package (package='packagename'), component (package=':componentname'), or package and component (package='packagename:componentname') in which to place the files added while executing this command. Previously-specified PackageSpec or ComponentSpec lines will override the package specification, since all package and component specifications are considered in strict order as provided by the recipe

sourceDir : Instructs r.addSource to look in the directory specified by sourceDir for the file to install. An absolute sourceDir value will be considered relative to %(destdir)s, whereas a relative sourceDir value will be considered relative to %(builddir)s.

EXAMPLES

The following examples demonstrate invocations of r.addSource from within a recipe:

r.addSource('usbcam.console')

The example above is a typical, simple invocation of r.addSource() which adds the file usbcam.console directly to the build directory.

r.addSource('pstoraster' , rpm=srpm, dest='pstoraster.new')

The above example of r.addSource specifies the file pstoraster is to be sought in a source RPM file, and is to be added to the build directory as pstoraster.new.

Instance Methods [hide private]
 
__init__(self, recipe, *args, **keywords) source code
 
doDownload(self) source code
 
do(self) source code

Inherited from _Source: doAction, doPrep, fetch, fetchLocal, getPath

Inherited from action.RecipeAction: doSuggestAutoBuildReqs, init_error

Inherited from action.Action: addArgs

Inherited from action.Action (private): _applyDefaults

Class Variables [hide private]
  keywords = {'apply': '', 'contents': None, 'dest': None, 'macr...
The keywords and default values accepted by the class
Method Details [hide private]

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

source code 
Parameters:
  • recipe - The recipe object currently being built is provided automatically by the PackageRecipe object. Passing in recipe from within a recipe is unnecessary.
  • dest - If set, provides the target name of the file in the build directory. A full pathname can be used. Use either dir, or dest to specify directory information, but not both. Useful mainly when fetching the file from an source outside your direct control, such as a URL to a third-party web site, or copying a file out of an RPM package. An absolute dest value will be considered relative to %(destdir)s, whereas a relative dest value will be considered relative to %(builddir)s.
  • dir - The directory in which to store the file, relative to the build directory. An absolute dir value will be considered relative to %(destdir)s, whereas a relative dir value will be considered relative to %(builddir)s. Defaults to storing file directly in the build directory.
  • keyid - Using the keyid keyword indicates the eight-digit GNU Privacy Guard (GPG) key ID, without leading 0x for the source code archive signature should be sought, and checked. If you provide the keyid keyword, r.addArchive will search for a file named sourcename.{sig,sign,asc}, and ensure it is signed with the appropriate GPG key. A missing signature results in a warning; a failed signature check is fatal.
  • macros - If True, interpolate recipe macros in the body of a patch before applying it. For example, you might have a patch that changes CFLAGS = -O2 to CFLAGS = %(cflags)s, which will cause %(cflags)s to be replaced with the current setting of recipe.macros.cflags. Defaults to False.
  • mode - If set, provides the mode to set on the file.
  • use - A Use flag, or boolean, or a tuple of Use flags, and/or boolean values which determine whether the source code archive is actually unpacked, or merely stored in the archive.
  • rpm - If the rpm keyword is used, addArchive looks in the file, or URL specified by rpm for an RPM containing sourcename.
  • use - A Use flag or boolean, or a tuple of Use flags and/or booleans, that determine whether the archive is actually unpacked or merely stored in the archive.
  • httpHeaders - A dictionary containing headers to add to an http request when downloading the source code archive.
  • package - A string that specifies the package, component, or package and component in which to place the files added while executing this command
Overrides: _Source.__init__

do(self)

source code 
Overrides: _Source.do

Class Variable Details [hide private]

keywords

The keywords and default values accepted by the class
Value:
{'apply': '',
 'contents': None,
 'dest': None,
 'macros': False,
 'mode': None}