[dak/master] Improve error message for uploads that miss files.
---
daklib/checks.py | 23 +++++++++++++++++------
daklib/upload.py | 7 +++++++
2 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/daklib/checks.py b/daklib/checks.py
index 2e76e78..7298026 100644
--- a/daklib/checks.py
+++ b/daklib/checks.py
@@ -34,6 +34,7 @@ import daklib.utils as utils
import apt_inst
import apt_pkg
from apt_pkg import version_compare
+import errno
import os
import time
import yaml
@@ -165,13 +166,23 @@ class ChangesCheck(Check):
class HashesCheck(Check):
"""Check hashes in .changes and .dsc are valid."""
def check(self, upload):
- changes = upload.changes
- for f in changes.files.itervalues():
- f.check(upload.directory)
- source = changes.source
- if source is not None:
- for f in source.files.itervalues():
+ what = None
+ try:
+ changes = upload.changes
+ what = changes.filename
+ for f in changes.files.itervalues():
f.check(upload.directory)
+ source = changes.source
+ what = source.filename
+ if source is not None:
+ for f in source.files.itervalues():
+ f.check(upload.directory)
+ except IOError as e:
+ if e.errno == errno.ENOENT:
+ raise Reject('{0} refers to non-existing file: {1}\n'
+ 'Perhaps you need to include it in your upload?'
+ .format(what, os.path.basename(e.filename)))
+ raise
class ExternalHashesCheck(Check):
"""Checks hashes in .changes and .dsc against an external database."""
diff --git a/daklib/upload.py b/daklib/upload.py
index c55c409..447fa34 100644
--- a/daklib/upload.py
+++ b/daklib/upload.py
@@ -489,3 +489,10 @@ class Source(object):
if len(fields) > 1:
return fields[0]
return "main"
+
+ @property
+ def filename(self):
+ """filename of .dsc file
+ @type: str
+ """
+ return self._dsc_file.filename
--
1.7.2.5
Reply to: