[dak/master] store `.buildinfo` files for uploads to policy queues
When accepting an upload on the security archive, we need the
`.buildinfo` files to forward the upload to ftp-master. For now,
store them along with the `.changes` in the queue directory.
---
dak/process_policy.py | 22 +++++++++++++++++-----
daklib/archive.py | 8 ++++++--
daklib/upload.py | 13 +++++++++++++
3 files changed, 36 insertions(+), 7 deletions(-)
diff --git a/dak/process_policy.py b/dak/process_policy.py
index dfd6843..ecaeeac 100755
--- a/dak/process_policy.py
+++ b/dak/process_policy.py
@@ -50,6 +50,7 @@ from daklib.urgencylog import UrgencyLog
from daklib.packagelist import PackageList
import daklib.announce
+import daklib.upload
import daklib.utils
# Globals
@@ -240,10 +241,16 @@ def comment_accept(upload, srcqueue, comments, transaction):
if not os.path.exists(dst):
fs.copy(f.fullpath, dst, mode=mode)
- src = os.path.join(upload.policy_queue.path, upload.changes.changesname)
- dst = os.path.join(copydir, upload.changes.changesname)
- if not os.path.exists(dst):
- fs.copy(src, dst, mode=mode)
+ queue_files = [upload.changes.changesname]
+ chg = daklib.upload.Changes(upload.policy_queue.path, upload.changes.changesname, keyrings=[], require_signature=False)
+ queue_files.extend(f.filename for f in chg.buildinfo_files)
+ for fn in queue_files:
+ src = os.path.join(upload.policy_queue.path, fn)
+ dst = os.path.join(copydir, fn)
+ # We check for `src` to exist as old uploads in policy queues
+ # might still miss the `.buildinfo` files.
+ if os.path.exists(src) and not os.path.exists(dst):
+ fs.copy(src, dst, mode=mode)
if upload.source is not None and not Options['No-Action']:
urgency = upload.changes.urgency
@@ -350,7 +357,12 @@ def remove_upload(upload, transaction):
if os.path.exists(path):
fs.unlink(path)
session.delete(byhand)
- fs.unlink(os.path.join(queuedir, upload.changes.changesname))
+
+ chg = daklib.upload.Changes(queuedir, upload.changes.changesname, keyrings=[], require_signature=False)
+ queue_files = [upload.changes.changesname]
+ queue_files.extend(f.filename for f in chg.buildinfo_files)
+ for fn in queue_files:
+ fs.unlink(os.path.join(queuedir, fn))
session.delete(upload)
session.flush()
diff --git a/daklib/archive.py b/daklib/archive.py
index 42b2af5..8be748b 100644
--- a/daklib/archive.py
+++ b/daklib/archive.py
@@ -1125,8 +1125,12 @@ class ArchiveUpload(object):
self.transaction.session.add(u)
self.transaction.session.flush()
- dst = os.path.join(policy_queue.path, self.changes.filename)
- self.transaction.fs.copy(self.changes.path, dst, mode=policy_queue.change_perms)
+ queue_files = [self.changes.filename]
+ queue_files.extend(f.filename for f in self.changes.buildinfo_files)
+ for fn in queue_files:
+ src = os.path.join(self.changes.directory, fn)
+ dst = os.path.join(policy_queue.path, fn)
+ self.transaction.fs.copy(src, dst, mode=policy_queue.change_perms)
return u
diff --git a/daklib/upload.py b/daklib/upload.py
index c058938..7eb0ef6 100644
--- a/daklib/upload.py
+++ b/daklib/upload.py
@@ -390,6 +390,19 @@ class Changes(object):
return byhand
@property
+ def buildinfo_files(self):
+ """included buildinfo files
+ @type: list of L{daklib.upload.HashedFile}
+ """
+ buildinfo = []
+
+ for f in self.files.itervalues():
+ if re_file_buildinfo.match(f.filename):
+ buildinfo.append(f)
+
+ return buildinfo
+
+ @property
def binary_names(self):
"""names of included binary packages
@type: list of str
--
2.1.4
Reply to: