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

Class addArchive

source code

  action.Action --+            
                  |            
action.RecipeAction --+        
                      |        
             _AnySource --+    
                          |    
                    _Source --+
                              |
                             addArchive
Known Subclasses:
_RevisionControl

NAME

r.addArchive() - Add a source code archive

SYNOPSIS

r.addArchive(archivename, [dir=,] [keyid=,] [rpm=,] [httpHeaders=,] [package)=,] [use=,] [preserveOwnership=,] [sourceDir=])

DESCRIPTION

The r.addArchive() class adds a source code archive consisting of an optionally compressed tar, cpio, xpi or zip archive, or binary/source RPM, and unpacks it to the proper directory.

If the specified archivename is only a URL in the form of http://www.site.org/, r.addArchive will automatically attempt several combinations of %(name)s-%(version)s combined with common archive file extensions, such as (.tar.bz2, .tar.gz, .tbz2, and .tgz) to complete archivename.

If the specified archivename is a URL that begins with mirror://, r.addArchive will search a set of mirrors contained in files specified by the mirrorDirs Conary configuration file entry or a set of default mirror files located in the /etc/conary/mirrors directory. The mirror files are comprised of mirror URLs, listed one entry per line.

If the specified archivename is a list of URLs, r.addArchive will attempt to download the files, using the rules described above, from each URL, until one of them succeeds. Note that the archive base name (as would be printed by the "basename" shell command), if non-empty, has to be identical for all URLs.

KEYWORDS

The following keywords are recognized by r.addArchive:

dir : Instructs r.addArchive to change to the directory specified by dir prior to unpacking the source archive. An absolute dir value will be considered relative to %(destdir)s, whereas a relative dir value will be considered relative to %(builddir)s.

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 archivename.{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.

preserveOwnership : If preserveOwnership is True and the files are unpacked into the build directory, the packaged files are owned by the same user and group which owned them in the archive. Only cpio, rpm, and tar achives are allowed when preserveOwnership is used.

rpm : If the rpm keyword is used, r.addArchive looks in the file or URL specified by rpm for a binary or source RPM containing archivename.

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.

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.addArchive to look in the directory specified by sourceDir for the source archive to unpack. 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.addArchive from within a recipe:

r.addArchive('initscripts-%(upmajver)s.tar.bz2', rpm=srpm)

Demonstrates use with a local source code archive file, and the rpm keyword.

r.addArchive('ftp://ftp.visi.com/users/hawkeyd/X/Xaw3d-%(version)s.tar.gz')

Demonstrates use with a source code archive accessed via an FTP URL.

r.addArchive('ftp://ftp.pbone.net/mirror/ftp.sourceforge.net/pub/sourceforge/g/gc/gcompris/gcompris-7.4-1.i586.rpm')

Demonstrates use with a binary RPM file accessed via an FTP URL.

r.addArchive('http://ipw2200.sourceforge.net/firmware.php?i_agree_to_the_license=yes&f=%(name)s-%(version)s.tgz', httpHeaders={'Referer': 'http://ipw2200.sourceforge.net/firmware.php?fid=7'})

Demonstrates use with a source code archive accessed via an HTTP URL, and sending a Referer header through the httpHeader keyword.

r.addArchive('http://example.com/downloads/blah.iso', dir='/')

Demonstrates unpacking the contents of an iso image directly into the destdir. Note that only Rock Ridge or Joliet images are handled, and that permissions and special files are not preserved.

r.addArchive('mirror://sourceforge/%(name)s/%(name)s-%(version)s.tar.gz', keyid='9BB19A22')

Demonstrates use with mirror URL and sourceforge mirrors list for retrieving package source from SourceForge.

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

Static Methods [hide private]
 
_cpioOwners(fullOutput) source code
 
_tarOwners(fullOutput) source code
Class Variables [hide private]
  keywords = {'dir': '', 'httpHeaders': {}, 'keyid': None, 'pack...
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.
  • dir - Instructs r.addArchive to change to the directory specified by dir prior to unpacking the source archive. An absolute dir value will be considered relative to %(destdir)s, whereas a relative dir value will be considered relative to %(builddir)s.
  • 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 archivename.{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.
  • rpm - If the rpm keyword is used, r.addArchive looks in the file, or URL specified by rpm for an RPM containing archivename.
  • 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.
  • 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:
{'dir': '',
 'httpHeaders': {},
 'keyid': None,
 'package': None,
 'preserveOwnership': None,
 'rpm': '',
 'sourceDir': None}