[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[dak/master] Various



Fix a number of epydoc errors we had.
Make dakdb/ have a much nicer looking api doc :)

Signed-off-by: Joerg Jaspert <joerg@debian.org>
---
 dak/dakdb/__init__.py    |   33 +++++++++++++++++++++++++++++++++
 dak/dakdb/update1.py     |    9 +++++++--
 dak/dakdb/update2.py     |   11 ++++++++---
 dak/dakdb/update3.py     |   11 ++++++++---
 dak/dakdb/update4.py     |    2 +-
 dak/dakdb/update5.py     |    2 +-
 dak/dakdb/update6.py     |    9 +++++----
 dak/dakdb/update7.py     |   10 ++++++----
 dak/dakdb/update8.py     |    9 +++++----
 dak/dakdb/update9.py     |    9 +++++----
 dak/process_accepted.py  |   10 ++++++++--
 dak/process_unchecked.py |    4 ++--
 daklib/binary.py         |   17 ++++++++---------
 daklib/dbconn.py         |   12 ++++++------
 14 files changed, 103 insertions(+), 45 deletions(-)
 mode change 100644 => 100755 dak/dakdb/update4.py
 mode change 100644 => 100755 dak/dakdb/update6.py
 mode change 100644 => 100755 dak/dakdb/update9.py

diff --git a/dak/dakdb/__init__.py b/dak/dakdb/__init__.py
index e69de29..a35616d 100644
--- a/dak/dakdb/__init__.py
+++ b/dak/dakdb/__init__.py
@@ -0,0 +1,33 @@
+"""
+Database update scripts for usage with B{dak update-db}
+
+@contact: Debian FTP Master <ftpmaster@debian.org>
+@copyright: 2008  Michael Casadevall <mcasadevall@debian.org>
+@license: GNU General Public License version 2 or later
+
+Update scripts have to C{import psycopg2} and
+C{from daklib.dak_exceptions import DBUpdateError}.
+
+There has to be B{at least} the function C{do_update(self)} to be
+defined. It should take all neccessary steps to update the
+database. If the update fails the changes have to be rolled back and the
+C{DBUpdateError} exception raised to properly halt the execution of any
+other update.
+
+Example::
+ def do_update(self):
+     print "Doing something"
+
+     try:
+         c = self.db.cursor()
+         c.execute("SOME SQL STATEMENT")
+         self.db.commit()
+
+     except psycopg2.ProgrammingError, msg:
+         self.db.rollback()
+         raise DBUpdateError, "Unable to do whatever, rollback issued. Error message : %s" % (str(msg))
+
+This function can do whatever it wants and use everything from dak and
+daklib.
+
+"""
diff --git a/dak/dakdb/update1.py b/dak/dakdb/update1.py
index 92fc449..0c83377 100755
--- a/dak/dakdb/update1.py
+++ b/dak/dakdb/update1.py
@@ -1,7 +1,12 @@
 #!/usr/bin/env python
 
-""" Database Update Script - Saner DM db schema """
-# Copyright (C) 2008  Michael Casadevall <mcasadevall@debian.org>
+"""
+Saner DM db schema
+
+@contact: Debian FTP Master <ftpmaster@debian.org>
+@copyright: 2008  Michael Casadevall <mcasadevall@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
diff --git a/dak/dakdb/update2.py b/dak/dakdb/update2.py
index 850e3ab..2e3cb44 100755
--- a/dak/dakdb/update2.py
+++ b/dak/dakdb/update2.py
@@ -1,9 +1,14 @@
 #!/usr/bin/env python
 # coding=utf8
 
-""" Database Update Script - debversion """
-# Copyright © 2008  Michael Casadevall <mcasadevall@debian.org>
-# Copyright © 2008  Roger Leigh <rleigh@debian.org>
+"""
+debversion
+
+@contact: Debian FTP Master <ftpmaster@debian.org>
+@copyright: 2008  Michael Casadevall <mcasadevall@debian.org>
+@copyright: 2008  Roger Leigh <rleigh@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
diff --git a/dak/dakdb/update3.py b/dak/dakdb/update3.py
index eef7d4c..c91ecf5 100755
--- a/dak/dakdb/update3.py
+++ b/dak/dakdb/update3.py
@@ -1,8 +1,13 @@
 #!/usr/bin/env python
 
