AND NOT EXISTS (SELECT 1 FROM files_archive_map af
JOIN archive_delete_date ad ON af.archive_id = ad.archive_id
WHERE af.file_id = b.file
- AND (af.last_used IS NULL OR af.last_used >= ad.delete_date))
+ AND (af.last_used IS NULL OR af.last_used > ad.delete_date))
RETURNING f.filename
""")
for b in q:
AND NOT EXISTS (SELECT 1 FROM files_archive_map af
JOIN archive_delete_date ad ON af.archive_id = ad.archive_id
WHERE af.file_id = source.file
- AND (af.last_used IS NULL OR af.last_used >= ad.delete_date))
+ AND (af.last_used IS NULL OR af.last_used > ad.delete_date))
RETURNING source.id AS id, f.filename AS filename
),
deleted_dsc_files AS (
c = self.db.cursor()
c.execute("CREATE SCHEMA world");
- c.execute("GRANT USAGE ON SCHEMA workd TO PUBLIC")
+ c.execute("GRANT USAGE ON SCHEMA world TO PUBLIC")
c.execute("ALTER DEFAULT PRIVILEGES IN SCHEMA world GRANT SELECT ON TABLES TO PUBLIC")
c.execute("ALTER DEFAULT PRIVILEGES IN SCHEMA world GRANT ALL ON TABLES TO ftpmaster")
c.execute("ALTER DEFAULT PRIVILEGES IN SCHEMA world GRANT SELECT ON SEQUENCES TO PUBLIC")
else:
addresses = utils.mail_addresses_for_upload(maintainer_field, maintainer_field, changes.primary_fingerprint)
+ # debian-{devel-,}-changes@lists.debian.org toggles writes access based on this header
bcc = 'X-DAK: dak process-upload'
if 'Dinstall::Bcc' in cnf:
bcc = '{0}\nBcc: {1}'.format(bcc, cnf['Dinstall::Bcc'])
Logger.log(['ACCEPT-TO-NEW', upload.changes.filename])
upload.install_to_new()
- # TODO: tag bugs pending, send announcement
+ # TODO: tag bugs pending
subst = subst_for_upload(upload)
message = utils.TemplateSubst(subst, os.path.join(cnf['Dir::Templates'], 'process-unchecked.new'))
fh.write(reason)
fh.close()
- # TODO: fix
if notify:
subst = subst_for_upload(upload)
subst['__REJECTOR_ADDRESS__'] = cnf['Dinstall::MyEmailAddress']
elif answer == 'S':
processed = False
- #raise Exception("FAIL")
if not Options['No-Action']:
upload.commit()
print "\n{0}\n".format(changes.filename)
Logger.log(["Processing changes file", changes.filename])
- cnf = Config()
-
- # Some defaults in case we can't fully process the .changes file
- #u.pkg.changes["maintainer2047"] = cnf["Dinstall::MyEmailAddress"]
- #u.pkg.changes["changedby2047"] = cnf["Dinstall::MyEmailAddress"]
-
- # debian-{devel-,}-changes@lists.debian.org toggles writes access based on this header
- bcc = "X-DAK: dak process-upload"
- #if cnf.has_key("Dinstall::Bcc"):
- # u.Subst["__BCC__"] = bcc + "\nBcc: %s" % (cnf["Dinstall::Bcc"])
- #else:
- # u.Subst["__BCC__"] = bcc
-
with daklib.archive.ArchiveUpload(directory, changes, keyrings) as upload:
processed = action(directory, upload)
if processed and not Options['No-Action']:
self.fs = FilesystemTransaction()
self.session = DBConn().session()
- def get_file(self, hashed_file, source_name):
+ def get_file(self, hashed_file, source_name, check_hashes=True):
"""Look for file C{hashed_file} in database
@type hashed_file: L{daklib.upload.HashedFile}
@param hashed_file: file to look for in the database
+ @type source_name: str
+ @param source_name: source package name
+
+ @type check_hashes: bool
+ @param check_hashes: check size and hashes match
+
@raise KeyError: file was not found in the database
@raise HashMismatchException: hash mismatch
poolname = os.path.join(utils.poolify(source_name), hashed_file.filename)
try:
poolfile = self.session.query(PoolFile).filter_by(filename=poolname).one()
- if poolfile.filesize != hashed_file.size or poolfile.md5sum != hashed_file.md5sum or poolfile.sha1sum != hashed_file.sha1sum or poolfile.sha256sum != hashed_file.sha256sum:
+ if check_hashes and (poolfile.filesize != hashed_file.size
+ or poolfile.md5sum != hashed_file.md5sum
+ or poolfile.sha1sum != hashed_file.sha1sum
+ or poolfile.sha256sum != hashed_file.sha256sum):
raise HashMismatchException('{0}: Does not match file already existing in the pool.'.format(hashed_file.filename))
return poolfile
except NoResultFound:
dst = os.path.join(self.directory, f.filename)
if not os.path.exists(dst):
try:
- db_file = self.transaction.get_file(f, source.dsc['Source'])
+ db_file = self.transaction.get_file(f, source.dsc['Source'], check_hashes=False)
db_archive_file = session.query(ArchiveFile).filter_by(file=db_file).first()
fs.copy(db_archive_file.path, dst, symlink=True)
except KeyError:
if result == 0:
for l in output.split('\n'):
m = re_gpg_uid.match(l)
- if m:
+ if not m:
+ continue
+ address = m.group(1)
+ if address.endswith('@debian.org'):
+ # prefer @debian.org addresses
+ # TODO: maybe not hardcode the domain
+ addresses.insert(0, address)
+ else:
addresses.append(m.group(1))
key_uid_email_cache[fingerprint] = addresses
return addresses