]> git.decadent.org.uk Git - dak.git/commitdiff
Merge branch 'content_generation' of http://kernel.ubuntu.com/~mcasadevall/dak into...
authorMike O'Connor <stew@vireo.org>
Wed, 28 Jan 2009 02:09:57 +0000 (21:09 -0500)
committerMike O'Connor <stew@vireo.org>
Wed, 28 Jan 2009 02:09:57 +0000 (21:09 -0500)
Conflicts:

dak/dakdb/update2.py
dak/update_db.py

This updates the "required_schema" to 4, moving mcasadevall's update2 to
update4

Signed-off-by: Mike O'Connor <stew@vireo.org>
12 files changed:
dak/cruft_report.py
dak/dakdb/update2.py [changed mode: 0644->0755]
dak/dakdb/update3.py [new file with mode: 0755]
dak/dakdb/update4.py [new file with mode: 0644]
dak/examine_package.py
dak/process_new.py
dak/show_new.py
dak/update_db.py
daklib/utils.py
scripts/debian/moveftp.sh [new file with mode: 0755]
src/Makefile [deleted file]
src/sql-aptvc.cpp [deleted file]

index fab47bf056d72bf910fd774ed48c45e584487ce6..5a2abd61c2a5f77111839d5c1c4d7ce4a7a8fea8 100755 (executable)
@@ -182,8 +182,8 @@ SELECT s.source, s.version AS experimental, s2.version AS unstable
   FROM src_associations sa, source s, source s2, src_associations sa2
   WHERE sa.suite = %s AND sa2.suite = %d AND sa.source = s.id
    AND sa2.source = s2.id AND s.source = s2.source
-   AND versioncmp(s.version, s2.version) < 0""" % (experimental_id,
-                                                   database.get_suite_id("unstable")))
+   AND s.version < s2.version""" % (experimental_id,
+                                    database.get_suite_id("unstable")))
     ql = q.getresult()
     if ql:
         nviu_to_remove = []
old mode 100644 (file)
new mode 100755 (executable)
index ec9650b..0cf747e
@@ -1,7 +1,9 @@
 #!/usr/bin/env python
+# coding=utf8
 
-# Debian Archive Kit Database Update Script 2
-# Copyright (C) 2009  Michael Casadevall <mcasadevall@debian.org>
+# Debian Archive Kit Database Update Script
+# Copyright © 2008  Michael Casadevall <mcasadevall@debian.org>
+# Copyright © 2008  Roger Leigh <rleigh@debian.org>
 
 # 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
 
 ################################################################################
 
-# <tomv_w> really, if we want to screw ourselves, let's find a better way.
-# <Ganneff> rm -rf /srv/ftp.debian.org
-
-################################################################################
-
 import psycopg2, time
 
 ################################################################################
 
 def do_update(self):
-    print "Adding content fields to database"
+vvvvvvvvvvvvvvvvvvvv
+    print "Note: to be able to enable the the PL/Perl (plperl) procedural language, we do"
+    print "need postgresql-plperl-$postgres-version installed. Make sure that this is the"
+    print "case before you continue. Interrupt if it isn't, sleeping 5 seconds now."
+    print "(We need to be database superuser for this to work!)"
+    time.sleep (5)
+^^^^^^^^^^^^^^^^^^^^
 
     try:
         c = self.db.cursor()