-""" Database Update Script - Remove unused versioncmp """
-# Copyright (C) 2008  Michael Casadevall <mcasadevall@debian.org>
-# Copyright (C) 2009  Joerg Jaspert <joerg@debian.org>
+"""
+Remove unused versioncmp
+
+@contact: Debian FTP Master <ftpmaster@debian.org>
+@copyright: 2008  Michael Casadevall <mcasadevall@debian.org>
+@copyright: 2009  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
diff --git a/dak/dakdb/update4.py b/dak/dakdb/update4.py
old mode 100644
new mode 100755
index 1a9d9c3..477944c
--- a/dak/dakdb/update4.py
+++ b/dak/dakdb/update4.py
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 """
-Database Update Script - Get suite_architectures table use sane values
+Get suite_architectures table use sane values
 
 @contact: Debian FTP Master <ftpmaster@debian.org>
 @copyright: 2009  Joerg Jaspert <joerg@debian.org>
diff --git a/dak/dakdb/update5.py b/dak/dakdb/update5.py
index 1d820de..beb961c 100755
--- a/dak/dakdb/update5.py
+++ b/dak/dakdb/update5.py
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 
 """
-Database Update Script - Fix bin_assoc_by_arch view
+Fix bin_assoc_by_arch view
 
 @contact: Debian FTP Master <ftpmaster@debian.org>
 @copyright: 2009  Joerg Jaspert <joerg@debian.org>
diff --git a/dak/dakdb/update6.py b/dak/dakdb/update6.py
old mode 100644
new mode 100755
index 4537579..c7b0b17
--- a/dak/dakdb/update6.py
+++ b/dak/dakdb/update6.py
@@ -2,11 +2,12 @@
 # coding=utf8
 
 """
-Debian Archive Kit Database Update Script
-Copyright © 2008  Michael Casadevall <mcasadevall@debian.org>
-Copyright © 2008  Roger Leigh <rleigh@debian.org>
+Adding content fields
 
-Debian Archive Kit Database Update Script 2
+@contact: Debian FTP Master <ftpmaster@debian.org>
+@copyright: 2008  Michael Casadevall <mcasadevall@debian.org>
+@copyright: 2008  Roger Leigh <rleigh@debian.org>
+@license: GNU General Public License version 2 or later
 """
 
 # This program is free software; you can redistribute it and/or modify
diff --git a/dak/dakdb/update7.py b/dak/dakdb/update7.py
index c882853..6f91eb3 100755
--- a/dak/dakdb/update7.py
+++ b/dak/dakdb/update7.py
@@ -2,11 +2,13 @@
 # coding=utf8
 
 """
-Debian Archive Kit Database Update Script
-Copyright © 2008  Michael Casadevall <mcasadevall@debian.org>
-Copyright © 2009  Joerg Jaspert <joerg@debian.org>
+Moving suite config into DB
+
+@contact: Debian FTP Master <ftpmaster@debian.org>
+@copyright: 2008  Michael Casadevall <mcasadevall@debian.org>
+@copyright: 2009  Joerg Jaspert <joerg@debian.org>
+@license: GNU General Public License version 2 or later
 
-Debian Archive Kit Database Update Script 7
 """
 
 # This program is free software; you can redistribute it and/or modify
diff --git a/dak/dakdb/update8.py b/dak/dakdb/update8.py
index fc505f7..2f92c4d 100755
--- a/dak/dakdb/update8.py
+++ b/dak/dakdb/update8.py
@@ -2,11 +2,12 @@
 # coding=utf8
 
 """
-Debian Archive Kit Database Update Script
-Copyright © 2008  Michael Casadevall <mcasadevall@debian.org>
-Copyright © 2009  Joerg Jaspert <joerg@debian.org>
+More suite config into the DB
 
-Debian Archive Kit Database Update Script 8
+@contact: Debian FTP Master <ftpmaster@debian.org>
+@copyright: 2008  Michael Casadevall <mcasadevall@debian.org>
+@copyright: 2009  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
diff --git a/dak/dakdb/update9.py b/dak/dakdb/update9.py
old mode 100644
new mode 100755
index 0978577..2ca3c51
--- a/dak/dakdb/update9.py
+++ b/dak/dakdb/update9.py
@@ -2,11 +2,12 @@
 # coding=utf8
 
 """
-Debian Archive Kit Database Update Script
-Copyright © 2008  Michael Casadevall <mcasadevall@debian.org>
-Copyright © 2009  Mike O'Connor <stew@debian.org>
+Pending contents disinguished by arch
 
-Debian Archive Kit Database Update Script 8
+@contact: Debian FTP Master <ftpmaster@debian.org>
+@copyright: 2008  Michael Casadevall <mcasadevall@debian.org>
+@copyright: 2009  Mike O'Connor <stew@debian.org>
+@license: GNU General Public License version 2 or later
 """
 
 # This program is free software; you can redistribute it and/or modify
