1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 """
16 Contains classes used during the build process to collect files
17 into BuildComponents. These BuildComponents are used to create Packages
18 and create changesets from the files created during the build process
19 """
20
21 import os
22 import time
23
24 from conary import files
25 from conary.lib import sha1helper
26 from conary.build import use
27 from conary.deps import deps
28
46
66
68
70 """
71 Add a file to the build component
72
73 @param path: the destination of the file in the component
74 @param realPath: the location of the actual file on the filesystem,
75 used to obtain the contents of the file when creating a changeset
76 to commit to the repository
77 """
78
79
80 (f, linkCount, inode) = files.FileFromFilesystem(realPath, None,
81 inodeInfo = True, assumeRoot = True)
82 f.inode.perms.set(f.inode.perms() & 01777)
83 self[path] = (realPath, f)
84 if (f.inode.perms() & 0400) != 0400:
85
86
87 os.chmod(realPath, f.inode.perms() | 0400)
88
89 if linkCount > 1:
90 if f.hasContents:
91 l = self.linkGroups.get(inode, [])
92 l.append(path)
93 self.linkGroups[inode] = l
94
95 self.hardlinks.append(path)
96 else:
97 if not isinstance(f, files.Directory):
98
99 self.badhardlinks.append(path)
100 return f
101
102 - def addDevice(self, path, devtype, major, minor,
103 owner='root', group='root', perms=0660):
104 """
105 Add a device node to the build component
106
107 @param path: the destination of the device node in the component
108 """
109 f = BuildDeviceFile(devtype, major, minor, owner, group, perms)
110 self[path] = (None, f)
111 return f
112
115
118
120 """
121 Return the name of the BuildComponent
122
123 @returns: name of the BuildComponent
124 @rtype: str
125 """
126 return self.name
127
129 """
130 Dict mapping user names to tuples of C{(preferred_uid, groupname,
131 preferred_groupid, homedir, comment, shell)}
132 """
133 return self.recipe.usermap
134
136 """
137 Reverse map from group name to user name for groups created as part
138 of a user definition.
139 """
140 return self.recipe.usergrpmap
141
143 """
144 Dict mapping group names to preferred_groupid
145 """
146 return self.recipe.groupmap
147
149 """
150 Dict mapping user names to C{(group, preferred_groupid)} tuples
151 """
152 return self.recipe.suppmap
153