views:

392

answers:

2

here is my scenario

  • our team develops on AIX
  • dozens of applications, mostly Perl, shell scripts, batch java, C
  • i would like to simplify deployment/rollback procedures - currently using plain old tarballs with backups
  • I looked into installp vs. rpm for packaging (see my SO question) and decided to go with rpm - better docs, plus IBM included it while having their own packaging tool, so this is a valid reason for me
  • i would want to use a separate rpm db, not the main one - for I don't have root access and I also feel it would be beneficial to separate OS apps from our stuff.


the workflow would look like:

  • each app has a corresponding rpm.spec - checked-in into source control
  • build an rpm in a home dir
  • install/upgrade while using our own packages.rpm

NOTE : I will use this question as notes to myself as I proceed


+1  A: 

building rpm's in my home :

1.

I need a .rpmmacros file in my user's root which overrides some system-wide rpm settings

%_signature gpg
%_gpg_name {yourname}
%_gpg_path ~/.gnupg
%distribution AIX 5.3
%vendor {Northwind? :)}
%make   make

2.

this will create directory structure needed for rpm builds, it will also update .rpmmacros

#!/bin/sh

[ "x$1" = "x-d" ] && {
DEBUG="y"
export DEBUG
shift 1
}

IAM=`id -un`
PASSWDDIR=`grep ^$IAM: /etc/passwd | awk -F":" '{print $6}'`
HOMEDIR=${HOME:=$PASSWDDIR}

[ ! -d $HOMEDIR ] && {
echo "ERROR: Home directory for user $IAM not found in /etc/passwd."
exit 1
}

RHDIR="$HOMEDIR/rpmbuild"
RPMMACROS="$HOMEDIR/.rpmmacros"
touch $RPMMACROS

TOPDIR="%_topdir"
ISTOP=`grep -c ^$TOPDIR $RPMMACROS`
[ $ISTOP -lt 1 ] && {
echo "%_topdir      $HOMEDIR/rpmbuild" >> $RPMMACROS
}

TMPPATH="%_tmppath"
ISTMP=`grep -c ^$TMPPATH $RPMMACROS`
[ $ISTMP -lt 1 ] && {
echo "%_tmppath $HOMEDIR/rpmbuild/tmp" >> $RPMMACROS
}

[ "x$DEBUG" != "x" ] && {
echo "$IAM       $HOMEDIR    $RPMMACROS"
echo "$RHDIR     $TOPDIR     $ISTOP"
}

[ ! -d $RHDIR ] && mkdir -p $RHDIR

cd $RHDIR 
for i in RPMS SOURCES SPECS SRPMS BUILD tmp ; do 
[ ! -d ./$i ] && mkdir ./$i 
done

exit 0

you could check if rpm picked up your changes with :

rpm --showrc | grep topdir

3.

specify a non-default location of the RPM database, such as the following:

rpm --dbpath /location/of/your/rpm/database --initdb
webwesen
A: 

I usually check in my spec files to the same place that my code is.

I run a build server (I use Hudson) to kick off a build every night (could be continuous but I chose nightly). The build server checks out the code, builds it, and runs rpmbuild. Hudson sets up a workspace folder that can be deleted after each build so if you set %_topdir to point to that area then you can guarantee there won't be build artifacts left over from a previous build. At the end of the build I check my rpms into version control with a comment containing the build number.

Rolling back is a matter of pulling out the last good rpm from version control, erasing the current rpm, and installing the old rpm.

Sounds like you already have a good handle on using your own package db.

rancidfishbreath