-        c.execute("""CREATE TABLE content_file_paths (
-                     id serial primary key not null,
-                     path text unique not null
-                   )""")
-
-        c.execute("""CREATE TABLE content_file_names (
-                    id serial primary key not null,
-                    file text unique not null
-                   )""")
-
-        c.execute("""CREATE TABLE content_associations (
-                    id serial not null,
-                    binary_pkg int4 not null references binaries(id) on delete cascade,
-                    filepath int4 not null references content_file_paths(id) on delete cascade,
-                    filename int4 not null references content_file_names(id) on delete cascade
-                  );""")
-
-        c.execute("""CREATE FUNCTION comma_concat(text, text) RETURNS text
-                   AS $_$select case
-                   WHEN $2 is null or $2 = '' THEN $1
-                   WHEN $1 is null or $1 = '' THEN $2
-                   ELSE $1 || ',' || $2
-                   END$_$
-                   LANGUAGE sql""")
-
-        c.execute("""CREATE AGGREGATE comma_separated_list (
-                   BASETYPE = text,
-                   SFUNC = comma_concat,
-                   STYPE = text,
-                   INITCOND = ''
-                   );""")
+
+        print "Enabling PL/Perl language"
+        c.execute("CREATE LANGUAGE plperl;")
+        c.execute("CREATE LANGUAGE plpgsql;")
+
+        print "Adding debversion type to database."
+
+# Not present in all databases, maybe PL/Perl version-dependent?
+#        c.execute("SET SESSION plperl.use_strict TO 't';")
+
+        c.execute("CREATE DOMAIN debversion AS TEXT;")
+        c.execute("COMMENT ON DOMAIN debversion IS 'Debian package version number';")
+
+        c.execute("""ALTER DOMAIN debversion
+                     ADD CONSTRAINT debversion_syntax
+                     CHECK (VALUE !~ '[^-+:.0-9a-zA-Z~]');""")
+
+        # From Dpkg::Version::parseversion
+        c.execute("""CREATE OR REPLACE FUNCTION debversion_split (debversion)
+  RETURNS text[] AS $$
+    my $ver = shift;
+    my %verhash;
+    if ($ver =~ /:/)
+    {
+        $ver =~ /^(\d+):(.+)/ or die "bad version number '$ver'";
+        $verhash{epoch} = $1;
+        $ver = $2;
+    }
+    else
+    {
+        $verhash{epoch} = 0;
+    }
+    if ($ver =~ /(.+)-(.*)$/)
+    {
+        $verhash{version} = $1;
+        $verhash{revision} = $2;
+    }
+    else
+    {
+        $verhash{version} = $ver;
+        $verhash{revision} = 0;
+    }
+
+    return [$verhash{'epoch'}, $verhash{'version'}, $verhash{'revision'}];
+$$
+  LANGUAGE plperl
+  IMMUTABLE STRICT;""")
+        c.execute("""COMMENT ON FUNCTION debversion_split (debversion)
+                   IS 'Split debian version into epoch, upstream version and revision';""")
+
+        c.execute("""CREATE OR REPLACE FUNCTION debversion_epoch (version debversion)
+  RETURNS text AS $$
+DECLARE
+  split text[];
+BEGIN
+  split := debversion_split(version);
+  RETURN split[1];
+END;
+$$
+  LANGUAGE plpgsql
+  IMMUTABLE STRICT;
+COMMENT ON FUNCTION debversion_epoch (debversion)
+  IS 'Get debian version epoch';
+
+CREATE OR REPLACE FUNCTION debversion_version (version debversion)
+  RETURNS text AS $$
+DECLARE
+  split text[];
+BEGIN
+  split := debversion_split(version);
+  RETURN split[2];
+END;
+$$
+  LANGUAGE plpgsql
+  IMMUTABLE STRICT;""")
+        c.execute("""COMMENT ON FUNCTION debversion_version (debversion)
+                   IS 'Get debian version upstream version';""")
+
+        c.execute("""CREATE OR REPLACE FUNCTION debversion_revision (version debversion)
+  RETURNS text AS $$
+DECLARE
+  split text[];
+BEGIN
+  split := debversion_split(version);
+  RETURN split[3];
+END;
+$$
+  LANGUAGE plpgsql
+  IMMUTABLE STRICT;""")
+        c.execute("""COMMENT ON FUNCTION debversion_revision (debversion)
+                   IS 'Get debian version revision';""")
+
+# From Dpkg::Version::parseversion
+        c.execute("""CREATE OR REPLACE FUNCTION debversion_compare_single (version1 text, version2 text)
+  RETURNS integer AS $$
+     sub order{
+         my ($x) = @_;
+         ##define order(x) ((x) == '~' ? -1 \
+         #           : cisdigit((x)) ? 0 \
+         #           : !(x) ? 0 \
+         #           : cisalpha((x)) ? (x) \
+         #           : (x) + 256)
+         # This comparison is out of dpkg's order to avoid
+         # comparing things to undef and triggering warnings.
+         if (not defined $x or not length $x) {
+              return 0;
+         }
+         elsif ($x eq '~') {
+              return -1;
+         }
+         elsif ($x =~ /^\d$/) {
+              return 0;
+         }
+         elsif ($x =~ /^[A-Z]$/i) {
+              return ord($x);
+         }
+         else {
+              return ord($x) + 256;
+         }
+     }
+
+     sub next_elem(\@){
+         my $a = shift;
+         return @{$a} ? shift @{$a} : undef;
+     }
+     my ($val, $ref) = @_;
+     $val = "" if not defined $val;
+     $ref = "" if not defined $ref;
+     my @val = split //,$val;
+     my @ref = split //,$ref;
+     my $vc = next_elem @val;
+     my $rc = next_elem @ref;
+     while (defined $vc or defined $rc) {
+         my $first_diff = 0;
+         while ((defined $vc and $vc !~ /^\d$/) or
+                (defined $rc and $rc !~ /^\d$/)) {
+              my $vo = order($vc); my $ro = order($rc);
+              # Unlike dpkg's verrevcmp, we only return 1 or -1 here.
+              return (($vo - $ro > 0) ? 1 : -1) if $vo != $ro;
+              $vc = next_elem @val; $rc = next_elem @ref;
+         }
+         while (defined $vc and $vc eq '0') {
+              $vc = next_elem @val;
+         }
+         while (defined $rc and $rc eq '0') {
+              $rc = next_elem @ref;
+         }
+         while (defined $vc and $vc =~ /^\d$/ and
+                defined $rc and $rc =~ /^\d$/) {
+              $first_diff = ord($vc) - ord($rc) if !$first_diff;
+              $vc = next_elem @val; $rc = next_elem @ref;
+         }
+         return 1 if defined $vc and $vc =~ /^\d$/;
+         return -1 if defined $rc and $rc =~ /^\d$/;
+         return (($first_diff  > 0) ? 1 : -1) if $first_diff;
+     }
+     return 0;
+$$
+  LANGUAGE plperl
+  IMMUTABLE STRICT;""")
+        c.execute("""COMMENT ON FUNCTION debversion_compare_single (text, text)
+                   IS 'Compare upstream or revision parts of Debian versions';""")
+
+# Logic only derived from Dpkg::Version::parseversion
+        c.execute("""CREATE OR REPLACE FUNCTION debversion_compare (version1 debversion, version2 debversion)
+  RETURNS integer AS $$
+DECLARE
+  split1 text[];
+  split2 text[];
+  result integer;
+BEGIN
+  result := 0;
+  split1 := debversion_split(version1);
+  split2 := debversion_split(version2);
+
+  -- RAISE NOTICE 'Version 1: %', version1;
+  -- RAISE NOTICE 'Version 2: %', version2;
+  -- RAISE NOTICE 'Split 1: %', split1;
+  -- RAISE NOTICE 'Split 2: %', split2;
+
+  IF split1[1] > split2[1] THEN
+    result := 1;
+  ELSIF split1[1] < split2[1] THEN
+    result := -1;
+  ELSE
+    result := debversion_compare_single(split1[2], split2[2]);
+    IF result = 0 THEN
+      result := debversion_compare_single(split1[3], split2[3]);
+    END IF;
+  END IF;
+
+  RETURN result;
+END;
+$$
+  LANGUAGE plpgsql
+  IMMUTABLE STRICT;""")
+        c.execute("""COMMENT ON FUNCTION debversion_compare (debversion, debversion)
+  IS 'Compare Debian versions';""")
+
+        c.execute("""CREATE OR REPLACE FUNCTION debversion_eq (version1 debversion, version2 debversion)
+  RETURNS boolean AS $$
+DECLARE
+  comp integer;
+  result boolean;
+BEGIN
+  comp := debversion_compare(version1, version2);
+  result := comp = 0;
+  RETURN result;
+END;
+$$
+  LANGUAGE plpgsql
+  IMMUTABLE STRICT;""")
+        c.execute("""COMMENT ON FUNCTION debversion_eq (debversion, debversion)
+  IS 'debversion equal';""")
+
+        c.execute("""CREATE OR REPLACE FUNCTION debversion_ne (version1 debversion, version2 debversion)
+  RETURNS boolean AS $$
+DECLARE
+  comp integer;
+  result boolean;
+BEGIN
+  comp := debversion_compare(version1, version2);
+  result := comp <> 0;
+  RETURN result;
+END;
+$$
+  LANGUAGE plpgsql
+  IMMUTABLE STRICT;""")
+        c.execute("""COMMENT ON FUNCTION debversion_ne (debversion, debversion)
+  IS 'debversion not equal';""")
+
+        c.execute("""CREATE OR REPLACE FUNCTION debversion_lt (version1 debversion, version2 debversion)
+  RETURNS boolean AS $$
+DECLARE
+  comp integer;
+  result boolean;
+BEGIN
+  comp := debversion_compare(version1, version2);
+  result := comp < 0;
+  RETURN result;
+END;
+$$
+  LANGUAGE plpgsql
+  IMMUTABLE STRICT;""")
+        c.execute("""COMMENT ON FUNCTION debversion_lt (debversion, debversion)
+                   IS 'debversion less-than';""")
+
+        c.execute("""CREATE OR REPLACE FUNCTION debversion_gt (version1 debversion, version2 debversion) RETURNS boolean AS $$
+DECLARE
+  comp integer;
+  result boolean;
+BEGIN
+  comp := debversion_compare(version1, version2);
+  result := comp > 0;
+  RETURN result;
+END;
+$$
+  LANGUAGE plpgsql
+  IMMUTABLE STRICT;""")
+        c.execute("""COMMENT ON FUNCTION debversion_gt (debversion, debversion)
+                   IS 'debversion greater-than';""")
+
+        c.execute("""CREATE OR REPLACE FUNCTION debversion_le (version1 debversion, version2 debversion)
+  RETURNS boolean AS $$
+DECLARE
+  comp integer;
+  result boolean;
+BEGIN
+  comp := debversion_compare(version1, version2);
+  result := comp <= 0;
+  RETURN result;
+END;
+$$
+  LANGUAGE plpgsql
+  IMMUTABLE STRICT;""")
+        c.execute("""COMMENT ON FUNCTION debversion_le (debversion, debversion)
+                   IS 'debversion less-than-or-equal';""")
+
+        c.execute("""CREATE OR REPLACE FUNCTION debversion_ge (version1 debversion, version2 debversion)
+  RETURNS boolean AS $$
+DECLARE
+  comp integer;
+  result boolean;
+BEGIN
+  comp := debversion_compare(version1, version2);
+  result := comp >= 0;
+  RETURN result;
+END;
+$$
+  LANGUAGE plpgsql
+  IMMUTABLE STRICT;""")
+        c.execute("""COMMENT ON FUNCTION debversion_ge (debversion, debversion)
+                   IS 'debversion greater-than-or-equal';""")
+
+        c.execute("""CREATE OPERATOR = (
+                   PROCEDURE = debversion_eq,
+                   LEFTARG = debversion,
+                   RIGHTARG = debversion,
+                   COMMUTATOR = =,
+                   NEGATOR = !=);""")
+        c.execute("""COMMENT ON OPERATOR = (debversion, debversion)
+                   IS 'debversion equal';""")
+
+        c.execute("""CREATE OPERATOR != (
+                   PROCEDURE = debversion_eq,
+                   LEFTARG = debversion,
+                   RIGHTARG = debversion,
+                   COMMUTATOR = !=,
+                   NEGATOR = =);""")
+        c.execute("""COMMENT ON OPERATOR != (debversion, debversion)
+                   IS 'debversion not equal';""")
+
+        c.execute("""CREATE OPERATOR < (
+                   PROCEDURE = debversion_lt,
+                   LEFTARG = debversion,
+                   RIGHTARG = debversion,
+                   COMMUTATOR = >,
+                   NEGATOR = >=);""")
+        c.execute("""COMMENT ON OPERATOR < (debversion, debversion)
+                   IS 'debversion less-than';""")
+
+        c.execute("""CREATE OPERATOR > (
+                   PROCEDURE = debversion_gt,
+                   LEFTARG = debversion,
+                   RIGHTARG = debversion,
+                   COMMUTATOR = <,
+                   NEGATOR = >=);""")
+        c.execute("""COMMENT ON OPERATOR > (debversion, debversion)
+                   IS 'debversion greater-than';""")
+
+        c.execute("""CREATE OPERATOR <= (
+                   PROCEDURE = debversion_le,
+                   LEFTARG = debversion,
+                   RIGHTARG = debversion,
+                   COMMUTATOR = >=,
+                   NEGATOR = >);""")
+        c.execute("""COMMENT ON OPERATOR <= (debversion, debversion)
+                   IS 'debversion less-than-or-equal';""")
+
+        c.execute("""CREATE OPERATOR >= (
+                   PROCEDURE = debversion_ge,
+                   LEFTARG = debversion,
+                   RIGHTARG = debversion,
+                   COMMUTATOR = <=,
+                   NEGATOR = <);""")
+        c.execute("""COMMENT ON OPERATOR >= (debversion, debversion)
+                   IS 'debversion greater-than-or-equal';""")
+
+        c.execute("ALTER TABLE source ALTER COLUMN version TYPE debversion;")
+        c.execute("ALTER TABLE binaries ALTER COLUMN version TYPE debversion;")
 
         c.execute("UPDATE config SET value = '2' WHERE name = 'db_revision'")
