[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Gnus: a mkgnus script



Hi,

	I love Gnus; and have been on the ding mailing list since way
 back when (before I came to Debian, I think). And so I loved it when
 it was packaged for Debian -- but the version packages was 5.6.27, in
 a week or so, we are at 5.6.31! Gnus development has ever been like
 this. 

	So what I did was to grab the debian directory created by
 Michael Alan Dorman <mdorman@debian.org> (thanks, Michael), add to
 the changelog as goven below, and stash the tar file in
 /usr/local/share/emacs/site-lisp/ 

	I wrote the script below, called mkgnus; and now, I can fire
 of mkgnus; which downloades the latest version from the upstream site
 using wget; untars it, untars the debian files, edits  the changelog
 to put in the version number, optionally copies custom files in (not
 needed any more); and creats a .deb file. All this with no human
 intervention. I load the .deb file. and away I go. No fuss. 

	I though I would share this with people. Do you think that
 this deserves to be a separate package? 

	I hope this proves useful to someone else as well.

	manoj

The new changelog file (note the XXXX which shall be replaced by a
real version). The rest of the files were unchanged from theofficial
version. 
______________________________________________________________________
gnus (XXXX-1) unstable; urgency=low

  * Auto compiled .deb file, personally created by Manoj Srivastave for
    internal use. The date below is irrelevant.

 -- Manoj Srivastava <srivasta@debian.org>  Sun,  9 Aug 1998 16:13:17 -0500

gnus (5.6.27-1) unstable; urgency=low

  * Initial Debianization.

 -- Michael Alan Dorman <mdorman@debian.org>  Mon, 03 Aug 1998 12:27:41 -0500

Local variables:
mode: debian-changelog
user-mail-address: "mdorman@debian.org"
End:
______________________________________________________________________

	Now for the script, mkgnus
______________________________________________________________________
#! /bin/bash

set -e
progname="`basename \"$0\"`"
pversion='$Revision: 1.11 $'

GNUSNAME="gnus"
GNUS_TARNAME="${GNUSNAME}.tar.gz"
GNUS_URL="http://www.gnus.org/${GNUS_TARNAME}";
GNUS_TARFILE="/tmp/${GNUSNAME}.tar.gz"
DEBIAN_FILES="/usr/local/share/emacs/site-lisp/debian-gnus.tar.gz"

LISPDIR="/usr/local/share/emacs/site-lisp"
DESTDIR="/usr/local/share/emacs/19.34/site-lisp"
action='withecho'
customcopy="NO"

withecho () {
        echo " $@" >&2
        "$@"
}

usageversion () {
        cat >&2 <<END
Debian GNU/Linux $progname $pversion.
           Copyright (C) 1997 Manoj Srivastava.
This is free software; see the Artistic Licence for copying
conditions.  There is NO warranty.  

Usage: $progname  [options]
Options: 
 -h                This help
 -N <name>         Name of this gnus version (default $GNUSNAME)
 -f <file.tar.gz>  Downloaded tar sources (if not present, shall be acquired
                       from $GNUS_URL)
 -u <URL>          The URL to try (default $GNUS_URL)
 -d <dir>          The Lisp directory where to unpack things. (default
                       $LISPDIR)
 -n                Noaction.
 -r <root cmd>     Root command
 -nC               
END
}


# get an argument file name
# Command line
while [ $# != 0 ]; do
    value="`echo x\"$1\" | sed -e 's/^x-.//'`"
    case "$1" in
        -h)  usageversion; exit 0 ;;
        -N*) GNUSNAME="$value" ;;
        -f*) TEMPFILE="$value" ;;
        -u*) GNUS_URL="$value" ;;
        -d*) LISPDIR="$value" ;;
        -V*) opt_version="$value" ;;
        -W*) opt_workdir="$value" ;;
        -d)  opt_DEBUG=1 ;;
        -n)  action='echo' ;;
        -r*) rootcommand="$value" ;;
        -nC*) customcopy="NO" ;;
        -*)  usageversion; exit 1  ;;
        *)   usageversion; exit 1  ;;
    esac
    shift
done

if [ "X$TEMPFILE" = "X" ]; then
    echo >&2 "Getting the file from upstream sources"

    rm -f ${GNUS_TARFILE}
    TEMPFILE=`tempfile -n ${GNUS_TARFILE}`

    eval "$action wget --dot-style=binary -cO $TEMPFILE $GNUS_URL "
fi

eval "$action cd $LISPDIR "

echo >&2 "Removing old versions"
eval "$action $rootcommand rm -rf gnus $GNUSNAME-* "


echo >&2 "Unpacking the new version."
eval "$action $rootcommand tar zvvfx $TEMPFILE "
eval "$action $rootcommand ln -s $GNUSNAME-* gnus "

VERSION=$(echo $GNUSNAME-* | sed -e "s/$GNUSNAME-//g");
DATE=$(date -R)

eval "$action cd gnus "
if [ -f $DEBIAN_FILES ]; then
    eval "$action $rootcommand tar zfx $DEBIAN_FILES; "
    eval "$action $rootcommand perl -pli~ -e s/XXXX/$VERSION/ debian/changelog;"
    eval "$action $rootcommand rm -f debian/changelog~";
fi

# Copy the custom files as desired
if [ "X$customcopy" = "XYES" ]; then
    echo >&2 "Copy the custom files as desired"
    eval "$action cp ../custom-1.9961/{cus,wid}*.el lisp"
fi

if [ -d debian ]; then
    eval "$action $rootcommand fakeroot  ./debian/rules binary; "
    eval "$action $rootcommand rm -rf gnus $GNUSNAME-* "
else
    echo >&2 "configure the new version"
    eval "$action $rootcommand bash ./configure "


    echo >&2 "Byte compile the new version"
    eval "$action $rootcommand make "

    echo >&2 "Move files to final destination"
    eval "$action mv -f lisp/*.elc $DESTDIR"
fi


rm -f $TEMPFILE 

exit 0

# End program
______________________________________________________________________

-- 
 Some people carve careers, others chisel them.
Manoj Srivastava  <srivasta@acm.org> <http://www.datasync.com/%7Esrivasta/>
Key C7261095 fingerprint = CB D9 F4 12 68 07 E4 05  CC 2D 27 12 1D F5 E8 6E


Reply to: