#!/bin/sh # HELM project convenience script # # call this as "debian/debianize.helm" to convert a checked out CVS # module to a debianize source tree ready to be called against debuild # or dpkg-buildpackage # # Stefano "Zack" Zacchiroli # Sun Nov 25 16:50:10 CET 2001 NAME="MINIDOM" # package name in configure.in's opinion CONFIGURE_IN="configure.in" # configure.in # TAR="tar" # TARFLAGS="-cz" # tar flags used when creating source package if [ -z $NAME ]; then echo "Please edit me and configure the 'NAME' parameter." exit 1 fi # parse version number from configure.in echo "Retrieving version number from $CONFIGURE_IN ..." VERSION="" for v in MAJOR MINOR MICRO; do T=`grep "$NAME\_$v\_VERSION\=" $CONFIGURE_IN` T=`echo $T | sed -e 's/.*=//'` if [ -z $VERSION ]; then VERSION=$T else VERSION="$VERSION.$T" fi done echo "Version number is: $VERSION" # create a new working dir named with the "name-version" schema echo "Creating debianized source tree ..." OLDDIR=`basename \`pwd\`` NEWDIR="$OLDDIR-$VERSION" cd .. if [ -d $NEWDIR ]; then echo "'../$NEWDIR' already exists, please remove it before continue" exit 1 fi cp -r $OLDDIR $NEWDIR cd $NEWDIR echo "Debianized source tree starts at `pwd`" # autopippe: autoconf, automake, aclocal, ... echo "Executing auto-* tools ..." source debian/autopippe.helm echo "auto-* executed!" # remove CVS related files, and other garbage echo "Removing garbage files ..." find . -regex '.*\.cvsignore' -exec rm -f {} \; find . -regex '.*CVS.*' -and -type d -exec rm -rf {} \; GARBAGES=`egrep -v '^#' debian/garbage.helm` for p in $GARBAGES; do find . -name $p -exec rm -f {} \; done echo "Garbage removed!" # fix remote symlinks echo "Dereferencing absolute symlinks ..." PWD=`pwd` for l in `find . -type l -maxdepth 1`; do # loop on symlink in this dir SOURCE=$l TARGET=`readlink $l` if `echo $TARGET | egrep "^/" > /dev/null`; then echo "$SOURCE -> $TARGET" rm -f $SOURCE cp $TARGET $SOURCE fi # if symlink does not begin with "/" then it is relative done echo "Dereferencing done!" # upgrade debian changelog echo "Upgrading debian changelog version to $VERSION ..." dch --newversion $VERSION echo "Debian changelog upgraded!" # # build debian native source package # echo -n "Building debian (native) source package: " # DEBVERSION=`dpkg-parsechangelog -ldebian/changelog | egrep '^Version: ' | sed -e 's/Version: //'` # DEBNAME=`dpkg-parsechangelog -ldebian/changelog | egrep '^Source: ' | sed -e 's/Source: //'` # SOURCEPKGFILE="$DEBNAME""_""$DEBVERSION.tar.gz" # echo "../$SOURCEPKGFILE" # cd .. # $TAR $TARFLAGS -f $SOURCEPKGFILE $NEWDIR echo echo "Debianization is over." echo "Please change to ../$NEWDIR in order to build the debian package."