"""module to process policy queue uploads"""
from .config import Config
-from .dbconn import BinaryMetadata, Component, MetadataKey, Override, OverrideType, get_mapped_component
+from .dbconn import BinaryMetadata, Component, MetadataKey, Override, OverrideType, Suite, get_mapped_component
from .fstransactions import FilesystemTransaction
from .regexes import re_file_changes, re_file_safe
import daklib.utils as utils
given by the C{directory} attribute. The copy will be removed on leaving
the with-block.
"""
- def __init__(self, upload):
+ def __init__(self, upload, group=None):
"""initializer
@type upload: L{daklib.dbconn.PolicyQueueUpload}
self.directory = None
self.upload = upload
+ self.group = group
def export(self, directory, mode=None, symlink=True, ignore_existing=False):
"""export a copy of the upload
def __enter__(self):
assert self.directory is None
+ mode = 0o0700
+ symlink = True
+ if self.group is not None:
+ mode = 0o2750
+ symlink = False
+
cnf = Config()
- self.directory = tempfile.mkdtemp(dir=cnf.get('Dir::TempPath'))
- self.export(self.directory, symlink=True)
+ self.directory = utils.temp_dirname(parent=cnf.get('Dir::TempPath'),
+ mode=mode,
+ group=self.group)
+ self.export(self.directory, symlink=symlink)
return self
def __exit__(self, *args):
fn = os.path.join(self.upload.policy_queue.path, 'COMMENTS', fn1)
try:
- fh = os.open(fn, os.O_CREAT | os.O_EXCL | os.O_WRONLY)
+ fh = os.open(fn, os.O_CREAT | os.O_EXCL | os.O_WRONLY, 0o644)
os.write(fh, 'NOTOK\n')
os.write(fh, 'From: {0} <{1}>\n\n'.format(utils.whoami(), cnf['Dinstall::MyAdminAddress']))
os.write(fh, reason)
if section.find('/') != -1:
component = section.split('/', 1)[0]
override = self._binary_override(binary, component)
- if override is None:
+ if override is None and not any(o['package'] == binary.package and o['type'] == binary.binarytype for o in missing):
hint = hints_map.get((binary.binarytype, binary.package))
if hint is not None:
missing.append(hint)