-        self.db.commit()
 
-        print "REMINDER: Remember to fully regenerate the Contents files before running import-contents"
-        print ""
-        print "Pausing for five seconds ..."
-        time.sleep (5)
+        self.db.commit()
 
     except psycopg2.ProgrammingError, msg:
         self.db.rollback()
-        print "FATAL: Unable to apply content table update 2!"
+        print "FATAL: Unable to apply debversion table update 2!"
         print "Error Message: " + str(msg)
         print "Database changes have been rolled back."
diff --git a/dak/dakdb/update3.py b/dak/dakdb/update3.py
new file mode 100755 (executable)
index 0000000..cc29786
--- /dev/null
@@ -0,0 +1,41 @@
+#!/usr/bin/env python
+
+# Debian Archive Kit Database Update Script
+# Copyright (C) 2008  Michael Casadevall <mcasadevall@debian.org>
+# Copyright (C) 2009  Joerg Jaspert <joerg@debian.org>
+
+# 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, time
+
+################################################################################
+
+def do_update(self):
+    print "Removing no longer used function versioncmp"
+
+    try:
+        c = self.db.cursor()
+        c.execute("DROP FUNCTION versioncmp(text, text);")
+        c.execute("UPDATE config SET value = '3' WHERE name = 'db_revision'")
+
+        self.db.commit()
+
+    except psycopg2.ProgrammingError, msg:
+        self.db.rollback()
+        print "FATAL: Unable to apply db update 3!"
+        print "Error Message: " + str(msg)
+        print "Database changes have been rolled back."
diff --git a/dak/dakdb/update4.py b/dak/dakdb/update4.py
new file mode 100644 (file)
index 0000000..3116076
--- /dev/null
@@ -0,0 +1,86 @@
+#!/usr/bin/env python
+# coding=utf8
+
+"""
+Debian Archive Kit Database Update Script
+Copyright © 2008  Michael Casadevall <mcasadevall@debian.org>
+Copyright © 2008  Roger Leigh <rleigh@debian.org>
+
+Debian Archive Kit Database Update Script 2
+"""
+
+# 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
+
+################################################################################
+
+# <tomv_w> really, if we want to screw ourselves, let's find a better way.
+# <Ganneff> rm -rf /srv/ftp.debian.org
+
+################################################################################
+
+import psycopg2, time
+
+################################################################################
+
+def do_update(self):
+    print "Adding content fields to database"
+
+    try:
+        c = self.db.cursor()
+        c.execute("""CREATE TABLE content_file_paths (
+                     id serial primary key not null,
+                     path text unique not null
+                   )""")
+
+        c.execute("""CREATE TABLE content_file_names (
+                    id serial primary key not null,
+                    file text unique not null
+                   )""")
+
+        c.execute("""CREATE TABLE content_associations (
+                    id serial not null,
+                    binary_pkg int4 not null references binaries(id) on delete cascade,
+                    filepath int4 not null references content_file_paths(id) on delete cascade,
+                    filename int4 not null references content_file_names(id) on delete cascade
+                  );""")
+
+        c.execute("""CREATE FUNCTION comma_concat(text, text) RETURNS text
+                   AS $_$select case
+                   WHEN $2 is null or $2 = '' THEN $1
+                   WHEN $1 is null or $1 = '' THEN $2
+                   ELSE $1 || ',' || $2
+                   END$_$
+                   LANGUAGE sql""")
+
+        c.execute("""CREATE AGGREGATE comma_separated_list (
+                   BASETYPE = text,
+                   SFUNC = comma_concat,
+                   STYPE = text,
+                   INITCOND = ''
+                   );""")
+
+        c.execute("UPDATE config SET value = '2' WHERE name = 'db_revision'")
+        self.db.commit()
+
+        print "REMINDER: Remember to fully regenerate the Contents files before running import-contents"
+        print ""
+        print "Pausing for five seconds ..."
+        time.sleep (5)
+
+    except psycopg2.ProgrammingError, msg:
+        self.db.rollback()
+        print "FATAL: Unable to apply debversion table update 2!"
+        print "Error Message: " + str(msg)
+        print "Database changes have been rolled back."
index c7ab7ad5865c8d9619cd9951acc8086e2610bbad..49d18dc685dfabb0668e9b70c76833c39d6dd336 100755 (executable)
@@ -271,7 +271,7 @@ def read_control (filename):
 
     return (control, control_keys, section, depends, recommends, arch, maintainer)
 
