- return ret
-
- def sanitised_dsc(self):
- ret = {}
- for i in CHANGESFIELDS_DSC:
- if self.dsc.has_key(i):
- ret[i] = self.dsc[i]
-
- return ret
-
- def sanitised_dsc_files(self):
- ret = {}
- for name, entry in self.dsc_files.items():
- ret[name] = {}
- # Mandatory dsc_files fields
- for i in CHANGESFIELDS_DSCFILES_MANDATORY:
- ret[name][i] = entry[i]
-
- # Optional dsc_files fields
- for i in CHANGESFIELDS_DSCFILES_OPTIONAL:
- if entry.has_key(i):
- ret[name][i] = entry[i]
-
- return ret
-
- def write_dot_dak(self, dest_dir):
- """
- Dump ourself into a cPickle file.
-
- @type dest_dir: string
- @param dest_dir: Path where the dumpfile should be stored
-
- @note: This could just dump the dictionaries as is, but I'd like to avoid this so
- there's some idea of what process-accepted & process-new use from
- process-unchecked. (JT)
-
- """
-
- dump_filename = os.path.join(dest_dir, self.changes_file[:-8] + ".dak")
- dump_file = open_file(dump_filename, 'w')
-
- try:
- os.chmod(dump_filename, 0664)
- except OSError, e:
- # chmod may fail when the dumpfile is not owned by the user
- # invoking dak (like e.g. when NEW is processed by a member
- # of ftpteam)
- if e.errno == EPERM:
- perms = stat.S_IMODE(os.stat(dump_filename)[stat.ST_MODE])
- # security precaution, should never happen unless a weird
- # umask is set anywhere
- if perms & stat.S_IWOTH:
- fubar("%s is world writable and chmod failed." % \
- (dump_filename,))
- # ignore the failed chmod otherwise as the file should
- # already have the right privileges and is just, at worst,
- # unreadable for world