1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 """
16 This module defines helper classes designed to define filestream objects.
17 This allows for creation of filestreams without the need to create files
18 on the filesystem.
19 """
20
21 import itertools
22 import os
23 import sha
24 import time
25
26 from conary import errors, files
27 from conary.deps import deps
28 from conary.lib import sha1helper, util
29 from conary.repository import filecontents
30
32 """There were errors with the parameters passed into a filestream helper"""
33
35 """Config, initialContents and transient are mutually exclusive."""
36
38 """
39 Abstract base class which all for other filestream helper classes.
40
41 This class is the parent of all filestream helper classes. It should
42 not be directly instantiated.
43 """
44 needSha1 = False
45 kwargs = {'perms': 0644,
46 'tags': None,
47 'requires': None,
48 'provides': None,
49 'flavor': None,
50 'owner': 'root',
51 'group': 'root',
52 'mtime': None}
53
54
55
56 aliasedArgs = {'mode': 'perms'}
57
95
96 - def getContents(self):
98
101
102 - def get(self, pathId):
123
125 """
126 NAME
127 ====
128
129 B{C{Symlink}} - Define a symlink filestream helper.
130
131 SYNOPSIS
132 ========
133
134 c{Symlink([I{target}] || [I{requires}, I{provides}, I{flavor}, I{owner}, I{group}, I{config}, I{tags}])}
135
136 DESCRIPTION
137 ===========
138
139 The C{Symlink} class defines a symlink filestream helper. I{target} is a
140 mandatory argument for this class.
141
142 PARAMETERS
143 ==========
144 The following parameters apply to the Symlink class.
145
146 B{target}: The target of the symlink. This parameter is a string.
147
148 B{requires}: (None) Marks this file with the specified requirements.
149 This parameter is a deps.Dependency object.
150
151 B{provides}: (None) Marks files as providing certain features or
152 characteristics. This parameter is a deps.Dependency object.
153
154 B{flavor}: (None) Marks this file with the specified flavor. File
155 flavors are aggregated to determine trove flavors. This parameter
156 is a deps.Flavor object.
157
158 B{owner}: ('root') Marks this file as owned by I{owner}. This parameter
159 is a string
160
161 B{group}: ('root') Marks this file as belonging to I{group}. This
162 parameter is a string
163
164 B{tags} : (None) Tags associated with this file. When a file with a
165 tag is installed, removed, or changed, the listed tag handler is executed.
166 See documentation on tag handlers for more information. This parameter
167 is a list of strings.
168
169 USER COMMANDS
170 =============
171 The following user commands are applicable to C{Symlink}:
172
173 - L{get(I{pathId})} : Returns a filestream with the settings
174 represented by this class.
175
176 EXAMPLES
177 ========
178
179 C{sym = Symlink('/foo/bar')}
180 C{sym.get()}
181
182 Creates a symlink filestream helper that points to /foo/bar, and
183 retrieves the filestream associated with it.
184 """
185 fileClass = files.SymbolicLink
186 kwargs = _File.kwargs.copy()
187 del kwargs['perms']
188