Bug 1028980

Summary: libguestfs rpmbuild --rebuild fails with: Only one of PREFIX or INSTALL_BASE can be given. Not both.
Product: Red Hat Enterprise Linux 7 Reporter: Richard W.M. Jones <rjones>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED NOTABUG QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.0CC: bfan
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-11-20 09:12:36 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
configure.log
none
make.log
none
rebuild.log
none
build log
none
the whole logs none

Description Richard W.M. Jones 2013-11-11 12:11:23 UTC
Description of problem:

Bo Fan could not rebuild libguestfs and got the error:

> perl /home/mockbuild/rpmbuild/BUILD/libguestfs-1.22.6/perl/Makefile.PL \
>       INSTALLDIRS=vendor PREFIX=/usr
> ! test -f ../generator/Makefile || \
>   make -C ../generator stamp-generator
> make[3]: Entering directory `/home/mockbuild/rpmbuild/BUILD/libguestfs-1.22.6\
/generator'
> make[3]: `stamp-generator' is up to date.
> make[3]: Leaving directory `/home/mockbuild/rpmbuild/BUILD/libguestfs-1.22.6/\
generator'
> Only one of PREFIX or INSTALL_BASE can be given.  Not both.

This error makes no sense because INSTALL_BASE is not specified.
Also I could not reproduce this.

Version-Release number of selected component (if applicable):

1.22.6-15.el7

Comment 1 Richard W.M. Jones 2013-11-11 12:12:45 UTC
Created attachment 822377 [details]
configure.log

Comment 2 Richard W.M. Jones 2013-11-11 12:13:17 UTC
Created attachment 822378 [details]
make.log

Comment 3 Richard W.M. Jones 2013-11-11 12:13:50 UTC
Created attachment 822379 [details]
rebuild.log

Comment 5 bfan 2013-11-12 13:57:21 UTC
Thanks for your help via email,

I find a weird environment value 'PERL_MM_OPT=INSTALL_BASE=/home/mockbuild/perl5' in my host, so I set it to PERL_MM_OPT=/home/mockbuild/perl5

build process can continue, but finally failed due to
"RPM build errors:
    File not found by glob: /home/mockbuild/rpmbuild/BUILDROOT/libguestfs-1.22.6-15.el7.x86_64/usr/lib/python2.7/site-packages/*.pyc
    File not found by glob: /home/mockbuild/rpmbuild/BUILDROOT/libguestfs-1.22.6-15.el7.x86_64/usr/lib/python2.7/site-packages/*.pyo
"

I cut the end of build log and attached

Comment 6 bfan 2013-11-12 13:57:53 UTC
Created attachment 822991 [details]
build log

Comment 7 Richard W.M. Jones 2013-11-12 14:14:54 UTC
(In reply to bfan from comment #5)
> Thanks for your help via email,
> 
> I find a weird environment value
> 'PERL_MM_OPT=INSTALL_BASE=/home/mockbuild/perl5' in my host, so I set it to
> PERL_MM_OPT=/home/mockbuild/perl5
> 
> build process can continue, but finally failed due to
> "RPM build errors:
>     File not found by glob:
> /home/mockbuild/rpmbuild/BUILDROOT/libguestfs-1.22.6-15.el7.x86_64/usr/lib/
> python2.7/site-packages/*.pyc
>     File not found by glob:
> /home/mockbuild/rpmbuild/BUILDROOT/libguestfs-1.22.6-15.el7.x86_64/usr/lib/
> python2.7/site-packages/*.pyo
> "

These files (compiled Python bytecode) are generated by RPM.  If
you look at a typical successful build log upstream, eg:

http://kojipkgs.fedoraproject.org//packages/libguestfs/1.25.7/1.fc21/data/logs/x86_64/build.log

then you will see:

+ /usr/lib/rpm/brp-python-bytecompile /usr/bin/python 1
Bytecompiling .py files below /builddir/build/BUILDROOT/libguestfs-1.25.7-1.fc21.x86_64/usr/lib/python2.7/ using /usr/bin/python2.7
Bytecompiling .py files below /builddir/build/BUILDROOT/libguestfs-1.25.7-1.fc21.x86_64/usr/lib64/python2.7/ using /usr/bin/python2.7

The brp-python-bytecompile program is what generates these
files.  If brp-python-bytecompile is missing/broken then
these files don't get generated and the build would fail.

> I cut the end of build log and attached

As usual, I need to see the whole log, not parts of it.
In this case I cannot see any reference to brp-python-bytecompile
but I'm not sure if that occurred earlier, or if it's just
not installed.

My suggestion:

# yum install /usr/lib/rpm/brp-python-bytecompile

Comment 8 bfan 2013-11-12 15:23:31 UTC
brp-python-bytecompile is installed

$ ls /usr/lib/rpm/brp-
brp-compress              brp-python-bytecompile    brp-strip                 brp-strip-shared
brp-java-gcjcompile       brp-python-hardlink       brp-strip-comment-note    brp-strip-static-archive

How can I tell it works but not broken, I run /usr/lib/rpm/brp-python-bytecompile , nothing returned without error 

I compare the upstream logs to mine, I just find in my logs
+ /usr/lib/rpm/brp-compress
+ /usr/lib/rpm/brp-strip /usr/bin/strip
+ /usr/lib/rpm/brp-strip-static-archive /usr/bin/strip
+ /usr/lib/rpm/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump

attach the whole logs

Comment 9 bfan 2013-11-12 15:23:54 UTC
Created attachment 823021 [details]
the whole logs

Comment 10 Richard W.M. Jones 2013-11-12 15:47:18 UTC
The way this works is:

After installation, the RPM macro __os_install_post runs.  This
macro contains a call to brp-python-bytecompile hard wired.

You can find out what your macro contains by doing:

$ rpm --eval '%{__os_install_post}'

    /usr/lib/rpm/redhat/brp-compress 
    
    /usr/lib/rpm/redhat/brp-strip /usr/bin/strip 
    /usr/lib/rpm/redhat/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump 
     
    /usr/lib/rpm/redhat/brp-strip-static-archive /usr/bin/strip 
    /usr/lib/rpm/brp-python-bytecompile /usr/bin/python 1 
    /usr/lib/rpm/redhat/brp-python-hardlink 
    /usr/lib/rpm/redhat/brp-java-repack-jars 

(for me)

Now, there are two possibilities here:

(1) You don't have redhat-rpm-config package installed.  This
seems most likely.

(2) You have overridden this macro in your ~/.rpmmacros.

Comment 11 bfan 2013-11-13 13:52:27 UTC
Yes, build passed after I installed redhat-rpm-config package. Thanks very much

Comment 12 Richard W.M. Jones 2013-11-20 09:12:36 UTC
Closing as NOTABUG, but please see this thread:
https://lists.fedoraproject.org/pipermail/devel/2013-November/thread.html#191994