diff --git a/twisted/scripts/tap2rpm.py b/twisted/scripts/tap2rpm.py
index a3888a7..3f55840 100755
--- a/twisted/scripts/tap2rpm.py
+++ b/twisted/scripts/tap2rpm.py
@@ -167,8 +167,10 @@ type_dict = {
 
 ##########################
 def makeBuildDir(baseDir):
-    '''Set up the temporary directory for building RPMs.
-    Returns: Tuple: ( buildDir, rpmrcFile )
+    '''
+    Set up the temporary directory for building RPMs.
+
+    Returns: buildDir, a randomly-named subdirectory of baseDir.
     '''
     import random, string
 
@@ -189,21 +191,7 @@ def makeBuildDir(baseDir):
     os.makedirs(os.path.join(tmpDir, 'SOURCES'))
     os.makedirs(os.path.join(tmpDir, 'SRPMS'))
 
-    #  set up rpmmacros file
-    macroFile = os.path.join(tmpDir, 'rpmmacros')
-    rcFile = os.path.join(tmpDir, 'rpmrc')
-    rpmrcData = open('/usr/lib/rpm/rpmrc', 'r').read()
-    rpmrcData = string.replace(rpmrcData, '~/.rpmmacros', macroFile)
-    fp = open(macroFile, 'w')
-    fp.write('%%_topdir %s\n' % tmpDir)
-    fp.close()
-
-    #  set up the rpmrc file
-    fp = open(rcFile, 'w')
-    fp.write(rpmrcData)
-    fp.close()
-
-    return(( tmpDir, rcFile ))
+    return tmpDir
 
 
 ##########
@@ -236,7 +224,7 @@ def run(options=None):
         maintainer = 'tap2rpm'
 
     #  create source archive directory
-    tmp_dir, rpmrc_file = makeBuildDir('/var/tmp')
+    tmp_dir = makeBuildDir('/var/tmp')
     source_dir = os.path.join(tmp_dir, directory)
     os.makedirs(source_dir)
 
@@ -257,7 +245,7 @@ def run(options=None):
     print 'Starting build...'
     print '=' * 70
     sys.stdout.flush()
-    os.system('rpmbuild -ta --rcfile "%s" %s' % ( rpmrc_file, tarfile_name ))
+    os.system('rpmbuild --define "_topdir %s" -ta %s' % ( tmp_dir, tarfile_name ))
     print 'Done with build...'
     print '=' * 70
     
diff --git a/twisted/scripts/test/test_tap2rpm.py b/twisted/scripts/test/test_tap2rpm.py
index 0f8863d..7553592 100644
--- a/twisted/scripts/test/test_tap2rpm.py
+++ b/twisted/scripts/test/test_tap2rpm.py
@@ -80,9 +80,32 @@ def _queryRPMTags(rpmfile, taglist):
 
         return res
 
+    def checkErrorResult(failure):
+        # The current rpm packages on Debian and Ubuntu don't properly set up
+        # the RPM database, which causes rpm to print a harmless warning to
+        # stderr. Unfortunately, .getProcessOutput() assumes all warnings are
+        # catastrophic and panics whenever it sees one.
+        #
+        # See also:
+        #   http://twistedmatrix.com/trac/ticket/3292#comment:42
+        #   http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=551669
+        #   http://rpm.org/ticket/106
+
+        failure.trap(IOError)
+
+        # Check whether this warning is the one symptomatic of Debian's RPM
+        # problem.
+        if str(failure.value) == ("got stderr: 'error: cannot open Name index "
+                "using db3 - No such file or directory (2)\\n'"):
+            raise SkipTest("rpm is missing its package database. "
+                    "Run 'sudo rpm -qa > /dev/null' to create one.")
+        else:
+            # Not the exception we were looking for; as you were.
+            failure.raiseException()
+
     d = utils.getProcessOutput("rpm",
             ("-q", "--queryformat", queryFormat, "-p", rpmfile))
-    d.addCallback(parseTagValues)
+    d.addCallbacks(parseTagValues, checkErrorResult)
     return d
 
 