diff --git a/dak/process_accepted.py b/dak/process_accepted.py
index e55ac54..360bea9 100755
--- a/dak/process_accepted.py
+++ b/dak/process_accepted.py
@@ -1,8 +1,14 @@
 #!/usr/bin/env python
 
-""" Installs Debian packages from queue/accepted into the pool """
-# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2006  James Troup <james@nocrew.org>
+"""
+Installs Debian packages from queue/accepted into the pool
 
+@contact: Debian FTP Master <ftpmaster@debian.org>
+@copyright: 2000, 2001, 2002, 2003, 2004, 2006  James Troup <james@nocrew.org>
+@copyright: 2009  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
 # the Free Software Foundation; either version 2 of the License, or
diff --git a/dak/process_unchecked.py b/dak/process_unchecked.py
index b2097de..9301497 100755
--- a/dak/process_unchecked.py
+++ b/dak/process_unchecked.py
@@ -1003,10 +1003,10 @@ def lookup_uid_from_fingerprint(fpr):
     """
     Return the uid,name,isdm for a given gpg fingerprint
 
-    @ptype fpr: string
+    @type fpr: string
     @param fpr: a 40 byte GPG fingerprint
 
-    @return (uid, name, isdm)
+    @return: (uid, name, isdm)
     """
     cursor = DBConn().cursor()
     cursor.execute( "SELECT u.uid, u.name, k.debian_maintainer FROM fingerprint f JOIN keyrings k ON (f.keyring=k.id), uid u WHERE f.uid = u.id AND f.fingerprint = '%s'" % (fpr))
diff --git a/daklib/binary.py b/daklib/binary.py
index 88d7876..bd7f1cc 100755
--- a/daklib/binary.py
+++ b/daklib/binary.py
@@ -56,10 +56,10 @@ import utils
 class Binary(object):
     def __init__(self, filename, reject=None):
         """
-        @ptype filename: string
+        @type filename: string
         @param filename: path of a .deb
 
-        @ptype reject: function
+        @type reject: function
         @param reject: a function to log reject messages to
         """
         self.filename = filename
@@ -165,12 +165,12 @@ class Binary(object):
         the hopefully near future, it should also include gathering info from the
         control file.
 
-        @ptype bootstrap_id: int
+        @type bootstrap_id: int
         @param bootstrap_id: the id of the binary these packages
           should be associated or zero meaning we are not bootstrapping
           so insert into a temporary table
 
-        @return True if the deb is valid and contents were imported
+        @return: True if the deb is valid and contents were imported
         """
         result = False
         rejected = not self.valid_deb(relaxed)
@@ -212,12 +212,11 @@ class Binary(object):
         the hopefully near future, it should also include gathering info from the
         control file.
 
-        @ptype bootstrap_id: int
-        @param bootstrap_id: the id of the binary these packages
-          should be associated or zero meaning we are not bootstrapping
-          so insert into a temporary table
+        @type package: string
+        @param package: the name of the package to be checked
 
-        @return True if the deb is valid and contents were imported
+        @rtype: boolean
+        @return: True if the deb is valid and contents were imported
         """
         rejected = not self.valid_deb(True)
         self.__unpack()
diff --git a/daklib/dbconn.py b/daklib/dbconn.py
index b532c35..9770cf8 100755
--- a/daklib/dbconn.py
+++ b/daklib/dbconn.py
@@ -203,8 +203,8 @@ class DBConn(Singleton):
         Returns database id for given override C{type}.
         Results are kept in a cache during runtime to minimize database queries.
 
-        @type type: string
-        @param type: The name of the override type
+        @type override_type: string
+        @param override_type: The name of the override type
 
         @rtype: int
         @return: the database id for the given override type
@@ -500,10 +500,10 @@ class DBConn(Singleton):
 
         @type bin_id: int
         @param bin_id: the id of the binary
-        @type fullpath: string
-        @param fullpath: the path of the file being associated with the binary
+        @type fullpaths: list
+        @param fullpaths: the list of paths of the file being associated with the binary
 
-        @return True upon success
+        @return: True upon success
         """
 
         c = self.db_con.cursor()
@@ -539,7 +539,7 @@ class DBConn(Singleton):
         @type fullpaths: list
         @param fullpaths: the list of paths of the file being associated with the binary
 
-        @return True upon success
+        @return: True upon success
         """
 
         c = self.db_con.cursor()
-- 
1.5.6.5


Reply to: