]> git.decadent.org.uk Git - dak.git/commitdiff
Merge branch 'master' into dbtests
authorTorsten Werner <twerner@debian.org>
Mon, 21 Mar 2011 17:21:16 +0000 (18:21 +0100)
committerTorsten Werner <twerner@debian.org>
Mon, 21 Mar 2011 17:22:18 +0000 (18:22 +0100)
Conflicts:
dak/update_db.py

Signed-off-by: Torsten Werner <twerner@debian.org>
15 files changed:
config/debian/common
config/debian/cron.dinstall
config/debian/cron.unchecked
config/debian/dinstall.functions
dak/check_overrides.py
dak/dakdb/update43.py [new file with mode: 0755]
dak/generate_packages_sources.py
daklib/dbconn.py
daklib/queue.py
docs/README.quotes
scripts/debian/expire_dumps
scripts/debian/update-bugdoctxt
scripts/debian/update-mailingliststxt
scripts/debian/update-mirrorlists
scripts/debian/update-pseudopackages.sh

index f611c19e55b22dffe4ee5f60cdeee3805819d889..f5ec8ae630ae8a42696c7e5d158c5db2c2607ac0 100644 (file)
@@ -104,3 +104,9 @@ function reports() {
     dak cruft-report -s experimental >> $webdir/cruft-report-daily.txt
     cat $webdir/cruft-report-daily.txt | mail -a "X-Debian: DAK" -e -s "Debian archive cruft report for $(date +%D)" ftpmaster@ftp-master.debian.org -- -F "Debian FTP Masters" -f ftpmaster@ftp-master.debian.org
 }
+
+function pg_timestamp() {
+    tsname=${1:-"unknown"}
+    log "Saving postgres transaction id for ${tsname}"
+    psql -tAc 'select txid_current();' > $base/backup/txid_${tsname}_$(date +%Y.%m.%d-%H:%M:%S)
+}
index 6f7cf0d877b878e4cb2608ae42f096295e2d52f5..40451c8138484b5e6db55b9848909f4753e3645e 100755 (executable)
@@ -180,9 +180,9 @@ GO=(
 stage $GO &
 
 GO=(
-    FUNC="pgdump_pre"
+    FUNC="pg_timestamp"
     TIME="pg_dump1"
-    ARGS=""
+    ARGS="predinstall"
     ERR=""
 )
 stage $GO
@@ -397,12 +397,12 @@ GO=(
 stage $GO &
 
 GO=(
-    FUNC="pgdump_post"
+    FUNC="pg_timestamp"
     TIME="pg_dump2"
-    ARGS=""
+    ARGS="postdinstall"
     ERR=""
 )
-stage $GO &
+stage $GO
 
 GO=(
     FUNC="expire"
@@ -478,14 +478,6 @@ stage $GO &
 
 rm -f "${LOCK_BRITNEY}"
 
-GO=(
-    FUNC="pgdakdev"
-    TIME="dak-dev db"
-    ARGS=""
-    ERR="false"
-)
-stage $GO &
-
 GO=(
     FUNC="merkel3"
     TIME="merkel ddaccessible sync"
@@ -495,12 +487,12 @@ GO=(
 stage $GO &
 
 GO=(
-    FUNC="compress"
-    TIME="compress"
+    FUNC="cleantransactions"
+    TIME=""
     ARGS=""
     ERR=""
 )
-stage $GO &
+stage $GO
 
 GO=(
     FUNC="aptftpcleanup"
index 0d180a184b366c52bff8ebf6cbea755a0718b36a..7b81e511e2878843ae34ef733ace8ca24463b4b9 100755 (executable)
@@ -95,6 +95,8 @@ if ! lockfile -r8 $LOCKFILE; then
 fi
 trap cleanup 0
 
+
+pg_timestamp preunchecked
 do_newstage
 do_unchecked
 
@@ -105,3 +107,4 @@ if [ ! -z "$changes" ]; then
 fi
 
 dak contents -l 10000 scan
+pg_timestamp postunchecked
index dbbf30a8702b415701e62645e8dc43f9a86f11bf..afbfce167be939db564201cdccd94fdffa0b571f 100644 (file)
@@ -59,25 +59,6 @@ function pgdump_post() {
     #ln -sf $base/backup/dumpall_$POSTDUMP currentall
 }
 
-# Load the dak-dev projectb
-function pgdakdev() {
-    # Make sure to unset any possible psql variables so we don't drop the wrong
-    # f****** database by accident
-    local PGDATABASE
-    unset PGDATABASE
-    local PGHOST
-    unset PGHOST
-    local PGPORT
-    unset PGPORT
-    local PGUSER
-    unset PGUSER
-    cd $base/backup
-    echo "drop database projectb" | psql -p 5434 template1
-       #cat currentall | psql -p 5433 template1
-    createdb -p 5434 -T template1 projectb
-    fgrep -v '\connect' current | psql -p 5434 projectb
-}
-
 # Updating various files
 function updates() {
     log "Updating Bugs docu, Mirror list and mailing-lists.txt"
@@ -521,17 +502,10 @@ function aptftpcleanup() {
     apt-ftparchive -q clean apt.conf
 }
 
-function compress() {
-    log "Compress old psql backups"
+function cleantransactions() {
+    log "Cleanup transaction ids older than 3 months"
     cd $base/backup/
-    find -maxdepth 1 -mindepth 1 -type f -name 'dump_pre_*' -mtime +2 -print0 | xargs -0 --no-run-if-empty rm
-
-    find -maxdepth 1 -mindepth 1 -type f -name 'dump_*' \! -name '*.bz2' \! -name '*.gz' \! -name '*.xz' -mmin +720 -print0 \
-        | xargs --no-run-if-empty -0 -P4 -n1 xz -9v
-
-    find -maxdepth 1 -mindepth 1 -type f -name "dumpall_*" \! -name '*.bz2' \! -name '*.gz' \! -name '*.xz' -mmin +720 \
-        | xargs --no-run-if-empty -0 -P4 -n1 xz -9v
-    finddup -l -d $base/backup
+    find -maxdepth 1 -mindepth 1 -type f -name 'txid_*' -mtime +90 -print0 | xargs -0 --no-run-if-empty rm
 }
 
 function logstats() {
index 75ba5a0e2171b880cc412108f2abf1b0869d9eba..7c924649deaed4a716ea8b583b04f0507fe970e3 100755 (executable)
@@ -1,8 +1,14 @@
 #!/usr/bin/env python
 
-""" Cruft checker and hole filler for overrides """
-# Copyright (C) 2000, 2001, 2002, 2004, 2006  James Troup <james@nocrew.org>
-# Copyright (C) 2005  Jeroen van Wolffelaar <jeroen@wolffelaar.nl>
+""" Cruft checker and hole filler for overrides
+
+@contact: Debian FTPMaster <ftpmaster@debian.org>
+@copyright: 2000, 2001, 2002, 2004, 2006  James Troup <james@nocrew.org>
+@opyright: 2005  Jeroen van Wolffelaar <jeroen@wolffelaar.nl>
+@copyright: 2011  Joerg Jaspert <joerg@debian.org>
+@license: GNU General Public License version 2 or later
+
+"""
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -58,8 +64,8 @@ from daklib import utils
 
 ################################################################################
 
-Options = None
-Logger = None
+Options = None                 #: Commandline arguments parsed into this
+Logger = None                  #: Our logging object
 sections = {}
 priorities = {}
 blacklist = {}
@@ -150,7 +156,8 @@ SELECT s.source FROM source s, src_associations sa, files f, location l,
                 if not Options["No-Action"]:
                     session.execute("""DELETE FROM override WHERE package = :package
                                           AND suite = :suite_id AND component = :component_id
-                                          AND type = :type_id""",
+                                          AND type = :type_id
+                                          AND created < now() - interval '14 days'""",
                                     {'package': package, 'suite_id': osuite_id,
                                      'component_id': component_id, 'type_id': type_id})
         # create source overrides based on binary overrides, as source
@@ -239,7 +246,8 @@ SELECT s.source FROM source s, src_associations sa, files f, location l,
                 if not Options["No-Action"]:
                     session.execute("""DELETE FROM override
                                         WHERE package = :package AND suite = :suite_id
-                                          AND component = :component_id AND type = :type_id""",
+                                          AND component = :component_id AND type = :type_id
+                                          AND created < now() - interval '14 days'""",
                                     {'package': package, 'suite_id': osuite_id,
                                      'component_id': component_id, 'type_id': type_id})
 
diff --git a/dak/dakdb/update43.py b/dak/dakdb/update43.py
new file mode 100755 (executable)
index 0000000..0715410
--- /dev/null
@@ -0,0 +1,51 @@
+#!/usr/bin/env python
+# coding=utf8
+
+"""
+Fix up constraints for pg 9.0
+
+@contact: Debian FTP Master <ftpmaster@debian.org>
+@copyright: 2011 Mark Hymers <mhy@debian.org>
+@license: GNU General Public License version 2 or later
+"""
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+################################################################################
+
+import psycopg2
+from daklib.dak_exceptions import DBUpdateError
+from socket import gethostname;
+
+################################################################################
+def do_update(self):
+    """
+    Fix up constraints for pg 9.0
+    """
+    print __doc__
+    try:
+        c = self.db.cursor()
+
+        c.execute("ALTER TABLE policy_queue DROP constraint policy_queue_perms_check")
+        c.execute("ALTER TABLE policy_queue DROP constraint policy_queue_change_perms_check")
+        c.execute("ALTER TABLE policy_queue ADD CONSTRAINT policy_queue_perms_check CHECK (perms SIMILAR TO '[0-7][0-7][0-7][0-7]')")
+        c.execute("ALTER TABLE policy_queue ADD CONSTRAINT policy_queue_change_perms_check CHECK (change_perms SIMILAR TO '[0-7][0-7][0-7][0-7]')")
+
+        c.execute("UPDATE config SET value = '43' WHERE name = 'db_revision'")
+        self.db.commit()
+
+    except psycopg2.ProgrammingError, msg:
+        self.db.rollback()
+        raise DBUpdateError, 'Unable to apply update 43, rollback issued. Error message : %s' % (str(msg))
index bdd318056f14d2262b0fcf19c1101996826d3d58..3c02e0dda7704f2fa8d20e0a461deab2c8c87986 100755 (executable)
@@ -31,7 +31,7 @@ import sys
 import apt_pkg
 from tempfile import mkstemp, mkdtemp
 import commands
-from multiprocessing import Pool
+from multiprocessing import Pool, TimeoutError
 
 from daklib import daklog
 from daklib.dbconn import *
@@ -41,6 +41,7 @@ from daklib.config import Config
 
 Options = None                 #: Commandline arguments parsed into this
 Logger = None                  #: Our logging object
+results = []                   #: Results of the subprocesses
 
 ################################################################################
 
@@ -341,6 +342,7 @@ tree "dists/oldstable-proposed-updates/main"
         (result, output) = commands.getstatusoutput('apt-ftparchive -o APT::FTPArchive::Contents=off generate %s' % os.path.basename(ac_name))
         sn="a-f %s,%s: " % (suite, arch)
         print sn + output.replace('\n', '\n%s' % (sn))
+        return result
 
     # Clean up any left behind files
     finally:
@@ -359,11 +361,16 @@ tree "dists/oldstable-proposed-updates/main"
 def sname(arch):
     return arch.arch_string
 
+def get_result(arg):
+    global results
+    if arg:
+        results.append(arg)
+
 ########################################################################
 ########################################################################
 
 def main ():
-    global Options, Logger
+    global Options, Logger, results
 
     cnf = Config()
 
@@ -401,19 +408,26 @@ def main ():
     startdir = os.getcwd()
     os.chdir(cnf["Dir::TempPath"])
 
+    broken=[]
     # For each given suite, each architecture, run one apt-ftparchive
     for s in suites:
+        results=[]
         # Setup a multiprocessing Pool. As many workers as we have CPU cores.
         pool = Pool()
         arch_list=get_suite_architectures(s.suite_name, skipsrc=False, skipall=True, session=session)
         Logger.log(['generating output for Suite %s, Architectures %s' % (s.suite_name, map(sname, arch_list))])
         for a in arch_list:
-            pool.apply_async(generate_packages_sources, (a.arch_string, s.suite_name, cnf["Dir::TempPath"]))
+            pool.apply_async(generate_packages_sources, (a.arch_string, s.suite_name, cnf["Dir::TempPath"]), callback=get_result)
 
         # No more work will be added to our pool, close it and then wait for all to finish
         pool.close()
         pool.join()
 
+    if len(results) > 0:
+        Logger.log(['Trouble, something with a-f broke, resultcodes: %s' % (results)])
+        print "Trouble, something with a-f broke, resultcodes: %s" % (results)
+        sys.exit(1)
+
     os.chdir(startdir)
     # this script doesn't change the database
     session.close()
index 4f6b02d8fdfec3fd640551e63070fc893c3e8436..1bf5a0f997c7bb84aa5821aa4f9ab3c074ec3422 100755 (executable)
@@ -2893,8 +2893,9 @@ class DBConn(object):
             table = Table(table_name, self.db_meta, autoload=True)
             setattr(self, 'tbl_%s' % table_name, table)
 
-        # bin_contents needs special attention until update #41 has been
-        # applied
+        # bin_contents needs special attention until the SERIAL type is
+        # correctly detected and the workaround has been removed; see comment
+        # above
         self.tbl_bin_contents = Table('bin_contents', self.db_meta, \
             Column('file', Text, primary_key = True),
             Column('binary_id', Integer, ForeignKey('binaries.id'), \
index b3e26d7bed50945dc1a47b4cf525c0fb7f309a64..646d89c508a349193ee9ab2033af30f56098249a 100755 (executable)
@@ -59,7 +59,7 @@ from lintian import parse_lintian_output, generate_reject_messages
 # module
 import warnings
 warnings.filterwarnings('ignore', \
-    "apt_pkg-.ParseSection\(\) is deprecated. Please see apt_pkg\.TagSection\(\) for the replacement\.", \
+    "apt_pkg.ParseSection\(\) is deprecated. Please see apt_pkg\.TagSection\(\) for the replacement\.", \
     DeprecationWarning)
 warnings.filterwarnings('ignore', \
     "Attribute 'Find' of the 'apt_pkg\.TagSection' object is deprecated, use 'find' instead\.", \
index 3568ae7ad519cbf90ea165cc9fd4705568fa0de0..adad8cdcbf479271b4af0db64fbf90dec4d90e79 100644 (file)
@@ -344,3 +344,5 @@ Canadians: This is a lighthouse. Your call.
 <helix> elmo: I can't believe people pay you to fix computers
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+<mhy> I wish they wouldnt leave biscuits out, thats just tempting. Damnit.
index 2907ba28c55737bbc82eff789bac5c5978862ae6..b7b20655da25baa7d07798163987fb6ba8ba709c 100755 (executable)
@@ -59,7 +59,7 @@ def all_files(pattern, search_path, pathsep=os.pathsep):
 def parse_file_dates(list):
     out = []
     # dump_2006.05.02-11:52:01.bz2
-    p = re.compile('^\./dump_([0-9]{4})\.([0-9]{2})\.([0-9]{2})-([0-9]{2}):([0-9]{2}):([0-9]{2})(.bz2)?$')
+    p = re.compile('^\./dump_([0-9]{4})\.([0-9]{2})\.([0-9]{2})-([0-9]{2}):([0-9]{2}):([0-9]{2})(.xz)?$')
     for file in list:
         m = p.search(file)
         if m:
index d5568f58ce23b865bd1c7c95b615ec9c9eafd70c..2a89da403cb1483c502992a4352e8968ba8712e5 100755 (executable)
@@ -1,6 +1,7 @@
 #!/bin/sh -e
 
-. vars
+export SCRIPTVARS=/srv/ftp-master.debian.org/dak/config/debian/vars
+. $SCRIPTVARS
 
 export TERM=linux
 
index 3b67eb958bdea55fe36682a7e65febc11aa9fcf2..3c3dcaf3d0dddadfb1aa9edcae51df779b6e0f15 100755 (executable)
@@ -3,7 +3,8 @@
 # Fetches latest copy of mailing-lists.txt
 # Michael Beattie <mjb@debian.org>
 
-. vars
+export SCRIPTVARS=/srv/ftp-master.debian.org/dak/config/debian/vars
+. $SCRIPTVARS
 
 cd $ftpdir/doc
 
index ebd0058835c12cfccb8f7caee0fa5715689fa1dd..6eefa8623565433c8e60ef118a5c46421a95a72e 100755 (executable)
@@ -3,7 +3,8 @@
 # Very Very hackish script...  dont laugh.
 # Michael Beattie <mjb@debian.org>
 
-. vars
+export SCRIPTVARS=/srv/ftp-master.debian.org/dak/config/debian/vars
+. $SCRIPTVARS
 
 prog=$scriptdir/mirrorlist/mirror_list.pl
 masterlist=$scriptdir/mirrorlist/Mirrors.masterlist
index d9a4d2357ee65b30c9eac2d92358f67ab453e692..76551ff344ee6cf5b2adb042b5655dc0410b685b 100755 (executable)
@@ -3,7 +3,8 @@
 # Fetches latest copy of pseudo-packages
 # Joerg Jaspert <joerg@debian.org>
 
-. vars
+export SCRIPTVARS=/srv/ftp-master.debian.org/dak/config/debian/vars
+. $SCRIPTVARS
 
 cd ${scriptdir}/masterfiles