Package conary :: Package build :: Module cook
[hide private]
[frames] | no frames]

Module cook

source code

Contains the functions which builds a recipe and commits the resulting packages to the repository.

Classes [hide private]
  _IdGen
  CookCallback
  GroupCookOptions
  _SimpleTrove
Functions [hide private]
 
_createComponent(repos, bldPkg, newVersion, ident) source code
 
_signTrove(trv, fingerprint) source code
 
signAbsoluteChangeset(cs, fingerprint=None) source code
 
signAbsoluteChangesetByConfig(cs, cfg) source code
list of strings
cookObject(repos, cfg, loaderList, sourceVersion, changeSetFile=None, prep=True, macros={}, targetLabel=None, resume=None, alwaysBumpCount=False, allowUnknownFlags=False, allowMissingSource=False, ignoreDeps=False, logBuild=False, crossCompile=None, callback=None, requireCleanSources=False, downloadOnly=False, groupOptions=None)
Turns a recipe object into a change set, and sometimes commits the result.
source code
tuple
cookRedirectObject(repos, db, cfg, recipeClass, sourceVersion, macros={}, targetLabel=None, alwaysBumpCount=False)
Turns a redirect recipe object into a change set.
source code
tuple
cookGroupObjects(repos, db, cfg, recipeClasses, sourceVersion, macros={}, targetLabel=None, alwaysBumpCount=False, callback=callbacks.CookCallback(), requireCleanSources=False, groupOptions=None)
Turns a group recipe object into a change set.
source code
tuple
cookFilesetObject(repos, db, cfg, recipeClass, sourceVersion, buildFlavor, macros={}, targetLabel=None, alwaysBumpCount=False)
Turns a fileset recipe object into a change set.
source code
tuple
cookPackageObject(repos, db, cfg, loader, sourceVersion, prep=True, macros={}, targetLabel=None, resume=None, alwaysBumpCount=False, ignoreDeps=False, logBuild=False, crossCompile=None, requireCleanSources=False, downloadOnly=False, signatureKey=None)
Turns a package recipe object into a change set.
source code
 
_cookPackageObjWrap(*args, **kwargs) source code
 
_cookPackageObject(repos, cfg, loader, sourceVersion, prep=True, macros={}, resume=None, ignoreDeps=False, logBuild=False, crossCompile=None, enforceManagedPolicy=False, requireCleanSources=False, downloadOnly=False, redirectStdin=False)
Builds the package for cookPackageObject.
source code
 
_initializeOldMetadata(repos, recipeObj, logFile) source code
 
_copyScripts(trv, scriptsMap) source code
 
_createPackageChangeSet(repos, db, cfg, bldList, loader, recipeObj, sourceVersion, targetLabel=None, alwaysBumpCount=False, policyTroves=None, signatureKey=None)
Helper function for cookPackage object.
source code
 
_loadPolicy(recipeObj, cfg, enforceManagedPolicy) source code
 
_getPathIdGen(repos, sourceName, targetVersion, targetLabel, pkgNames, fileIdsPathMap) source code
 
logBuildEnvironment(out, sourceVersion, policyTroves, macros, cfg) source code
 
guessUpstreamSourceTrove(repos, srcName, state) source code
tuple
guessSourceVersion(repos, name, versionStr, buildLabel, conaryState=None, searchBuiltTroves=False)
Make a reasonable guess at what a sourceVersion should be when you don't have an actual source component from a repository to get the version from.
source code
 
getRecipeInfoFromPath(repos, cfg, recipeFile, buildFlavor=None) source code
 
newPackageSourceCount(cfg, recipeClass) source code
 
cookItem(repos, cfg, item, prep=0, macros={}, emerge=False, resume=None, allowUnknownFlags=False, showBuildReqs=False, ignoreDeps=False, logBuild=False, crossCompile=None, callback=None, requireCleanSources=None, downloadOnly=False, groupOptions=None)
Cooks an item specified on the command line.
source code
 
cookCommand(cfg, args, prep, macros, emerge=False, resume=None, allowUnknownFlags=False, showBuildReqs=False, ignoreDeps=False, profile=False, logBuild=True, crossCompile=None, cookIds=None, downloadOnly=False, groupOptions=None) source code
 
_callSetup(cfg, recipeObj, recordCalls=True) source code
 
_copyForwardTroveMetadata(repos, troveList, recipeObj)
Copies forward metadata from a previous build of this package if possible.
source code
 
_getTroveMetadataFromRepo(repos, troveList, recipeObj) source code
 
_doCopyForwardMetadata(troveList, recipeObj) source code
 
_getMetadataMatches(repos, troveList, buildBranch) source code
 
