fedora-accounts bz-make-components-pkgdb.py, 1.3, 1.4 bz-make-components.py, 1.14, 1.15 export-bugzilla.py, 1.8, 1.9 json.py, 1.1, 1.2 run-make-components.sh, 1.4, 1.5 website.py, 1.11, 1.12
Toshio Ernie Kuratomi (toshio)
fedora-extras-commits at redhat.com
Thu Aug 9 03:31:13 UTC 2007
Author: toshio
Update of /cvs/fedora/fedora-accounts
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv18769
Modified Files:
bz-make-components-pkgdb.py bz-make-components.py
export-bugzilla.py json.py run-make-components.sh website.py
Log Message:
bz-make-components-pkgdb.py: Update to use all xmlrpc for modifying the db and commit some fixes that weren't committed from before.
Other files contain small, accumulated fixes.
Index: bz-make-components-pkgdb.py
===================================================================
RCS file: /cvs/fedora/fedora-accounts/bz-make-components-pkgdb.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- bz-make-components-pkgdb.py 8 Aug 2007 20:17:33 -0000 1.3
+++ bz-make-components-pkgdb.py 9 Aug 2007 03:31:11 -0000 1.4
@@ -13,8 +13,8 @@
# Set this to the production bugzilla account when we're ready to go live
BZSERVER = 'https://bugdev.devel.redhat.com/bugzilla-cvs/xmlrpc.cgi'
-#BZSERVER = 'https://bugzilla.redhat.com/bugzilla/xmlrpc.cgi'
BZDBHOST='bugdev'
+#BZSERVER = 'https://bugzilla.redhat.com/bugzilla/xmlrpc.cgi'
#BZDBHOST='bugs'
BZUSER=''
BZPASS=''
@@ -101,6 +101,15 @@
qacontact=None, cclist=None):
'''Add or update a component to have the values specified.
'''
+ # Turn the cclist into something usable by bugzilla
+ if not cclist or 'people' not in cclist:
+ initialCCList = list()
+ else:
+ initialCCList = []
+ for ccMember in cclist['people']:
+ ccEmail = self._get_bugzilla_email(ccMember)
+ initialCCList.append(ccEmail)
+
# Lookup product
try:
product = self.productCache[collection]
@@ -156,14 +165,24 @@
qacontact or product[pkgKey]['initialqacontact']):
data['initialqacontact'] = qacontact
+ ### FIXME: Currently no xmlrpc function to tell what the current
+ # cclist is so we end up having to set this for every package.
+ # When we can retrieve cclist via bugzilla.getProdCompDetails()
+ # we can make this more sensible.
+ data['initialcclist'] = initialCCList
+
if data:
+ ### FIXME: initialowner has been made mandatory for some
+ # reason. Asking dkl why.
+ data['initialowner'] = owner
+
# Changes occurred. Submit a request to change via xmlrpc
data['product'] = collection
data['component'] = product[pkgKey]['component']
if DRY_RUN:
print '[EDITCOMP] Changing via editComponent(%s, %s, "xxxxx")' % (
data, self.username)
- print '[EDITCMP] Former values: %s|%s|%s' % (
+ print '[EDITCOMP] Former values: %s|%s|%s' % (
product[pkgKey]['initialowner'],
product[pkgKey]['description'],
product[pkgKey]['initialqacontact'])
@@ -173,72 +192,35 @@
self.password)
except xmlrpclib.Fault, e:
# Output something useful in args
- e.args = (faultCode, faultString)
+ e.args = (data, e.faultCode, e.faultString)
raise
- ### FIXME: Check for changes to cclist
- # We're going to wait on the xmlrpc interface returning cclist
-
- # Update the cclist
-
- # Get the component id
- self.bzdbc.execute("select c.id" \
- " from components as c, products as p" \
- " where p.name = %s and c.name = %s" \
- " and p.id = c.product_id", (collection, package))
- if not self.bzdbc.rowcount:
- raise DataChangedError, 'Package %s disappeared from collection %s during processing' % (package, collection)
- pkgId = self.bzdbc.fetchone()[0]
-
- # Turn all cclist members into bugzilla ids
- bzCclist = []
- for watcher in cclist['people']:
- bzCclist.append(self._get_bugzilla_user_id(watcher))
- ### FIXME: In the future, handle groups as well
-
- # Update the cclist in the database
- if DRY_RUN:
- print "[CCLIST] update components set initialcclist = '%s'" \
- " where id = '%s'" % (':'.join(map(str, bzCclist)),
- pkgId)
- else:
- self.bzdbc.execute("update components set initialcclist = %s" \
- " where id = %s", (':'.join(map(str, bzCclist)), pkgId))
- self.bzdbh.commit()
else:
# Add component
-
- # Get the product id
- self.bzdbc.execute("select id from products where name = %s", (collection,))
- if not self.bzdbc.rowcount:
- raise DataChangedError, 'Collection %s disappeared from the database during processing' % (collection,)
- collectionId = self.bzdbc.fetchone()[0]
-
- # Retrieve bugzilla ids for all the fas usernames
- ownerId = self._get_bugzilla_user_id(owner)
+ owner = self._get_bugzilla_email(owner).lower()
if qacontact:
- qacontactId = self._get_bugzilla_user_id(qacontact)
+ qacontact = self._get_bugzilla_email(qacontact)
else:
- qacontactId = self._get_bugzilla_user_id('extras-qa at fedoraproject.org')
- bzCclist = []
- for watcher in cclist['people']:
- bzCclist.append(self._get_bugzilla_user_id(watcher))
- ### FIXME: Handle groups as well.
+ qacontact = 'extras-qa at fedoraproject.org'
+
+ data = {'product': collection,
+ 'component': package,
+ 'description': description,
+ 'initialowner': owner,
+ 'initialqacontact': qacontact}
+ if initialCCList:
+ data['initialcclist'] = initialCCList
- # Add the component
if DRY_RUN:
- print "[ADDCOMP] insert into components (name, product_id, description," \
- " initialowner, initialqacontact, initialcclist)" \
- " values (%s, %s, %s, %s, %s, %s)" % (package,
- collectionId, description, ownerId,
- qacontactId, ':'.join(map(str, bzCclist)))
+ print '[ADDCOMP] Adding new component AddComponent:(%s, %s, "xxxxx")' % (
+ data, self.username)
else:
- self.bzdbc.execute("insert into components" \
- " (name, product_id, description," \
- " initialowner, initialqacontact, initialcclist)" \
- " values (%s, %s, %s, %s, %s, %s)", (package,
- collectionId, description, ownerId,
- qacontactId, ':'.join(map(str, bzCclist))))
- self.bzdbh.commit()
+ try:
+ self.server.bugzilla.addComponent(data, self.username,
+ self.password)
+ except xmlrpclib.Fault, e:
+ # Output something useful in args
+ e.args = (data, e.faultCode, e.faultString)
+ raise
if __name__ == '__main__':
sys.stdout = codecs.getwriter('utf-8')(sys.stdout)
@@ -268,7 +250,6 @@
for product in acls.keys():
if product not in ('Fedora', 'Fedora OLPC', 'Fedora EPEL'):
continue
- output = file('outfile', 'w')
for pkg in acls[product]:
pkgInfo = acls[product][pkg]
try:
@@ -284,12 +265,12 @@
errors.append(str(e.args))
except xmlrpclib.Error, e:
# An error occurred in the xmlrpc call. Shouldn't happen but
- # we better se what it is
+ # we better see what it is
errors.append(str(e.args))
# Send notification of errors
if errors:
- print '[DEBUG]', '\n'.join(errors)
+ #print '[DEBUG]', '\n'.join(errors)
website.send_email('accounts at fedoraproject.org',
'toshio at fedoraproject.org',
'Errors while syncing bugzilla with the PackageDB',
Index: bz-make-components.py
===================================================================
RCS file: /cvs/fedora/fedora-accounts/bz-make-components.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- bz-make-components.py 2 Jul 2007 15:33:43 -0000 1.14
+++ bz-make-components.py 9 Aug 2007 03:31:11 -0000 1.15
@@ -121,6 +121,8 @@
print "Need an e-mail for", J
continue
print "Sending e-mail to", I
+ if DRY_RUN:
+ continue
website.send_email("accounts at fedora.redhat.com", I, "You need to create a bugzilla account for %s" % I, """
In order to make bugzilla components for Fedora-related programs, we need to have an existing bugzilla account for
the listed owner. You (%s) do not have a bugzilla account, but are listed as the owner for the following components:
Index: export-bugzilla.py
===================================================================
RCS file: /cvs/fedora/fedora-accounts/export-bugzilla.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- export-bugzilla.py 2 Jul 2007 15:36:23 -0000 1.8
+++ export-bugzilla.py 9 Aug 2007 03:31:11 -0000 1.9
@@ -112,7 +112,7 @@
bzdbc.execute("SELECT user_id FROM user_group_map WHERE user_id = %s AND group_id = %s", (bz_user_id, bz_group_id))
if not bzdbc.rowcount:
-# print "Adding membership for", user_email
+# print "Adding membership for", user_email, "in ", bz_group
bzdbc.execute("INSERT INTO user_group_map (user_id, group_id, isbless, isderived, grant_type) VALUES (%s, %s, 0, 0, %s)",
(bz_user_id, bz_group_id, GRANT_DIRECT))
checkme[bz_user_id] = user_email
Index: json.py
===================================================================
RCS file: /cvs/fedora/fedora-accounts/json.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- json.py 2 Jul 2007 17:17:50 -0000 1.1
+++ json.py 9 Aug 2007 03:31:11 -0000 1.2
@@ -21,23 +21,23 @@
class _StringGenerator(object):
- def __init__(self, string):
- self.string = string
- self.index = -1
- def peek(self):
- i = self.index + 1
- if i < len(self.string):
- return self.string[i]
- else:
- return None
- def next(self):
- self.index += 1
- if self.index < len(self.string):
- return self.string[self.index]
- else:
- raise StopIteration
- def all(self):
- return self.string
+ def __init__(self, string):
+ self.string = string
+ self.index = -1
+ def peek(self):
+ i = self.index + 1
+ if i < len(self.string):
+ return self.string[i]
+ else:
+ return None
+ def next(self):
+ self.index += 1
+ if self.index < len(self.string):
+ return self.string[self.index]
+ else:
+ raise StopIteration
+ def all(self):
+ return self.string
class WriteException(Exception):
pass
@@ -132,15 +132,15 @@
if ch in 'brnft':
ch = self.escapes[ch]
elif ch == "u":
- ch4096 = self._next()
- ch256 = self._next()
- ch16 = self._next()
- ch1 = self._next()
- n = 4096 * self._hexDigitToInt(ch4096)
- n += 256 * self._hexDigitToInt(ch256)
- n += 16 * self._hexDigitToInt(ch16)
- n += self._hexDigitToInt(ch1)
- ch = unichr(n)
+ ch4096 = self._next()
+ ch256 = self._next()
+ ch16 = self._next()
+ ch1 = self._next()
+ n = 4096 * self._hexDigitToInt(ch4096)
+ n += 256 * self._hexDigitToInt(ch256)
+ n += 16 * self._hexDigitToInt(ch16)
+ n += self._hexDigitToInt(ch1)
+ ch = unichr(n)
elif ch not in '"/\\':
raise ReadException, "Not a valid escaped JSON character: '%s' in %s" % (ch, self._generator.all())
result = result + ch
@@ -155,8 +155,8 @@
except KeyError:
try:
result = int(ch)
- except ValueError:
- raise ReadException, "The character %s is not a hex digit." % ch
+ except ValueError:
+ raise ReadException, "The character %s is not a hex digit." % ch
return result
def _readComment(self):
@@ -226,7 +226,7 @@
ch = self._next()
if ch != ",":
raise ReadException, "Not a valid JSON array: '%s' due to: '%s'" % (self._generator.all(), ch)
- assert self._next() == "}"
+ assert self._next() == "}"
return result
def _eatWhitespace(self):
@@ -279,15 +279,15 @@
self._append("]")
elif ty is types.StringType or ty is types.UnicodeType:
self._append('"')
- obj = obj.replace('\\', r'\\')
+ obj = obj.replace('\\', r'\\')
if self._escaped_forward_slash:
obj = obj.replace('/', r'\/')
- obj = obj.replace('"', r'\"')
- obj = obj.replace('\b', r'\b')
- obj = obj.replace('\f', r'\f')
- obj = obj.replace('\n', r'\n')
- obj = obj.replace('\r', r'\r')
- obj = obj.replace('\t', r'\t')
+ obj = obj.replace('"', r'\"')
+ obj = obj.replace('\b', r'\b')
+ obj = obj.replace('\f', r'\f')
+ obj = obj.replace('\n', r'\n')
+ obj = obj.replace('\r', r'\r')
+ obj = obj.replace('\t', r'\t')
self._append(obj)
self._append('"')
elif ty is types.IntType or ty is types.LongType:
Index: run-make-components.sh
===================================================================
RCS file: /cvs/fedora/fedora-accounts/run-make-components.sh,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- run-make-components.sh 13 Jun 2007 03:53:39 -0000 1.4
+++ run-make-components.sh 9 Aug 2007 03:31:11 -0000 1.5
@@ -1,10 +1,10 @@
#!/bin/sh
-BINDIR=/home/devel/sopwith/cvs/fedora-config/fedora-accounts
+BINDIR=/usr/local/admin/fedora-accounts
TDIR=`mktemp -d`
pushd $TDIR &> /dev/null
-REPOS="fedora extras dirsec docs"
+REPOS="fedora extras dirsec docs l10n"
FILES=""
for I in $REPOS; do
Index: website.py
===================================================================
RCS file: /cvs/fedora/fedora-accounts/website.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- website.py 18 Jun 2007 21:17:55 -0000 1.11
+++ website.py 9 Aug 2007 03:31:11 -0000 1.12
@@ -355,7 +355,7 @@
msg.add_header('From', fromaddr)
msg.add_header('Subject', subject)
msg.set_payload(body)
- fh_read, fh_write = popen2.popen2("/usr/sbin/sendmail -t")
+ fh_read, fh_write = popen2.popen2("/usr/sbin/sendmail -t -f %s" %fromaddr)
fh_read.close()
fh_write.write(str(msg))
fh_write.close()
More information about the scm-commits
mailing list