-def read_changes_or_dsc (filename):
+def read_changes_or_dsc (suite, filename):
     dsc = {}
 
     dsc_file = utils.open_file(filename)
@@ -290,7 +290,7 @@ def read_changes_or_dsc (filename):
 
     for k in dsc.keys():
         if k in ("build-depends","build-depends-indep"):
-            dsc[k] = create_depends_string(split_depends(dsc[k]))
+            dsc[k] = create_depends_string(suite, split_depends(dsc[k]))
         elif k == "architecture":
             if (dsc["architecture"] != "any"):
                 dsc['architecture'] = colour_output(dsc["architecture"], 'arch')
@@ -307,10 +307,13 @@ def read_changes_or_dsc (filename):
     filecontents = '\n'.join(map(lambda x: format_field(x,dsc[x.lower()]), keysinorder))+'\n'
     return filecontents
 
-def create_depends_string (depends_tree):
-    # just look up unstable for now. possibly pull from .changes later
-    suite = "unstable"
+def create_depends_string (suite, depends_tree):
     result = ""
+    if suite == 'experimental':
+        suite_where = " in ('experimental','unstable')"
+    else:
+        suite_where = " ='%s'" % suite
+
     comma_count = 1
     for l in depends_tree:
         if (comma_count >= 2):
@@ -321,7 +324,7 @@ def create_depends_string (depends_tree):
                 result += " | "
             # doesn't do version lookup yet.
 
-            q = projectB.query("SELECT DISTINCT(b.package), b.version, c.name, su.suite_name FROM  binaries b, files fi, location l, component c, bin_associations ba, suite su WHERE b.package='%s' AND b.file = fi.id AND fi.location = l.id AND l.component = c.id AND ba.bin=b.id AND ba.suite = su.id AND su.suite_name='%s' ORDER BY b.version desc" % (d['name'], suite))
+            q = projectB.query("SELECT DISTINCT(b.package), b.version, c.name, su.suite_name FROM  binaries b, files fi, location l, component c, bin_associations ba, suite su WHERE b.package='%s' AND b.file = fi.id AND fi.location = l.id AND l.component = c.id AND ba.bin=b.id AND ba.suite = su.id AND su.suite_name %s ORDER BY b.version desc" % (d['name'], suite_where))
             ql = q.getresult()
             if ql:
                 i = ql[0]
@@ -345,7 +348,7 @@ def create_depends_string (depends_tree):
         comma_count += 1
     return result
 
-def output_deb_info(filename):
+def output_deb_info(suite, filename):
     (control, control_keys, section, depends, recommends, arch, maintainer) = read_control(filename)
 
     if control == '':
@@ -353,9 +356,9 @@ def output_deb_info(filename):
     to_print = ""
     for key in control_keys :
         if key == 'Depends':
