def test_buildd_approves_uefi_ppa(self):
     # Uploads to PPAs containing UEFI custom files are auto-approved.
     buildd_policy = findPolicyByName("buildd")
     uploadfile = CustomUploadFile("uefi.tar.gz", None, 0, "main/raw-uefi",
                                   "extra", buildd_policy, None)
     upload = make_fake_upload(binaryful=True, is_ppa=True)
     upload.changes = FakeChangesFile(custom_files=[uploadfile])
     self.assertTrue(buildd_policy.autoApprove(upload))
 def createCustomUploadFile(self, filename, contents, component_and_section,
                            priority_name):
     """Simple wrapper to create a CustomUploadFile."""
     (path, md5, sha1, size) = self.writeUploadFile(filename, contents)
     uploadfile = CustomUploadFile(path, dict(MD5=md5), size,
                                   component_and_section, priority_name,
                                   self.policy, self.logger)
     return uploadfile
 def test_buildd_does_not_approve_uefi(self):
     # Uploads to the primary archive containing UEFI custom files are
     # not approved.
     buildd_policy = findPolicyByName("buildd")
     uploadfile = CustomUploadFile("uefi.tar.gz", None, 0, "main/raw-uefi",
                                   "extra", buildd_policy, None)
     upload = make_fake_upload(binaryful=True)
     upload.changes = FakeChangesFile(custom_files=[uploadfile])
     self.assertFalse(buildd_policy.autoApprove(upload))
Beispiel #4
0
    def processFiles(self):
        """Build objects for each file mentioned in this changesfile.

        This method is an error generator, i.e, it returns an iterator over
        all exceptions that are generated while processing all mentioned
        files.
        """
        try:
            raw_files = parse_and_merge_file_lists(self._dict, changes=True)
        except UploadError as e:
            yield e
            return

        files = []
        for attr in raw_files:
            filename, hashes, size, component_and_section, priority_name = attr
            filepath = os.path.join(self.dirname, filename)
            try:
                if self.isCustom(component_and_section):
                    # This needs to be the first check, because
                    # otherwise the tarballs in custom uploads match
                    # with source_match.
                    file_instance = CustomUploadFile(filepath, hashes, size,
                                                     component_and_section,
                                                     priority_name,
                                                     self.policy, self.logger)
                else:
                    try:
                        package, cls = determine_file_class_and_name(filename)
                    except CannotDetermineFileTypeError:
                        yield UploadError(
                            "Unable to identify file %s (%s) in changes." %
                            (filename, component_and_section))
                        continue

                    file_instance = cls(filepath, hashes, size,
                                        component_and_section, priority_name,
                                        package, self.version, self,
                                        self.policy, self.logger)

                    if cls == DSCFile:
                        self.dsc = file_instance
                    elif cls == BuildInfoFile:
                        self.buildinfo = file_instance
            except UploadError as error:
                yield error
            else:
                files.append(file_instance)

        self.files = files