_setCookTroveMetadata(trv, itemDictList) source code
Function Details [hide private]

cookObject(repos, cfg, loaderList, sourceVersion, changeSetFile=None, prep=True, macros={}, targetLabel=None, resume=None, alwaysBumpCount=False, allowUnknownFlags=False, allowMissingSource=False, ignoreDeps=False, logBuild=False, crossCompile=None, callback=None, requireCleanSources=False, downloadOnly=False, groupOptions=None)

source code 
Turns a recipe object into a change set, and sometimes commits the result.
Parameters:
  • repos (repository.Repository) - Repository to both look for source files and file id's in.
  • cfg (conarycfg.ConaryConfiguration) - conary configuration
  • loaderList ([RecipeLoader]) - list of classes descended from recipe.Recipe containing recipes to build
  • changeSetFile (str) - if set, the changeset is stored in this file instead of committed to a repository
  • prep (boolean) - If true, the build stops after the package is unpacked and None is returned instead of a changeset.
  • downloadOnly (boolean) - If true, the lookaside is populated, and the None is returned instead of a changeset.
  • macros (dict) - set of macros for the build
  • targetLabel (versions.Label) - label to use for the cooked troves; it is used as a new shadow from whatever version was previously built default), the sourceVersion label is used
  • resume (bool or str) - indicates whether to resume the previous build. If True, resume at the line of last breakage. If an integer, resume at that line. If 'policy', rerun the policy only. Note that resume is only valid when cooking a recipe from a file, not from the repository.
  • alwaysBumpCount (bool) - if True, the cooked troves will not share a full version with any other existing troves with the same name, even if their flavors would differentiate them.
  • allowMissingSource (bool) - if True, do not complain if the sourceVersion specified does not point to an existing source trove. Warning -- this can lead to strange trove setups in the repository
  • logBuild (bool) - if True, log the build to a file that will be included in the changeset
  • allowMissingSource (bool) - allow build of this trove when the source version specified does not point to an existing source trove. Warning -- this can lead to strange trove setups
  • requireCleanSources - require that this build be clean - that its sources all be from the repository.
Returns: list of strings

cookRedirectObject(repos, db, cfg, recipeClass, sourceVersion, macros={}, targetLabel=None, alwaysBumpCount=False)

source code 
Turns a redirect recipe object into a change set. Returns the absolute changeset created, a list of the names of the packages built, and and None (for compatibility with cookPackageObject).
Parameters:
  • repos (repository.Repository) - Repository to both look for source files and file id's in.
  • cfg (conarycfg.ConaryConfiguration) - conary configuration
  • recipeClass (class descended from recipe.Recipe) - class which will be instantiated into a recipe
  • macros (dict) - set of macros for the build
  • targetLabel (versions.Label) - label to use for the cooked troves; it is used as a new branch from whatever version was previously built default), the label from sourceVersion is used
  • alwaysBumpCount (bool) - if True, the cooked troves will not share a full version with any other existing troves with the same name, even if their flavors would differentiate them.
Returns: tuple

cookGroupObjects(repos, db, cfg, recipeClasses, sourceVersion, macros={}, targetLabel=None, alwaysBumpCount=False, callback=callbacks.CookCallback(), requireCleanSources=False, groupOptions=None)

source code 
Turns a group recipe object into a change set. Returns the absolute changeset created, a list of the names of the packages built, and and None (for compatibility with cookPackageObject).
Parameters:
  • repos (repository.Repository) - Repository to both look for source files and file id's in.
  • cfg (conarycfg.ConaryConfiguration) - conary configuration
  • recipeClasses (recipe.Recipe) - classes which will be instantiated into recipes
  • macros (dict) - set of macros for the build
  • targetLabel (versions.Label) - label to use for the cooked troves; it is used as a new branch from whatever version was previously built default), the label from sourceVersion is used
  • alwaysBumpCount (bool) - if True, the cooked troves will not share a full version with any other existing troves with the same name, even if their flavors would differentiate them.
Returns: tuple

cookFilesetObject(repos, db, cfg, recipeClass, sourceVersion, buildFlavor, macros={}, targetLabel=None, alwaysBumpCount=False)

source code 
Turns a fileset recipe object into a change set. Returns the absolute changeset created, a list of the names of the packages built, and and None (for compatibility with cookPackageObject).
Parameters:
  • repos (repository.Repository) - Repository to both look for source files and file id's in.
  • cfg (conarycfg.ConaryConfiguration) - conary configuration
  • recipeClass (class descended from recipe.Recipe) - class which will be instantiated into a recipe
  • macros (dict) - set of macros for the build
  • targetLabel (versions.Label) - label to use for the cooked troves; it is used as a new branch from whatever version was previously built default), the sourceVersion's branch is used
  • alwaysBumpCount (bool) - if True, the cooked troves will not share a full version with any other existing troves with the same name, even if their flavors would differentiate them.