-            field_value = create_depends_string(depends)
+            field_value = create_depends_string(suite, depends)
         elif key == 'Recommends':
-            field_value = create_depends_string(recommends)
+            field_value = create_depends_string(suite, recommends)
         elif key == 'Section':
             field_value = section
         elif key == 'Architecture':
@@ -411,12 +414,12 @@ def get_copyright (deb_filename):
         printed_copyrights[copyrightmd5] = "%s (%s)" % (package, deb_filename)
     return res+formatted_text(cright)
 
-def check_dsc (dsc_filename):
-    (dsc) = read_changes_or_dsc(dsc_filename)
+def check_dsc (suite, dsc_filename):
+    (dsc) = read_changes_or_dsc(suite, dsc_filename)
     foldable_output(dsc_filename, "dsc", dsc, norow=True)
     foldable_output("lintian check for %s" % dsc_filename, "source-lintian", do_lintian(dsc_filename))
 
-def check_deb (deb_filename):
+def check_deb (suite, deb_filename):
     filename = os.path.basename(deb_filename)
     packagename = filename.split('_')[0]
 
@@ -427,7 +430,7 @@ def check_deb (deb_filename):
 
 
     foldable_output("control file for %s" % (filename), "binary-%s-control"%packagename,
-                    output_deb_info(deb_filename), norow=True)
+                    output_deb_info(suite, deb_filename), norow=True)
 
     if is_a_udeb:
         foldable_output("skipping lintian check for udeb", "binary-%s-lintian"%packagename,
@@ -477,20 +480,20 @@ def strip_pgp_signature (filename):
     file.close()
     return contents
 
-def display_changes(changes_filename):
-    changes = read_changes_or_dsc(changes_filename)
+def display_changes(suite, changes_filename):
+    changes = read_changes_or_dsc(suite, changes_filename)
     foldable_output(changes_filename, "changes", changes, norow=True)
 
 def check_changes (changes_filename):
-    display_changes(changes_filename)
-
     changes = utils.parse_changes (changes_filename)
+    display_changes(changes['distribution'], changes_filename)
+
     files = utils.build_file_list(changes)
     for f in files.keys():
         if f.endswith(".deb") or f.endswith(".udeb"):
-            check_deb(f)
+            check_deb(changes['distribution'], f)
         if f.endswith(".dsc"):
-            check_dsc(f)
+            check_dsc(changes['distribution'], f)
         # else: => byhand
 
 def main ():
@@ -524,9 +527,11 @@ def main ():
                 if f.endswith(".changes"):
                     check_changes(f)
                 elif f.endswith(".deb") or f.endswith(".udeb"):
-                    check_deb(file)
+                    # default to unstable when we don't have a .changes file
+                    # perhaps this should be a command line option?
+                    check_deb('unstable', file)
                 elif f.endswith(".dsc"):
-                    check_dsc(f)
+                    check_dsc('unstable', f)
                 else:
                     utils.fubar("Unrecognised file type: '%s'." % (f))
             finally:
index 0b9ff9231d72c397115292944efe94c7fe529f91..e45dd8b2a47abd2f121abc3172fdca5973c0d721 100755 (executable)
@@ -493,15 +493,16 @@ def check_pkg ():
         stdout_fd = sys.stdout
         try:
             sys.stdout = less_fd
-            examine_package.display_changes(Upload.pkg.changes_file)
+            changes = utils.parse_changes (Upload.pkg.changes_file)
+            examine_package.display_changes(changes['distribution'], Upload.pkg.changes_file)
             files = Upload.pkg.files
             for f in files.keys():
                 if files[f].has_key("new"):
                     ftype = files[f]["type"]
                     if ftype == "deb":
-                        examine_package.check_deb(f)
+                        examine_package.check_deb(changes['distribution'], f)
                     elif ftype == "dsc":
-                        examine_package.check_dsc(f)
+                        examine_package.check_dsc(changes['distribution'], f)
         finally:
             sys.stdout = stdout_fd
     except IOError, e:
index 4b485f2669ad7e0a642ff2d3712809f5a7b4b79f..f650f9aa03aae6271eee09fb6f8c42c6c296f603 100755 (executable)
@@ -147,7 +147,7 @@ def do_pkg(changes_file):
     changes = Upload.pkg.changes
 
     changes["suite"] = copy.copy(changes["distribution"])
-
+    distribution = changes["distribution"].keys()[0]
     # Find out what's new
     new = queue.determine_new(changes, files, projectB, 0)
 
@@ -169,12 +169,12 @@ def do_pkg(changes_file):
         html_header(changes["source"], filestoexamine)
 
         queue.check_valid(new)
-        examine_package.display_changes(Upload.pkg.changes_file)
+        examine_package.display_changes( distribution, Upload.pkg.changes_file)
 
         for fn in filter(lambda fn: fn.endswith(".dsc"), filestoexamine):
-            examine_package.check_dsc(fn)
+            examine_package.check_dsc(distribution, fn)
         for fn in filter(lambda fn: fn.endswith(".deb") or fn.endswith(".udeb"), filestoexamine):
-            examine_package.check_deb(fn)
+            examine_package.check_deb(distribution, fn)
 
         html_footer()
         if sys.stdout != stdout_fd:
index 7d89e6bfeb8871bd7eb1423b21f52506085dd126..ee1e50f8a953acae389c5fb2ef41c386ae66b4ae 100755 (executable)
@@ -36,7 +36,7 @@ from daklib import utils
 
 Cnf = None
 projectB = None
-required_database_schema = 2
+required_database_schema = 4
 
 ################################################################################
 
index 47c80f3c137975468569f7b8cb354688448edfce..a50a840f22b573dc08fd6710109d443de91dd41a 100755 (executable)
@@ -26,6 +26,7 @@ import codecs, commands, email.Header, os, pwd, re, select, socket, shutil, \
        sys, tempfile, traceback, stat
 import apt_pkg
 import database
+import time
 from dak_exceptions import *
 
 ################################################################################
@@ -1231,11 +1232,22 @@ used."""
     if keywords.has_key("NODATA"):
         reject("no signature found in %s." % (sig_filename))
         bad = 1
+    if keywords.has_key("EXPKEYSIG"):
+        args = keywords["EXPKEYSIG"]
+        if len(args) >= 1:
+            key = args[0]
+        reject("Signature made by expired key 0x%s" % (key))
+        bad = 1
     if keywords.has_key("KEYEXPIRED") and not keywords.has_key("GOODSIG"):
         args = keywords["KEYEXPIRED"]
+        expiredate=""
         if len(args) >= 1:
-            key = args[0]
-        reject("The key (0x%s) used to sign %s has expired." % (key, sig_filename))
+            timestamp = args[0]
+            if timestamp.count("T") == 0:
+                expiredate = time.strftime("%Y-%m-%d", time.gmtime(timestamp))
+            else:
+                expiredate = timestamp
+        reject("The key used to sign %s has expired on %s" % (sig_filename, expiredate))
         bad = 1
 
     if bad:
diff --git a/scripts/debian/moveftp.sh b/scripts/debian/moveftp.sh
new file mode 100755 (executable)
index 0000000..6aecc28
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+set -e
+set -u
+
+FTPDIR="/org/upload.debian.org/ftp/pub/UploadQueue/"
+SSHDIR="/org/upload.debian.org/UploadQueue/"
+
+yes n | find ${FTPDIR} -type f -mmin +15 -print0 -exec mv -i --target-directory=${SSHDIR} "{}" +
diff --git a/src/Makefile b/src/Makefile
deleted file mode 100644 (file)
index 206f320..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/usr/bin/make -f
-
-CXXFLAGS       = -I/usr/include/postgresql/ -I`pg_config --includedir-server` -fPIC -Wall
-CFLAGS         = -fFIC -Wall `pg_config --cflags`
-LDFLAGS                = `pg_config --ldflags`
-LIBS           = -lapt-pkg `pg_config --libs`
-
-C++            = g++
-
-all: sql-aptvc.so
-
-sql-aptvc.o: sql-aptvc.cpp
-sql-aptvc.so: sql-aptvc.o
-       $(CC) $(LDFLAGS) $(LIBS) -shared -o $@ $<
-clean:
-       rm -f sql-aptvc.so sql-aptvc.o
-
diff --git a/src/sql-aptvc.cpp b/src/sql-aptvc.cpp
deleted file mode 100644 (file)
index a9c3e53..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/* Wrapper round apt's version compare functions for PostgreSQL. */
-/* Copyright (C) 2001, James Troup <james@nocrew.org> */
-
-/* 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 
- */
-
-/* NB: do not try to use the VERSION-1 calling conventions for
-   C-Language functions; it works on i386 but segfaults the postgres
-   child backend on Sparc. */
-
-#include <apt-pkg/debversion.h>
-
-extern "C"
-{
-
-#include <postgres.h>
-#include <fmgr.h>
-
-#ifdef PG_MODULE_MAGIC
-PG_MODULE_MAGIC;
-#endif
-
-  int versioncmp(text *A, text *B);
-
-  int
-  versioncmp (text *A, text *B)
-  {
-    int result, txt_size;
-    char *a, *b;
-
-    txt_size = VARSIZE(A)-VARHDRSZ;
-    a = (char *) palloc(txt_size+1);
-    memcpy(a, VARDATA(A), txt_size);
-    a[txt_size] = '\0';
-
-    txt_size = VARSIZE(B)-VARHDRSZ;
-    b = (char *) palloc(txt_size+1);
-    memcpy(b, VARDATA(B), txt_size);
-    b[txt_size] = '\0';
-
-    result = debVS.CmpVersion (a, b);
-
-    pfree (a);
-    pfree (b);
-
-    return (result);
-  }
-
-}