]> git.decadent.org.uk Git - dak.git/commitdiff
Merge remote branch 'ansgar/p-s-from-db' into merge
authorJoerg Jaspert <joerg@debian.org>
Sun, 1 May 2011 21:51:58 +0000 (23:51 +0200)
committerJoerg Jaspert <joerg@debian.org>
Sun, 1 May 2011 21:51:58 +0000 (23:51 +0200)
* ansgar/p-s-from-db:
  do not generate binary-source/Packages
  look for already existing files in build queues
  fix typo in email address
  sort Packages by source name first

Signed-off-by: Joerg Jaspert <joerg@debian.org>
config/debian-security/cron.unchecked
dak/generate_packages_sources2.py
daklib/dbconn.py

index d519b20962d5660b4cce79834e9b1fc3ef88f739..100e5878dde1ad65817ad7bd7995ef86cf3c8aac 100755 (executable)
@@ -17,8 +17,8 @@ doanything=false
 dopolicy=false
 
 # So first we should go and see if any process-policy action is done
-dak process-policy embargo | mail -a "X-Debian: DAK" -e -s "Automatically accepted from embargoed" team@security.debian.org -- -F "Debian FTP Masters" -f ftonaster@ftp-master.debian.org
-dak process-policy disembargo | mail -a "X-Debian: DAK" -e -s "Automatically accepted from unembargoed" team@security.debian.org -- -F "Debian FTP Masters" -f ftonaster@ftp-master.debian.org
+dak process-policy embargo | mail -a "X-Debian: DAK" -e -s "Automatically accepted from embargoed" team@security.debian.org -- -F "Debian FTP Masters" -f ftpmaster@ftp-master.debian.org
+dak process-policy disembargo | mail -a "X-Debian: DAK" -e -s "Automatically accepted from unembargoed" team@security.debian.org -- -F "Debian FTP Masters" -f ftpmaster@ftp-master.debian.org
 
 # Now, if this really did anything, we can then sync it over. Files
 # in newstage mean they are (late) accepts of security stuff, need
index fbae045fd1676ce2afc323f34c7404b9b3dbd01c..4523252cc0e8ac0f1145fef530bfb155f3536d47 100755 (executable)
@@ -194,7 +194,7 @@ WHERE
   AND
     o.type = :type_id AND o.suite = :overridesuite AND o.component = :component
 
-ORDER BY tmp.package, tmp.version
+ORDER BY tmp.source, tmp.package, tmp.version
 """
 
 def generate_packages(suite_id, component_id, architecture_id, type_name):
@@ -276,6 +276,8 @@ def main():
             logger.log(generate_sources(s.suite_id, c))
             #pool.apply_async(generate_sources, [s.suite_id, c], callback=log)
             for a in s.architectures:
+                if a == 'source':
+                    continue
                 logger.log(generate_packages(s.suite_id, c, a.arch_id, 'deb'))
                 #pool.apply_async(generate_packages, [s.suite_id, c, a.arch_id, 'deb'], callback=log)
                 logger.log(generate_packages(s.suite_id, c, a.arch_id, 'udeb'))
index 6cddd35ff0f188b8cc02fdc81c18ec10a0df11b8..91ae848e83d00ce5366f0b51d10bf9c3ccc3af76 100755 (executable)
@@ -33,6 +33,7 @@
 
 ################################################################################
 
+import apt_pkg
 import os
 from os.path import normpath
 import re
@@ -73,7 +74,7 @@ from sqlalchemy.orm.exc import NoResultFound
 # in the database
 from config import Config
 from textutils import fix_maintainer
-from dak_exceptions import DBUpdateError, NoSourceFieldError
+from dak_exceptions import DBUpdateError, NoSourceFieldError, FileExistsError
 
 # suppress some deprecation warnings in squeeze related to sqlalchemy
 import warnings
@@ -890,6 +891,9 @@ class BuildQueue(object):
             else:
                 os.symlink(targetpath, queuepath)
                 qf.fileid = poolfile.file_id
+        except FileExistsError:
+            if not poolfile.identical_to(queuepath):
+                raise
         except OSError:
             return None
 
@@ -948,6 +952,9 @@ class BuildQueue(object):
             # Always copy files from policy queues as they might move around.
             import utils
             utils.copy(source, target)
+        except FileExistsError:
+            if not policyqueuefile.identical_to(target):
+                raise
         except OSError:
             return None
 
@@ -1043,6 +1050,24 @@ class ChangePendingFile(object):
     def __repr__(self):
         return '<ChangePendingFile %s>' % self.change_pending_file_id
 
+    def identical_to(self, filename):
+        """
+        compare size and hash with the given file
+
+        @rtype: bool
+        @return: true if the given file has the same size and hash as this object; false otherwise
+        """
+        st = os.stat(filename)
+        if self.size != st.st_size:
+            return False
+
+        f = open(filename, "r")
+        sha256sum = apt_pkg.sha256sum(f)
+        if sha256sum != self.sha256sum:
+            return False
+
+        return True
+
 __all__.append('ChangePendingFile')
 
 ################################################################################
@@ -1392,6 +1417,24 @@ class PoolFile(ORMObject):
     def not_null_constraints(self):
         return ['filename', 'md5sum', 'location']
 
+    def identical_to(self, filename):
+        """
+        compare size and hash with the given file
+
+        @rtype: bool
+        @return: true if the given file has the same size and hash as this object; false otherwise
+        """
+        st = os.stat(filename)
+        if self.filesize != st.st_size:
+            return False
+
+        f = open(filename, "r")
+        sha256sum = apt_pkg.sha256sum(f)
+        if sha256sum != self.sha256sum:
+            return False
+
+        return True
+
 __all__.append('PoolFile')
 
 @session_wrapper