BUILDROOT files during RPM generation

Posted by khmarbaise on Server Fault See other posts from Server Fault or by khmarbaise
Published on 2012-04-22T20:12:36Z Indexed on 2012/06/05 16:41 UTC
Read the original article Hit count: 414

Filed under:

Currently i have the following spec file to create a RPM. The spec file is generated by maven plugin to produce a RPM out of it. The question is: will i find files which are mentioned in the spec file after the rpm generation inside the BUILDROOT/SPECS/SOURCES/SRPMS structure?

%define _unpackaged_files_terminate_build 0
Name: rpm-1
Version: 1.0
Release: 1
Summary: rpm-1
License: 2009 my org
Distribution: My App
Vendor: my org
URL: www.my.org
Group: Application/Collectors
Packager: my org
Provides: project
Requires: /bin/sh
Requires: jre >= 1.5
Requires: BASE_PACKAGE
PreReq: dependency
Obsoletes: project
autoprov: yes
autoreq: yes
BuildRoot: /home/build/.jenkins/jobs/rpm-maven-plugin/workspace/target/it/rpm-1/target/rpm/rpm-1/buildroot

%description

%install
if [ -e $RPM_BUILD_ROOT ];
then
  mv /home/build/.jenkins/jobs/rpm-maven-plugin/workspace/target/it/rpm-1/target/rpm/rpm-1/tmp-buildroot/* $RPM_BUILD_ROOT
else
  mv /home/build/.jenkins/jobs/rpm-maven-plugin/workspace/target/it/rpm-1/target/rpm/rpm-1/tmp-buildroot $RPM_BUILD_ROOT
fi

ln -s /usr/myusr/app $RPM_BUILD_ROOT/usr/myusr/app2
ln -s /tmp/myapp/somefile $RPM_BUILD_ROOT/tmp/myapp/somefile2
ln -s name.sh $RPM_BUILD_ROOT/usr/myusr/app/bin/oldname.sh

%files
%defattr(-,myuser,mygroup,-)
%dir  "/usr/myusr/app"
 "/usr/myusr/app2"
  "/tmp/myapp/somefile"
  "/tmp/myapp/somefile2"
 "/usr/myusr/app/lib"
%attr(755,myuser,mygroup)  "/usr/myusr/app/bin/start.sh"
%attr(755,myuser,mygroup)  "/usr/myusr/app/bin/filter-version.txt"
%attr(755,myuser,mygroup)  "/usr/myusr/app/bin/name.sh"
%attr(755,myuser,mygroup)  "/usr/myusr/app/bin/name-Linux.sh"
%attr(755,myuser,mygroup)  "/usr/myusr/app/bin/filter.txt"
%attr(755,myuser,mygroup)  "/usr/myusr/app/bin/oldname.sh"
%dir  "/usr/myusr/app/conf"
%config   "/usr/myusr/app/conf/log4j.xml"
  "/usr/myusr/app/conf/log4j.xml.deliver"

%prep
echo "hello from prepare"

%pre -p /bin/sh
#!/bin/sh

if [ -s "/etc/init.d/myapp" ]
then
    /etc/init.d/myapp stop
    rm /etc/init.d/myapp
fi

%post
#!/bin/sh

#create soft link script to services directory
ln -s /usr/myusr/app/bin/start.sh /etc/init.d/myapp

chmod 555 /etc/init.d/myapp

%preun
#!/bin/sh

#the argument being passed in indicates how many versions will exist
#during an upgrade, this value will be 1, in which case we do not want to stop
#the service since the new version will be running once this script is called
#during an uninstall, the value will be 0, in which case we do want to stop 
#the service and remove the /etc/init.d script.
if [ "$1" = "0" ]
then
    if [ -s "/etc/init.d/myapp" ]
    then
        /etc/init.d/myapp stop
        rm /etc/init.d/myapp
    fi
fi;

%triggerin -- dependency, dependency1
echo "hello from install"

%changelog
* Tue May 23 2000 Vincent Danen <[email protected]> 0.27.2-2mdk
-update BuildPreReq to include rep-gtk and rep-gtkgnome
* Thu May 11 2000 Vincent Danen <[email protected]> 0.27.2-1mdk
-0.27.2
* Thu May 11 2000 Vincent Danen <[email protected]> 0.27.1-2mdk
-added BuildPreReq
-change name from Sawmill to Sawfish

The problem i found is that the files (filter.txt in particular) after the generation process on a Ubuntu system but not on SuSE system. Which might be caused by different rpm versions ? Currently we have an integration test which fails based on the non existing of the file (filter.txt under a buildroot folder?)

© Server Fault or respective owner

Related posts about rpm