AIX Open Source

AIX Open Source

Share your experiences and connect with fellow developers to discover how to build and manage open source software for the AIX operating system

 View Only
  • 1.  creating own RPM fails with files not found

    Posted Mon November 23, 2020 10:12 AM
    Hello folks,

    I tried to make a RPM package to distribute some config files for metricbeat.
    Unfortunately I get an error with rpmbuild that I can't explain.
    I already read your article about building a rpm, that helps me to understand it better, but not enough to solve this.
    I know that you have enough to do with supporting your own packages, but if you have time to take a look, would be nice.

    This is my environment I have to deal with:

    cat /home/rpmadm/.rpmmacros
    
    %_topdir /export/standardbuild
    %_tmppath /export/standardbuild/tmp
    %_sourcedir /export/standardbuild/SOURCES
    %_rpmdir /export/standardbuild/RPMS
    %_srcrpmdir /export/standardbuild/SRPMS
    %_builddir /export/standardbuild/COMP_BUILDS/%{name}
    

    My Makefile looks like this:

    packagename = metricconf
    
    %_sourcedir = /export/standardbuild/SOURCES
    
    
    # version number of package: make sure you also update the version
    # number in the spec file
    version = 1.0
    
    all:
            @echo "usage: make dist | package"
    
    install:
            if [ ! -d $(DESTDIR)/tmp/$(packagename) ]; \
            then \
                    mkdir -p $(DESTDIR)/tmp/$(packagename); \
            fi
            
            cp mb_system_betrieb.yml        $(DESTDIR)/tmp/$(packagename)/mb_system_betrieb.yml
            cp metricbeat                   $(DESTDIR)/tmp/$(packagename)/metricbeat
            cp metricbeat.yml               $(DESTDIR)/tmp/$(packagename)/metricbeat.yml
    
    dist:
            tar cvf $(packagename)-$(version).tar ../$(packagename)-$(version)
            gzip $(packagename)-$(version).tar
            cp $(packagename)-$(version).tar.gz $(%_sourcedir) && rm $(packagename)-$(version).tar.gz
    
    package:        rpm
    
    rpm:
            rpmbuild -ba $(packagename).spec
            rm -rf $(packagename)-$(version).tar
    

    And this is my .spec file:

    Summary:        configures Metricbeat for AIX
    Name:           metricconf
    Version:        1.0
    Release:        0
    Vendor:         Comp 
    Source:         metricconf-1.0.tar.gz
    BuildRoot:      %{_builddir}/%{name}-{version}
    
    Requires: metricbeat
    
    %description
    metricconf prepares AIX for metricbeat
    %prep
    %setup -c
    %build
    %install
    %files
    %defattr(644,root,system)
    /tmp/metricbeat.yml
    /tmp/mb_system_betrieb.yml
    /tmp/metricbeat
    

    make dist works well and the .tar.gz file will be created correctly. But the make rpm command fails every time with following error:

    make rpm
            rpmbuild -ba metricconf.spec
    Executing(%prep): /bin/sh -e /export/standardbuild/tmp/rpm-tmp.cIlqQa
    + umask 022
    + cd /export/standardbuild/COMP_BUILDS/metricconf
    + cd /export/standardbuild/COMP_BUILDS/metricconf
    + rm -rf metricconf-1.0
    + /usr/bin/mkdir -p metricconf-1.0
    + cd metricconf-1.0
    + /bin/gzip -dc /export/standardbuild/SOURCES/metricconf-1.0.tar.gz
    + /bin/tar -xvvof -
    x ../COOPmetricbeat-1.0
    x ../COOPmetricbeat-1.0/metricconf.spec, 2289 bytes, 5 tape blocks
    x ../COOPmetricbeat-1.0/ChangeLog, 135 bytes, 1 tape blocks
    x ../COOPmetricbeat-1.0/Makefile, 885 bytes, 2 tape blocks
    x ../COOPmetricbeat-1.0/README, 74 bytes, 1 tape blocks
    x ../COOPmetricbeat-1.0/mb_system_betrieb.yml, 1161 bytes, 3 tape blocks
    x ../COOPmetricbeat-1.0/metricbeat, 1552 bytes, 4 tape blocks
    x ../COOPmetricbeat-1.0/metricbeat.yml, 1240 bytes, 3 tape blocks
    + STATUS=0
    + [ 0 -ne 0 ]
    + /bin/chmod -Rf a+rX,u+w,g-w,o-w .
    + exit 0
    Executing(%build): /bin/sh -e /export/standardbuild/tmp/rpm-tmp.dalqQb
    + umask 022
    + cd /export/standardbuild/COMP_BUILDS/metricconf
    + cd COOPmetricbeat-1.0
    + exit 0
    Executing(%install): /bin/sh -e /export/standardbuild/tmp/rpm-tmp.delqQc
    + umask 022
    + cd /export/standardbuild/COMP_BUILDS/metricconf
    + cd metricconf-1.0
    + exit 0
    Processing files: metricconf-1.0-0.ppc
    error: File not found: /export/standardbuild/tmp/metricconf-1.0-0.ppc/tmp/metricbeat.yml
    error: File not found: /export/standardbuild/tmp/metricconf-1.0-0.ppc/tmp/mb_system_betrieb.yml
    error: File not found: /export/standardbuild/tmp/metricconf-1.0-0.ppc/tmp/metricbeat
    
    
    RPM build errors:
        File not found: /export/standardbuild/tmp/metricconf-1.0-0.ppc/tmp/metricbeat.yml
        File not found: /export/standardbuild/tmp/metricconf-1.0-0.ppc/tmp/mb_system_betrieb.yml
        File not found: /export/standardbuild/tmp/metricconf-1.0-0.ppc/tmp/metricbeat
    make: 1254-004 The error code from the last command is 1.## Heading ##
    

    Please, can anyone explain to me why rpmbuild is looking in "/export/standardbuild/tmp/metricconf-1.0-0.ppc" for the files and not in "/export/standardbuild/COMP_BUILDS/metricconf/metricconf-1.0" ???

    If anyone could give me a hint, it would be very apreciated...

    Many thanks in advance.
    best regards,

    Joerg



    ------------------------------
    Joerg Kauke
    Unix Administrator
    COOP Switzerland
    ------------------------------


  • 2.  RE: creating own RPM fails with files not found

    Posted Mon November 23, 2020 10:57 AM
    Recent rpm versions won't honour the custom setting for "BuildRoot".
    This is from the rpm macros file ( lslpp -f rpm.rte | grep macros )  " /usr/opt/rpm/lib/rpm/macros"

    # The directory where buildroots will be created.
    %_buildrootdir %{_tmppath}

    # Build root path, where %install installs the package during build.
    %buildroot %{_buildrootdir}/%{name}-%{version}-%{release}.%{_arch}

    # Directory where temporary files can be created.
    %_tmppath /var/tmp


    So the build root in this case is  " %{_tmppath}%{name}-%{version}-%{release}.%{_arch} " which translates to " /export/standardbuild/tmp/metricconf-1.0.0.ppc"
    You need to set the DESTDIR to ${RPM_BUILD_ROOT} in the SPEC file which will fix this issue.

    ------------------------------
    Ayappan P
    ------------------------------



  • 3.  RE: creating own RPM fails with files not found

    Posted Mon November 23, 2020 11:49 AM
    Thanks Ayappan,

    I set now:
    BuildRoot: %{_tmppath}%{name}-%{version}-%{release}.%{_arch}

    But it seems rpmbuild does ignore it... still the same error... or I still don't get it.




    ------------------------------
    Joerg Kauke
    Unix Administrator
    COOP Switzerland
    ------------------------------



  • 4.  RE: creating own RPM fails with files not found

    Posted Mon November 23, 2020 12:19 PM
    Don't set BuildRoot. It's useless.
    Replace "DESTDIR' with "${RPM_BUILD_ROOT}" in the spec file.

    ------------------------------
    Ayappan P
    ------------------------------



  • 5.  RE: creating own RPM fails with files not found

    Posted Wed November 25, 2020 02:40 AM
    Hello Ayappan,

    many thanks for your support. The rpmbuild command is now working...

    best regards

    ------------------------------
    Joerg Kauke
    Unix Administrator
    COOP Switzerland
    ------------------------------