X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=daklib%2Fpolicy.py;h=aeed9a2c19cbfb679274520e3418a73f42dc3722;hb=245fbc770e27419629ef80a6402941fc4ead7fe8;hp=41c9c1fe2a1d6e4aa17c688c07f988a436a1f3b8;hpb=fea8715a28357e82333579374c22ac5251614a50;p=dak.git diff --git a/daklib/policy.py b/daklib/policy.py index 41c9c1fe..aeed9a2c 100644 --- a/daklib/policy.py +++ b/daklib/policy.py @@ -39,7 +39,7 @@ class UploadCopy(object): 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} @@ -48,6 +48,7 @@ class UploadCopy(object): 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 @@ -97,9 +98,17 @@ class UploadCopy(object): 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): @@ -270,13 +279,18 @@ class PolicyQueueUploadHandler(object): )) components.add(component) + source = self.upload.source source_component = '(unknown)' - for component in ('main', 'contrib', 'non-free'): + for component, in self.session.query(Component.component_name).order_by(Component.ordering): if component in components: source_component = component break + else: + if source is not None: + if self._source_override(component) is not None: + source_component = component + break - source = self.upload.source if source is not None: override = self._source_override(source_component) if override is None: