dumps, using a scheme to keep more of the recent dumps.
* config/debian/cron.daily: Use the new script. Also - compress
- all files older than 7 days, instead of 30.
+ all files older than 7 days, instead of 30.
* dak/process_accepted.py (install): Do not break if a
source/maintainer combination is already in src_uploaders, "just"
changes[architecture] has source included.
(check_transition): Now call the database.get_testing_version
+2008-02-09 Christoph Berg <myon@debian.org>
+
+ * daklib/queue.py (get_type): fubar does not exist in global
+ namespace.
+
+ * setup/add_constraints.sql setup/init_pool.sql: Add changedby column
+ to source table, and move src_uploaders after source so the REFERNCES
+ clause works.
+ * dak/process_accepted.py (install): Fill the changedby column from
+ the information found in the .changes. This will allow to identify
+ NMUs and sponsored uploads more precisely in tools querying projectb.
+ * scripts/debian/insert_missing_changedby.py: Script to import yet
+ missing fields from filippo's uploads-history DB.
+
2008-02-06 Joerg Jaspert <joerg@debian.org>
* daklib/utils.py (check_signature): Make variable key available,
q = projectB.query("""
SELECT m.id FROM maintainer m
WHERE NOT EXISTS (SELECT 1 FROM binaries b WHERE b.maintainer = m.id)
- AND NOT EXISTS (SELECT 1 FROM source s WHERE s.maintainer = m.id)
+ AND NOT EXISTS (SELECT 1 FROM source s WHERE s.maintainer = m.id OR s.changedby = m.id)
AND NOT EXISTS (SELECT 1 FROM src_uploaders u WHERE u.maintainer = m.id)""")
ql = q.getresult()
maintainer = dsc["maintainer"]
maintainer = maintainer.replace("'", "\\'")
maintainer_id = daklib.database.get_or_set_maintainer_id(maintainer)
+ changedby = changes["changed-by"]
+ changedby = changedby.replace("'", "\\'")
+ changedby_id = daklib.database.get_or_set_maintainer_id(changedby)
fingerprint_id = daklib.database.get_or_set_fingerprint_id(dsc["fingerprint"])
install_date = time.strftime("%Y-%m-%d")
filename = files[file]["pool name"] + file
dsc_location_id = files[file]["location id"]
if not files[file].has_key("files id") or not files[file]["files id"]:
files[file]["files id"] = daklib.database.set_files_id (filename, files[file]["size"], files[file]["md5sum"], dsc_location_id)
- projectB.query("INSERT INTO source (source, version, maintainer, file, install_date, sig_fpr) VALUES ('%s', '%s', %d, %d, '%s', %s)"
- % (package, version, maintainer_id, files[file]["files id"], install_date, fingerprint_id))
+ projectB.query("INSERT INTO source (source, version, maintainer, changedby, file, install_date, sig_fpr) VALUES ('%s', '%s', %d, %d, %d, '%s', %s)"
+ % (package, version, maintainer_id, changedby_id, files[file]["files id"], install_date, fingerprint_id))
for suite in changes["distribution"].keys():
suite_id = daklib.database.get_suite_id(suite)
elif f["type"] in [ "orig.tar.gz", "orig.tar.bz2", "tar.gz", "tar.bz2", "diff.gz", "diff.bz2", "dsc" ]:
type = "dsc"
else:
- fubar("invalid type (%s) for new. Dazed, confused and sure as heck not continuing." % (type))
+ utils.fubar("invalid type (%s) for new. Dazed, confused and sure as heck not continuing." % (type))
# Validate the override type
type_id = database.get_override_type_id(type)
if type_id == -1:
- fubar("invalid type (%s) for new. Say wha?" % (type))
+ utils.fubar("invalid type (%s) for new. Say wha?" % (type))
return type
--- /dev/null
+#!/usr/bin/env python
+
+# Adds yet unknown changedby fields when this column is added to an existing
+# database. If everything goes well, it needs to be run only once. Data is
+# extracted from Filippo Giunchedi's upload-history project, get the file at
+# merkel:/home/filippo/upload-history/*.db.
+
+# Copyright (C) 2008 Christoph Berg <myon@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
+
+###############################################################################
+
+# /Everybody stand back/
+#
+# I know regular expressions
+
+###############################################################################
+
+import errno, fcntl, os, sys, time, re
+import apt_pkg
+import daklib.database
+import daklib.queue
+import daklib.utils
+from pysqlite2 import dbapi2 as sqlite
+
+projectB = None
+DBNAME = "uploads-ddc.db"
+sqliteConn = None
+
+###############################################################################
+
+def insert ():
+ print "Adding missing changedby fields."
+
+ projectB.query("BEGIN WORK")
+
+ q = projectB.query("SELECT id, source, version FROM source WHERE changedby IS NULL")
+
+ for i in q.getresult():
+ print i[1] + "/" + i[2] + ":",
+
+ cur = sqliteConn.cursor()
+ cur.execute("SELECT changedby FROM uploads WHERE package = '%s' AND version = '%s' LIMIT 1" % (i[1], i[2]))
+ res = cur.fetchall()
+ if len(res) != 1:
+ print "nothing found"
+ continue
+
+ changedby = res[0][0].replace("'", "\\'")
+ changedby_id = daklib.database.get_or_set_maintainer_id(changedby)
+
+ projectB.query("UPDATE source SET changedby = %d WHERE id = %d" % (changedby_id, i[0]))
+ print changedby, "(%d)" % changedby_id
+
+ projectB.query("COMMIT WORK")
+
+###############################################################################
+
+def main():
+ global projectB, sqliteConn
+
+ Cnf = daklib.utils.get_conf()
+ Upload = daklib.queue.Upload(Cnf)
+ projectB = Upload.projectB
+
+ sqliteConn = sqlite.connect(DBNAME)
+
+ insert()
+
+###############################################################################
+
+if __name__ == '__main__':
+ main()
ALTER TABLE files ADD CONSTRAINT files_location FOREIGN KEY (location) REFERENCES location(id) MATCH FULL;
ALTER TABLE source ADD CONSTRAINT source_maintainer FOREIGN KEY (maintainer) REFERENCES maintainer(id) MATCH FULL;
+ALTER TABLE source ADD CONSTRAINT source_changedby FOREIGN KEY (changedby) REFERENCES maintainer(id) MATCH FULL;
ALTER TABLE source ADD CONSTRAINT source_file FOREIGN KEY (file) REFERENCES files(id) MATCH FULL;
ALTER TABLE source ADD CONSTRAINT source_sig_fpr FOREIGN KEY (sig_fpr) REFERENCES fingerprint(id) MATCH FULL;
name TEXT UNIQUE NOT NULL
);
-CREATE TABLE src_uploaders (
- id SERIAL PRIMARY KEY,
- source INT4 NOT NULL REFERENCES source,
- maintainer INT4 NOT NULL REFERENCES maintainer
-);
-
CREATE TABLE uid (
id SERIAL PRIMARY KEY,
uid TEXT UNIQUE NOT NULL,
source TEXT NOT NULL,
version TEXT NOT NULL,
maintainer INT4 NOT NULL, -- REFERENCES maintainer
+ changedby INT4 NOT NULL, -- REFERENCES maintainer
file INT4 UNIQUE NOT NULL, -- REFERENCES files
install_date TIMESTAMP NOT NULL,
sig_fpr INT4 NOT NULL, -- REFERENCES fingerprint
unique (source, version)
);
+CREATE TABLE src_uploaders (
+ id SERIAL PRIMARY KEY,
+ source INT4 NOT NULL REFERENCES source,
+ maintainer INT4 NOT NULL REFERENCES maintainer
+);
+
CREATE TABLE dsc_files (
id SERIAL PRIMARY KEY,
source INT4 NOT NULL, -- REFERENCES source,