Ansgar pushed to branch master at Debian FTP Team / dak
Commits:
-
f2120922
by Niels Thykier at 2020-10-31T10:44:12+00:00
-
880fd659
by Ansgar at 2020-10-31T11:45:14+01:00
-
89e55d4f
by Ansgar at 2020-10-31T11:47:40+01:00
3 changed files:
Changes:
... | ... | @@ -1010,7 +1010,6 @@ class ArchiveUpload(object): |
1010 | 1010 |
checks.WeakSignatureCheck,
|
1011 | 1011 |
checks.SignatureTimestampCheck,
|
1012 | 1012 |
checks.ChangesCheck,
|
1013 |
- #checks.SuffixCheck,
|
|
1014 | 1013 |
checks.ExternalHashesCheck,
|
1015 | 1014 |
checks.SourceCheck,
|
1016 | 1015 |
checks.BinaryCheck,
|
... | ... | @@ -295,39 +295,6 @@ class ChangesCheck(Check): |
295 | 295 |
return True
|
296 | 296 |
|
297 | 297 |
|
298 |
-class SuffixCheck(Check):
|
|
299 |
- """Checks suffix of .changes and .buildinfo files.
|
|
300 |
- |
|
301 |
- buildd uploads will include _${arch}.changes and _${arch}.buildinfo, so such endings
|
|
302 |
- should be reserved for uploads including binaries for ${arch} to avoid conflicts
|
|
303 |
- (for example in policy queues where dak stores the .changes and .buildinfo for later
|
|
304 |
- processing)
|
|
305 |
- """
|
|
306 |
- |
|
307 |
- def check(self, upload):
|
|
308 |
- session = upload.session
|
|
309 |
- changes = upload.changes
|
|
310 |
- |
|
311 |
- suffixes = []
|
|
312 |
- |
|
313 |
- changes_match = re_file_changes.match(changes.filename)
|
|
314 |
- assert(changes_match)
|
|
315 |
- suffixes.append((changes.filename, changes_match.group('suffix')))
|
|
316 |
- |
|
317 |
- for bi in changes.buildinfo_files:
|
|
318 |
- bi_match = re_file_buildinfo.match(bi.filename)
|
|
319 |
- assert(bi_match)
|
|
320 |
- suffixes.append((bi.filename, bi_match.group('suffix')))
|
|
321 |
- |
|
322 |
- for fn, suffix in suffixes:
|
|
323 |
- if suffix in changes.architectures:
|
|
324 |
- continue
|
|
325 |
- if session.query(Architecture).filter_by(arch_string=suffix).first():
|
|
326 |
- raise Reject("The upload includes '{}' whose filename includes the architecture name {}, but does not include binaries for {}. It is rejected to avoid filename conflicts with later buildd uploads.".format(fn, suffix, suffix))
|
|
327 |
- |
|
328 |
- return True
|
|
329 |
- |
|
330 |
- |
|
331 | 298 |
class ExternalHashesCheck(Check):
|
332 | 299 |
"""Checks hashes in .changes and .dsc against an external database."""
|
333 | 300 |
|
... | ... | @@ -745,31 +745,10 @@ class PoolFile(ORMObject): |
745 | 745 |
def basename(self):
|
746 | 746 |
return os.path.basename(self.filename)
|
747 | 747 |
|
748 |
- def is_valid(self, filesize=-1, md5sum=None):
|
|
749 |
- return self.filesize == int(filesize) and self.md5sum == md5sum
|
|
750 |
- |
|
751 | 748 |
def properties(self):
|
752 | 749 |
return ['filename', 'file_id', 'filesize', 'md5sum', 'sha1sum',
|
753 | 750 |
'sha256sum', 'source', 'binary', 'last_used']
|
754 | 751 |
|
755 |
- def identical_to(self, filename):
|
|
756 |
- """
|
|
757 |
- compare size and hash with the given file
|
|
758 |
- |
|
759 |
- @rtype: bool
|
|
760 |
- @return: true if the given file has the same size and hash as this object; false otherwise
|
|
761 |
- """
|
|
762 |
- st = os.stat(filename)
|
|
763 |
- if self.filesize != st.st_size:
|
|
764 |
- return False
|
|
765 |
- |
|
766 |
- with open(filename, "r") as f:
|
|
767 |
- sha256sum = apt_pkg.sha256sum(f)
|
|
768 |
- if sha256sum != self.sha256sum:
|
|
769 |
- return False
|
|
770 |
- |
|
771 |
- return True
|
|
772 |
- |
|
773 | 752 |
|
774 | 753 |
__all__.append('PoolFile')
|
775 | 754 |
|