Returns: tuple

cookPackageObject(repos, db, cfg, loader, sourceVersion, prep=True, macros={}, targetLabel=None, resume=None, alwaysBumpCount=False, ignoreDeps=False, logBuild=False, crossCompile=None, requireCleanSources=False, downloadOnly=False, signatureKey=None)

source code 
Turns a package recipe object into a change set. Returns the absolute changeset created, a list of the names of the packages built, and and a tuple with a function to call and its arguments, which should be called when the build root for the package can be safely removed (the changeset returned refers to files in that build root, so those files can't be removed until the changeset has been comitted or saved)
Parameters:
  • repos (repository.Repository) - Repository to both look for source files and file id's in.
  • cfg (conarycfg.ConaryConfiguration) - conary configuration
  • recipeClass (class descended from recipe.Recipe) - class which will be instantiated into a recipe
  • prep (boolean) - If true, the build stops after the package is unpacked and None is returned instead of a changeset.
  • downloadOnly (boolean) - If true, the lookaside is populated, and the None is returned instead of a changeset.
  • macros (dict) - set of macros for the build
  • targetLabel - label to use for the cooked troves; if None (the default), the version used is the derived from sourceVersion
  • alwaysBumpCount (bool) - if True, the cooked troves will not share a full version with any other existing troves with the same name, even if their flavors would differentiate them.
  • signatureKey (string) - GPG fingerprint for trove signing. If None, only sha1 signatures are generated.
Returns: tuple

_cookPackageObject(repos, cfg, loader, sourceVersion, prep=True, macros={}, resume=None, ignoreDeps=False, logBuild=False, crossCompile=None, enforceManagedPolicy=False, requireCleanSources=False, downloadOnly=False, redirectStdin=False)

source code 
Builds the package for cookPackageObject. Parameter meanings are described there.

_createPackageChangeSet(repos, db, cfg, bldList, loader, recipeObj, sourceVersion, targetLabel=None, alwaysBumpCount=False, policyTroves=None, signatureKey=None)

source code 
Helper function for cookPackage object. See there for most parameter definitions. BldList is the list of components created by cooking a package recipe. RecipeObj is the instantiation of the package recipe, and loader is the loader which loaded the class for that recipe.

guessSourceVersion(repos, name, versionStr, buildLabel, conaryState=None, searchBuiltTroves=False)

source code 
Make a reasonable guess at what a sourceVersion should be when you don't have an actual source component from a repository to get the version from. Searches the repository for troves that are relatively close to the desired trove, and grabbing their timestamp information.
Parameters:
  • repos (NetworkRepositoryClient) - repository client
  • name (str) - name of the trove being built
  • versionStr (str) - the version stored in the recipe being built
  • buildLabel (versions.Label) - the label to search for troves matching the
  • conaryState (ConaryState) - ConaryState object to us instead of looking for a CONARY file in the current directory
  • searchBuiltTroves (bool) - if True, search for binary troves that match the desired trove's name, versionStr and label.
Returns: tuple
(version, upstreamTrove). upstreamTrove is an instance of the trove if it was previously built on the same branch.

cookItem(repos, cfg, item, prep=0, macros={}, emerge=False, resume=None, allowUnknownFlags=False, showBuildReqs=False, ignoreDeps=False, logBuild=False, crossCompile=None, callback=None, requireCleanSources=None, downloadOnly=False, groupOptions=None)

source code 
Cooks an item specified on the command line. If the item is a file which can be loaded as a recipe, it's cooked and a change set with the result is saved. If that's not the case, the item is taken to be the name of a package, and the recipe is pulled from the :source component, built, and committed to the repository.
Parameters:
  • repos (repository.Repository) - Repository to use for building
  • cfg (conarycfg.ConaryConfiguration) - conary configuration
  • item (str) - the item to cook
  • prep (boolean) - If true, the build stops after the package is unpacked and None is returned instead of a changeset.
  • downloadOnly (boolean) - If true, the lookaside is populated, and the None is returned instead of a changeset.
  • macros (dict) - set of macros for the build

_copyForwardTroveMetadata(repos, troveList, recipeObj)

source code 

Copies forward metadata from a previous build of this package if possible. Searches on the current label then one level up (to make sure shadowed sources get metadata from their parent).

Tries to match the flavor if possible but if it can't, it will use the most recent cook with a different flavor. If necessary, it will search for metadata for components separately from the package.