webwesen
webwesen

Reputation: 1262

How to deploy home-grown applications with rpm?

here is my scenario


the workflow would look like:

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


Upvotes: 2

Views: 1376

Answers (2)

rancidfishbreath
rancidfishbreath

Reputation: 3994

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.

Upvotes: 0

webwesen
webwesen

Reputation: 1262

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

Upvotes: 1

Related Questions