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

Source Code for Module conary.build.inforecipe

  1  # 
  2  # Copyright (c) 2005-2008 rPath, Inc. 
  3  # 
  4  # This program is distributed under the terms of the Common Public License, 
  5  # version 1.0. A copy of this license should have been distributed with this 
  6  # source file in a file called LICENSE. If it is not present, the license 
  7  # is always available at http://www.rpath.com/permanent/licenses/CPL-1.0. 
  8  # 
  9  # This program is distributed in the hope that it will be useful, but 
 10  # without any warranty; without even the implied warranty of merchantability 
 11  # or fitness for a particular purpose. See the Common Public License for 
 12  # full details. 
 13  # 
 14   
 15  from conary.build.packagerecipe import AbstractPackageRecipe, _recipeHelper 
 16  from conary.build.recipe import RECIPE_TYPE_INFO 
 17   
 18  from conary.build import policy 
 19  from conary.build import usergroup 
 20   
21 -class UserGroupInfoRecipe(AbstractPackageRecipe):
22 _recipeType = RECIPE_TYPE_INFO 23 internalAbstractBaseClass = 1 24 # we need to add this line because AbstractPackageRecipe 25 # isn't copied in 26 buildRequires = AbstractPackageRecipe.buildRequires[:] 27 basePolicyClass = policy.UserGroupBasePolicy 28
29 - def __getattr__(self, name):
30 if not name.startswith('_'): 31 if name in usergroup.__dict__: 32 return _recipeHelper(self._build, self, 33 usergroup.__dict__[name]) 34 if name in self.__dict__: 35 return self.__dict__[name] 36 return AbstractPackageRecipe.__getattr__(self, name)
37
38 - def _loadSourceActions(self, *args, **kwargs):
39 pass
40
41 - def loadPolicy(self):
42 return AbstractPackageRecipe.loadPolicy(self, 43 internalPolicyModules = ( 'infopolicy', ) )
44
45 -class UserInfoRecipe(UserGroupInfoRecipe):
46 """ 47 NAME 48 ==== 49 B{C{UserInfoRecipe}} - Build user info pacakges 50 51 SYNOPSIS 52 ======== 53 54 C{UserInfoRecipe} is used to create packages that define a system user 55 56 DESCRIPTION 57 =========== 58 59 The C{UserInfoRecipe} class provides an interface to define a system 60 user through the C{r.User} method. The C{r.User} method is also 61 available in the C{PackageRecipe} class. 62 63 EXAMPLE 64 ======= 65 A sample class that uses C{UserInfoRecipe} to define a user 66 67 class ExamplePackage(UserInfoRecipe): 68 name = 'info-example' 69 version = '1.0' 70 71 def setup(r): 72 r.User('example', 500) 73 """ 74 internalAbstractBaseClass = 1
75
76 -class GroupInfoRecipe(UserGroupInfoRecipe):
77 """ 78 NAME 79 ==== 80 B{C{GroupInfoRecipe}} - Build group info pacakges 81 82 SYNOPSIS 83 ======== 84 85 C{GroupInfoRecipe} is used to create packages that define a system group 86 87 DESCRIPTION 88 =========== 89 90 The C{GroupInfoRecipe} class provides an interface to define a system 91 group through the C{r.Group} method. The C{r.Group} method is also 92 available in the C{PackageRecipe} class. 93 94 The C{GroupInfoRecipe} class should be used if a system group must exist 95 independently from any system users. 96 97 EXAMPLE 98 ======= 99 A sample class that uses C{GroupInfoRecipe} to define a group 100 101 class ExamplePackage(GroupInfoRecipe): 102 name = 'info-example' 103 version = '1.0' 104 105 def setup(r): 106 r.Group('example', 500) 107 """ 108 internalAbstractBaseClass = 1
109