Bug 164314

Summary: gnbd-kernel build dirties outside $RPM_BUILD_DIR
Product: [Retired] Red Hat Cluster Suite Reporter: Charlie Brady <charlieb-redhat-bugzilla>
Component: gnbdAssignee: Chris Feist <cfeist>
Status: CLOSED ERRATA QA Contact: Cluster QE <mspqa-list>
Severity: medium Docs Contact:
Priority: medium    
Version: 4CC: cluster-maint
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: 2010-01-04 19:15:49 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Charlie Brady 2005-07-26 20:39:51 UTC
gnbd-kernel is not well behaved during building, and I suspect will not be
reliable, since it strays outside the builddir during building, and therefore
isn't working with a known clean state.

The problem lines are these in %build:

cp -r `pwd` ../smp
cp -r `pwd` ../xenU
cp -r `pwd` ../xen0

../smp, ../xenU and ../xen0 may or may not already exist, and may be files,
symlinks or existing directories. If directories, they may not be empty.

Here's a fix (which also moves the tree copying into %prep, and skips two tree
copies if the xen variant is not being built):

diff -u -r1.1 gnbd-kernel.spec
--- gnbd-kernel.spec    2005/07/26 19:20:45     1.1
+++ gnbd-kernel.spec    2005/07/26 20:36:21
@@ -95,6 +95,16 @@
 ################################################################################
 %prep
 %setup -q -n %{name}-%{version}-%{subversion}
+mkdir up
+mv configure CVS make Makefile patches scripts src up
+mkdir smp
+cp -r up/. smp
+%if %{buildxen}
+mkdir xenU
+cp -r up/. xenU
+mkdir xen0
+cp -r up/. xen0
+%endif

 ################################################################################
 ##  THE BUILD SECTION
@@ -102,13 +112,14 @@
 %build
 BUILD_TOPDIR=`pwd`

-cp -r `pwd` ../smp
-cp -r `pwd` ../xenU
-cp -r `pwd` ../xen0
-
 Build_gnbd(){
        cpu_type=$1
        flavor=$2
+       var=
+       if [ -n "$flavor" ]
+       then
+           var="$flavor-"
+       fi
        kernel_src=/lib/modules/%{kernel_version}$flavor/build
        # Kernel tree setup
        if [ -d $kernel_src/. ]; then
@@ -129,19 +140,20 @@
 }

 %if %{buildup}
+cd $BUILD_TOPDIR/up
 Build_gnbd %{_target_cpu}
 %endif

 %if %{buildsmp}
-cd ../smp
+cd $BUILD_TOPDIR/smp
 Build_gnbd %{_target_cpu} smp
 %endif

 %if %{buildxen}
-cd ../xenU
+cd $BUILD_TOPDIR/xenU
 Build_gnbd %{_target_cpu} xenU

-cd ../xen0
+cd $BUILD_TOPDIR/xenO
 Build_gnbd %{_target_cpu} xen0
 %endif

@@ -150,20 +162,22 @@
 ################################################################################
 %install
 rm -rf $RPM_BUILD_ROOT
+BUILD_TOPDIR=`pwd`

 %if %{buildup}
+cd $BUILD_TOPDIR/up
 make install DESTDIR=$RPM_BUILD_ROOT
 %endif

 %if %{buildsmp}
-cd ../smp
+cd $BUILD_TOPDIR/smp
 make install DESTDIR=$RPM_BUILD_ROOT
 %endif

 %if %{buildxen}
-cd ../xenU
+cd $BUILD_TOPDIR/xenU
 make install DESTDIR=$RPM_BUILD_ROOT ARCH=xen
-cd ../xen0
+cd $BUILD_TOPDIR/xenO
 make install DESTDIR=$RPM_BUILD_ROOT ARCH=xen
 %endif

Comment 1 Charlie Brady 2005-07-26 21:51:52 UTC
The other *-kernel packages ({GFS,cman,dlm}) have the same problem. They each
create and then dirty $RPM_BUILD_DIR/../smp and then leave the dirty directory
around. They each fail to build if there is an existing $RPM_BUILD_DIR/../smp
directory containing sources and build products of one of the other rpms. They
also fail if there happens to be a $RPM_BUILD_DIR/../smp file.

They can each be fixed as above.

Comment 2 Ben Marzinski 2005-07-26 22:03:16 UTC
tag. You're it.

Comment 3 Charlie Brady 2005-07-27 15:20:50 UTC
"mkdir $RPM_BUILD_DIR/smp" before doing "rpmbuild --rebuild --target=i686
gnbd-kernel-2.6.9.9-20050705200822.35.src.rpm" is enough to make the build fail.

Would you like separate bugzillas for each of GFS-kernel, dlm-kernel and
cman-kernel?

Comment 4 Chris Feist 2005-07-27 15:24:41 UTC
No need to open extra bugs, I'll fix all of the packages at the same time.

Comment 5 Chris Feist 2005-08-02 16:23:44 UTC
This has been fixed in all of the latest -kernel packages and should be included
in RHEL4-U2.