Commit e29d4c4d authored by Benjamin Hof's avatar Benjamin Hof

Copy buildinfo files from NEW to BuildinfoArchive

Closes: #932849
parent 904dcbb7
......@@ -262,6 +262,9 @@ def comment_accept(upload, srcqueue, comments, transaction):
if os.path.exists(src) and not os.path.exists(dst):
fs.copy(src, dst, mode=mode)
utils.process_buildinfos(upload.policy_queue.path, chg.buildinfo_files,
fs, Logger)
if upload.source is not None and not Options['No-Action']:
urgency = upload.changes.urgency
# As per policy 5.6.17, the urgency can be followed by a space and a
......
......@@ -267,7 +267,8 @@ def accept(directory, upload):
print("ACCEPT")
upload.install()
process_buildinfos(upload)
utils.process_buildinfos(upload.directory, upload.changes.buildinfo_files,
upload.transaction.fs, Logger)
accepted_to_real_suite = any(suite.policy_queue is None for suite in upload.final_suites)
sourceful_upload = 'source' in upload.changes.architectures
......@@ -506,25 +507,6 @@ def process_changes(changes_filenames):
for directory, c in changes:
process_it(directory, c, keyring_files)
def process_buildinfos(upload):
cnf = Config()
if 'Dir::BuildinfoArchive' not in cnf:
return
target_dir = os.path.join(
cnf['Dir::BuildinfoArchive'],
datetime.datetime.now().strftime('%Y/%m/%d'),
)
for f in upload.changes.buildinfo_files:
src = os.path.join(upload.directory, f.filename)
dst = utils.find_next_free(os.path.join(target_dir, f.filename))
Logger.log(["Archiving", f.filename])
upload.transaction.fs.copy(src, dst, mode=0o644)
###############################################################################
......
......@@ -1366,3 +1366,37 @@ def suite_suffix(suite_name):
elif suite_name in Cnf.value_list('Dinstall::SuiteSuffixSuites'):
return suffix
return ''
################################################################################
def process_buildinfos(directory, buildinfo_files, fs_transaction, logger):
"""Copy buildinfo files into Dir::BuildinfoArchive
@type directory: string
@param directory: directory where .changes is stored
@type buildinfo_files: list of str
@param buildinfo_files: names of buildinfo files
@type fs_transaction: L{daklib.fstransactions.FilesystemTransaction}
@param fs_transaction: FilesystemTransaction instance
@type logger: L{daklib.daklog.Logger}
@param logger: logger instance
"""
if 'Dir::BuildinfoArchive' not in Cnf:
return
target_dir = os.path.join(
Cnf['Dir::BuildinfoArchive'],
datetime.datetime.now().strftime('%Y/%m/%d'),
)
for f in buildinfo_files:
src = os.path.join(directory, f.filename)
dst = find_next_free(os.path.join(target_dir, f.filename))
logger.log(["Archiving", f.filename])
fs_transaction.copy(src, dst, mode=0o644)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment