Bug 481307

Summary: qpid-java source RPM build leaves things in BUILD directory
Product: Red Hat Enterprise MRG Reporter: Jeff Needle <jneedle>
Component: qpid-javaAssignee: messaging-bugs <messaging-bugs>
Status: NEW --- QA Contact: Jeff Needle <jneedle>
Severity: medium Docs Contact:
Priority: medium    
Version: 1.1CC: gsim, jross
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
SPEC file patch
none
spec file diff
none
tarballs fetching script diff none

Description Jeff Needle 2009-01-23 14:51:30 UTC
After building qpid-java-0.3.733043 from the source rpm, things are left in the BUILD directory, changing the behavior of the way subsequent SRPMs are rebuilt.

# ls -l /usr/src/redhat/BUILD
/usr/src/redhat/BUILD:
total 24
drwxr-xr-x  8 root root 4096 Jan  9 12:14 gentools
drwxr-xr-x 23 root root 4096 Jan 23 09:32 qpid-java-0.3.733043
drwxr-xr-x  2 root root 4096 Jan  9 12:14 specs

When qpidc is rebuilt after qpid-java, it fails to build:

Making all in src
make[1]: Entering directory `/usr/src/redhat/BUILD/qpidc-0.4.732838/src'
ruby -I ../rubygen ../rubygen/generate gen /usr/src/redhat/BUILD/qpidc-0.4.732838/./../specs/amqp.0-10-qpid-errata.xml ../xml/cluster.xml all ./rubygen.mk; touch rgen.timestamp
ruby: No such file or directory -- ../rubygen/generate (LoadError)
../managementgen/qmf-gen -m ./managementgen.mk -q -o gen/qmf ../../specs/management-schema.xml ./qpid/acl/management-schema.xml ./qpid/cluster/management-schema.xml; touch mgen.timestamp
Traceback (most recent call last):
  File "../managementgen/qmf-gen", line 80, in ?
    package = SchemaPackage(typefile, schemafile, opts)
  File "/usr/src/redhat/BUILD/qpidc-0.4.732838/managementgen/qmfgen/schema.py", line 1212, in __init__ 
    dom = parse (schemafile)
  File "/usr/lib64/python2.4/site-packages/_xmlplus/dom/minidom.py", line 1915, in parse 
    return expatbuilder.parse(file)
  File "/usr/lib64/python2.4/site-packages/_xmlplus/dom/expatbuilder.py", line 924, in parse
    fp = open(file, 'rb')
IOError: [Errno 2] No such file or directory: './qpid/acl/management-schema.xml'
../managementgen/qmf-gen -m ./managementgen.mk -q -o gen/qmf ../../specs/management-schema.xml ./qpid/acl/management-schema.xml ./qpid/cluster/management-schema.xml
Traceback (most recent call last):
  File "../managementgen/qmf-gen", line 80, in ?
    package = SchemaPackage(typefile, schemafile, opts)
  File "/usr/src/redhat/BUILD/qpidc-0.4.732838/managementgen/qmfgen/schema.py", line 1212, in __init__
    dom = parse (schemafile)
  File "/usr/lib64/python2.4/site-packages/_xmlplus/dom/minidom.py", line 1915, in parse
    return expatbuilder.parse(file)
  File "/usr/lib64/python2.4/site-packages/_xmlplus/dom/expatbuilder.py", line 924, in parse
    fp = open(file, 'rb')
IOError: [Errno 2] No such file or directory: './qpid/acl/management-schema.xml'
make[1]: *** [managementgen.mk] Error 1
make[1]: Leaving directory `/usr/src/redhat/BUILD/qpidc-0.4.732838/src'
make: *** [all-recursive] Error 1
error: Bad exit status from /var/tmp/rpm-tmp.34828 (%build)

If built on its own, it succeeds.

This results in TPS' srpmtest to fail.  It also needs to be fixed because nothing should be leaving files in the top-level BUILD directory.

Comment 1 Justin Ross 2009-01-23 14:58:30 UTC
I think there are two issues here.

1. It's bad form (and one that contributes to the trouble above) to have top-level source dirs without version info.  As it's configured right now, the java build system depends on the absence of that version info.

One course of action we can take is to (gulp) take the entire qpid distribution as the source tarball for the java project.  That would work.

We could also adjust how the java build system works, such that it looks up the specs and python code that it needs at installed locations.

2. The test that qpid/cpp is using to determine whether to generate code is possibly wrong.  It appears that if a spec file is present at all at ../specs/qpid.0-10....xml, it generates code.  This is not favorable when we build from our dist tarball.

It would be better if the qpid/cpp makefiles instead checked to see if the code was already generated, as it is in dist tarball's case.

Comment 2 Rajith Attapattu 2009-03-09 19:37:58 UTC
With Nunos help I have modified this behaviour.
Could Jeff/Justin please verify this?

Comment 3 Jeff Needle 2009-03-10 15:40:41 UTC
Sure - what build did this appear in?  Last set of TPS runs was still failing due to this, but when the new builds get added to the errata, TPS will be rerun and I'll check this.

Comment 5 Jan Sarenik 2009-03-23 13:03:43 UTC
rpm -Uvh qpid-java-0.5.751061-1.el5.src.rpm
cd /usr/src/redhat/SPECS/
rpmbuild -bb --clean qpid-java.spec
rpm -Uvh qpidc-0.5.752581-1.el5.src.rpm
rpmbuild -bb --clean qpidc.spec

Everything is erroneous the same way as described above
(even the qpidc build fails on the same error).

When I manually remove files from BUILD directory,
qpidc compiles cleanly.

Comment 6 Jan Sarenik 2009-03-27 13:23:16 UTC
Created attachment 337011 [details]
SPEC file patch

Please apply the patch in attachment to make qpid-java
build cleanly without leaving any files in /usr/src/redhat/BUILD

patch -N -i qpid-java.spec.diff

Comment 7 Jeff Needle 2009-03-30 19:21:08 UTC
Fix failed, moving back to ASSIGNED, changing target to 1.2.

Comment 11 Jan Sarenik 2010-03-29 08:59:47 UTC
Created attachment 403233 [details]
spec file diff

Comment 12 Jan Sarenik 2010-03-29 09:00:49 UTC
Created attachment 403234 [details]
tarballs fetching script diff

Rajith, please apply both patches to the tree under cvs.devel

Comment 13 Jan Sarenik 2010-03-29 09:05:13 UTC
The patched build process uses the same methodology as qpid-cpp-mrg
does.

Actually the build of qpid-cpp-mrg was not affected by qpid-java
(I tried the described problem on current packages), but it is
much cleaner to do it the patched way.

Comment 14 Rajith Attapattu 2010-06-16 00:21:23 UTC
Jan,

Can you try it on the latest packages?
Mikeb helped out in cleaning the spec files and I believe the problem is solved now.

Rajith

Comment 15 Jan Sarenik 2010-06-22 08:50:51 UTC
Sorry Rajith, but it is still far from cleaned up.

  # rpm -Uvh qpid-java-0.7.946106-4.el5.src.rpm
  # rpmbuild -bb /usr/src/redhat/SPECS/qpid-java.spec
  ...
  Wrote: /usr/src/redhat/RPMS/noarch/qpid-java-common-0.7.946106-4.el5_3.noarch.rpm
  Wrote: /usr/src/redhat/RPMS/noarch/qpid-java-client-0.7.946106-4.el5_3.noarch.rpm
  Wrote: /usr/src/redhat/RPMS/noarch/qpid-java-example-0.7.946106-4.el5_3.noarch.rpm
  Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.95116
  + umask 022
  + cd /usr/src/redhat/BUILD
  + cd qpid-java-0.7.946106
  + rm -rf /var/tmp/qpid-java-0.7.946106-4.el5_3-root-root
  + exit 0
  # ls /usr/src/redhat/BUILD/
  gentools/  python/  qpid-deps/  qpid-java-0.7.946106/  specs/

The last line is what can cause problems (and did in the past).
Everything should be inside the qpid-java-<version> directory
to keep things clean.

But if one builds always with clean /usr/src/redhat/BUILD
everything works fine.

Have a look at the patches I sent in comments #11 and #12.

Comment 16 Rajith Attapattu 2010-07-12 22:15:22 UTC
I finally understood what the problem is.
"Everything should be inside the qpid-java-<version> directory"

Ok I think it's best to tackle this after 1.3