Setting the environment to build rpms

To be ble to build rpms (and modify them) in your home directory, you have to :

  • make the directories : mkdir -p ~/rpmbuild/{SPECS,SOURCES,RPMS,SRPMS}
  • define a ~/.rpmmacros file with the following content : %_topdir %(echo $HOME)/rpmbuild

You can then unpack source rpms : rpm -Uvh mypackage.src.rpm

The rpm {pre,post}[un]install scripts

The problem with these scripts is that they are not run in the most obvious order when we upgrade a package.
Here's how RPM performs an upgrade:

  • Run %pre of new package
  • Install new files
  • Run %post of new package
  • Run %preun of old package
  • Delete any old files not overwritten by newer ones
  • Run %postun of old package

Here are the actual values passed in $1 during an install:

  • Run %pre of new package (1)
  • Install new files
  • Run %post of new package (1)

Here are the values passed in $1 during an upgrade:

  • Run %pre of new package (2)
  • Install new files
  • Run %post of new package (2)
  • Run %preun of old package (1)
  • Delete any old files not overwritten by newer ones
  • Run %postun of old package (1)

Here are the values passed in $1 during a delete:

  • Run %preun of old package (0)
  • Delete files
  • Run %postun of old package (0)

So we end up with scripts like this in our rpm [un]install scripts :

%post
if [ "$1" = "1" ] ; then  # first install
 if [ -x /sbin/install-info ]; then
   /sbin/install-info /usr/local/info/indent.info /usr/local/info/dir
 fi
fi

%preun
if [ "$1" = "0" ] ; then # last uninstall
 if [ -x /sbin/install-info ]; then
   /sbin/install-info --delete /usr/local/info/indent.info /usr/local/info/dir
 fi
fi

Most of this chapter on [un]install scripts is taken from the webpage http://www.ibm.com/developerworks/library/l-rpm3.html from Dan Poirier (poirier@usNOSPAMPLEASE.ibm.com), Software engineer, IBM

Where are stored the LHCb Online rpms

The main repository is : /afs/cern.ch/lhcb/project/web/online/online-rpm-repo/{slc4X,...}/{i386,i686,noarch,SRPMS,x86_64}/[RPMS/]
It is automatically copied in /sw/lhcb-rpm/online/ on the LHCb network.

Don't forget to copy also the source rpm !

Links

Edit | Attach | Watch | Print version | History: r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r1 - 2008-03-11 - LoicBrarda
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    LHCb All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback