Bug 762145 (GLUSTER-413)

Summary: rpmbuild fails with unpackaged files
Product: [Community] GlusterFS Reporter: Harshavardhana <fharshav>
Component: buildAssignee: Harshavardhana <fharshav>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: low Docs Contact:
Priority: low    
Version: mainlineCC: amarts, cww, gluster-bugs, idadesub
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:

Description Harshavardhana 2009-11-26 21:17:16 UTC
rpmbuild fails as we removed static libraries in %files list.

Comment 1 Anand Avati 2009-11-28 14:58:32 UTC
PATCH: http://patches.gluster.com/patch/2402 in master (Excluding static libraries.)

Comment 2 Anand Avati 2009-11-29 03:51:08 UTC
PATCH: http://patches.gluster.com/patch/2403 in release-2.0 (Excluding static libraries)

Comment 3 idadesub 2009-12-02 19:56:54 UTC
Hi, sorry to reopen this, but the commit 04da2ae78b83e1cb3e14379dd72d694fa03fc5e1 rebroke this for me on fedora 11, with:

Processing files: glusterfs-devel-3.0.0git-1.pix1.x86_64                                                                                                                                                                                    
error: File not found by glob: /home/erickt/rpmbuild/BUILDROOT/glusterfs-3.0.0git-1.x86_64/usr/lib64/*.a


Perhaps we're running into one os generating .a files, and another not? These are the only files I have in the .../usr/lib64 directory:

glusterfs
libglusterfsclient.la
libglusterfsclient.so
libglusterfsclient.so.0
libglusterfsclient.so.0.0.0
libglusterfs.la
libglusterfs.so
libglusterfs.so.0
libglusterfs.so.0.0.0

It doesn't look like explicitly listing out the files works, as in:

%files devel
%defattr(-,root,root,-)
%{_includedir}/glusterfs
%{_includedir}/libglusterfsclient.h
%exclude %{_includedir}/glusterfs/y.tab.h
%exclude %{_libdir}/libglusterfsclient.la
%exclude %{_libdir}/libglusterfsclient.a
%{_libdir}/libglusterfsclient.so
%{_libdir}/libglusterfsclient.so.0
%{_libdir}/libglusterfsclient.so.0.0.0
%exclude %{_libdir}/libglusterfs.la
%exclude %{_libdir}/libglusterfs.a
%{_libdir}/libglusterfs.so
%{_libdir}/libglusterfs.so.0
%{_libdir}/libglusterfs.so.0.0.0


Which just errors out for me with:

    File not found: /home/erickt/rpmbuild/BUILDROOT/glusterfs-3.0.0git-1.x86_64/usr/lib64/libglusterfsclient.a
    File not found: /home/erickt/rpmbuild/BUILDROOT/glusterfs-3.0.0git-1.x86_64/usr/lib64/libglusterfs.a

So, long story short, there are two solutions I can see. First, generate a FILES file after compiling that determines whether or not *.a files were generated, and use the "%files -f FILES devel" argument.

Or even simpler, just delete all the *.la and *.a files as in: 

diff --git a/glusterfs.spec.in b/glusterfs.spec.in
index 9ce6f1b..446018a 100644
--- a/glusterfs.spec.in
+++ b/glusterfs.spec.in
@@ -143,7 +143,8 @@ sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
     %{buildroot}%{_includedir}/glusterfs/

 # Remove unwanted files from all the shared libraries
-find %{buildroot}%{_libdir}/glusterfs -name '*.la' | xargs rm -f
+find %{buildroot}%{_libdir} -name '*.la' | xargs rm -f
+find %{buildroot}%{_libdir} -name '*.a' | xargs rm -f

 %clean
 %{__rm} -rf %{buildroot}
@@ -197,8 +198,6 @@ fi
 %{_includedir}/glusterfs
 %{_includedir}/libglusterfsclient.h
 %exclude %{_includedir}/glusterfs/y.tab.h
-%exclude %{_libdir}/*.la
-%exclude %{_libdir}/*.a
 %{_libdir}/*.so

 %changelog

Comment 4 Amar Tumballi 2009-12-02 20:40:33 UTC
We saw that without Harsha's commit it was failing in rpmbuild in our testing machines here.

Comment 5 Harshavardhana 2009-12-06 20:06:57 UTC
Fixed in 

Author: Erick Tryzelaar <idadesub.net>
Date:   Wed Dec 2 17:32:05 2009 +0000

    Hopefully fix rpm building for everyone by rm-ing *.a and *.la
    
    My Fedora 11 machine doesn't seem to make the .a files, so it errors out,
    but it appears someone else's machine does, so try to fix it by explicitly
    removing the .a and .la files, rather than excluding them from the %files
    section.
    
    Signed-off-by: Anand V. Avati <avati.com>