Hi Paul,

Paul B Schroeder píše v Čt 19. 08. 2010 v 18:39 -0500: 
> I've been happily building my new distro packages in koji for the last 
> couple of months.  And still can seem to build any package without 
> issue.  With one exception.  I've recently run into an issue when I 
> tried to build anaconda for the first time.
> 
> kojid is not reading the header of source RPM that gets created for 
> whatever reason.  When I go into the /mnt/koji/work/tasks directory and 
> find the source RPM that was created from the buildSRPMFromSCM task, I 
> can run command line rpm commands against it without any problem.  So it 
> seems that the issue isn't with the RPM iself, but with kojid reading it.

most likely it's an issue when urllib2 tries to send data read from
network and sent to a file object that's then used in hdrFromFdno() rpm
function. It doesn't return enough data for the whole rpm header and
fails. Try the patch from the attachments, it's not nice, but it helps.

> Again, I do not have this issue with no other package that I build in 
> koji.  Any ideas as to what may be going on?
> 
> Here is the error output I get from running koji build on the command line:
> 
> Created task: 1010
> Task info: http://koji.aus.vbridges.com/koji/taskinfo?taskID=1010
> Watching tasks (this may be safely interrupted)...
> 1010 build (LEAF-1.3.0, 
> /svn/cM4yhIeeur34JreJe5aVNr/LEAF:LEAF-1.3.0/anaconda:HEAD): free
> 1010 build (LEAF-1.3.0, 
> /svn/cM4yhIeeur34JreJe5aVNr/LEAF:LEAF-1.3.0/anaconda:HEAD): free -> open 
> (kojibuilder2)
>    1011 buildSRPMFromSCM 
> (/svn/cM4yhIeeur34JreJe5aVNr/LEAF:LEAF-1.3.0/anaconda:HEAD): free
>    1011 buildSRPMFromSCM 
> (/svn/cM4yhIeeur34JreJe5aVNr/LEAF:LEAF-1.3.0/anaconda:HEAD): free -> 
> open (kojibuilder2)
>    1011 buildSRPMFromSCM 
> (/svn/cM4yhIeeur34JreJe5aVNr/LEAF:LEAF-1.3.0/anaconda:HEAD): open 
> (kojibuilder2) -> closed
>    0 free  1 open  1 done  0 failed
> 1010 build (LEAF-1.3.0, 
> /svn/cM4yhIeeur34JreJe5aVNr/LEAF:LEAF-1.3.0/anaconda:HEAD): open 
> (kojibuilder2) -> FAILED: Fault: <Fault 1: 'Traceback (most recent call 
> last):\n  File "/usr/sbin/kojid", line 1285, in runTask\n    response = 
> (handler.run(),)\n  File "/usr/sbin/kojid", line 1361, in run\n 
> return self.handler(*self.params,**self.opts)\n  File "/usr/sbin/kojid", 
> line 1822, in handler\n    h = self.readSRPMHeader(srpm)\n  File 
> "/usr/sbin/kojid", line 1895, in readSRPMHeader\n    h = 
> koji.get_rpm_header(fo)\n  File 
> "/usr/lib/python2.6/site-packages/koji/__init__.py", line 770, in 
> get_rpm_header\n    hdr = ts.hdrFromFdno(fo.fileno())\n  File 
> "/usr/lib64/python2.6/site-packages/rpm/transaction.py", line 154, in 
> hdrFromFdno\n    raise rpm.error("error reading package header")\nerror: 
> error reading package header\n'>
>    0 free  0 open  1 done  1 failed
> 
> 1010 build (LEAF-1.3.0, 
> /svn/cM4yhIeeur34JreJe5aVNr/LEAF:LEAF-1.3.0/anaconda:HEAD) failed
> make: *** [scratch-build] Error 1
> 
> 
> And some package versions:
> [r...@kojibuilder2 ~]# rpm -q koji-builder
> koji-builder-1.3.2-1.fc13.noarch
> [r...@kojibuilder2 ~]# rpm -q rpm
> rpm-4.8.1-2.fc13.x86_64


With regards,

Dan

diff -up koji-1.3.2/builder/kojid.orig koji-1.3.2/builder/kojid
--- koji-1.3.2/builder/kojid.orig	2009-11-12 22:10:30.000000000 +0100
+++ koji-1.3.2/builder/kojid	2010-07-29 12:23:55.000000000 +0200
@@ -62,6 +62,7 @@ import pykickstart.parser as ksparser
 import pykickstart.handlers.control as kscontrol
 import hashlib
 import iso9660 # from pycdio
+import tempfile
 
 # our private modules
 sys.path.insert(0, '/usr/share/koji-builder/lib')
@@ -1892,7 +1893,15 @@ class BuildTask(BaseTaskHandler):
         relpath = "work/%s" % srpm
         opts = dict([(k, getattr(options, k)) for k in 'topurl','topdir'])
         fo = koji.openRemoteFile(relpath, **opts)
-        h = koji.get_rpm_header(fo)
+
+        # use a temporary file to workaround an issue where urllib2 is not able
+        # to send enough data in time to the rpm header decode function.
+        tmp = tempfile.TemporaryFile()
+        tmp.write(fo.read(1000 * 1000))
+        tmp.seek(0)
+
+        h = koji.get_rpm_header(tmp)
+        tmp.close()
         if h[rpm.RPMTAG_SOURCEPACKAGE] != 1:
             raise koji.BuildError, "%s is not a source package" % srpm
         return h
diff -up koji-1.4.0/builder/kojid.orig koji-1.4.0/builder/kojid
--- koji-1.4.0/builder/kojid.orig	2010-07-09 04:04:26.000000000 +0200
+++ koji-1.4.0/builder/kojid	2010-07-30 15:36:46.000000000 +0200
@@ -53,6 +53,7 @@ import urllib2
 import urlparse
 import xmlrpclib
 import zipfile
+import tempfile
 import Cheetah.Template
 from ConfigParser import ConfigParser
 from fnmatch import fnmatch
@@ -2004,7 +2005,15 @@ class BuildTask(BaseTaskHandler):
         relpath = "work/%s" % srpm
         opts = dict([(k, getattr(options, k)) for k in 'topurl','topdir'])
         fo = koji.openRemoteFile(relpath, **opts)
-        h = koji.get_rpm_header(fo)
+
+        # use a temporary file to workaround an issue where urllib2 is not able
+        # to send enough data in time to the rpm header decode function.
+        tmp = tempfile.TemporaryFile()
+        tmp.write(fo.read(1000 * 1000))
+        tmp.seek(0)
+
+        h = koji.get_rpm_header(tmp)
+        tmp.close()
         if h[rpm.RPMTAG_SOURCEPACKAGE] != 1:
             raise koji.BuildError, "%s is not a source package" % srpm
         return h
--
buildsys mailing list
[email protected]
https://admin.fedoraproject.org/mailman/listinfo/buildsys

Reply via email to