]> matita.cs.unibo.it Git - helm.git/blob - helm/minidom/debian/debianize.helm
ocaml 3.09 transition
[helm.git] / helm / minidom / debian / debianize.helm
1 #!/bin/sh
2
3 # HELM project convenience script
4 #
5 # call this as "debian/debianize.helm" to convert a checked out CVS
6 # module to a debianize source tree ready to be called against debuild
7 # or dpkg-buildpackage
8 #
9 # Stefano "Zack" Zacchiroli <zack@cs.unibo.it>
10 # Sun Nov 25 16:50:10 CET 2001
11
12 NAME="MINIDOM" # package name in configure.in's opinion
13 CONFIGURE_IN="configure.in"   # configure.in
14
15 # TAR="tar"
16 # TARFLAGS="-cz"   # tar flags used when creating source package
17
18 if [ -z $NAME ]; then
19    echo "Please edit me and configure the 'NAME' parameter."
20    exit 1
21 fi
22
23    # parse version number from configure.in
24 echo "Retrieving version number from $CONFIGURE_IN ..."
25 VERSION=""
26 for v in MAJOR MINOR MICRO; do
27    T=`grep "$NAME\_$v\_VERSION\=" $CONFIGURE_IN`
28    T=`echo $T | sed -e 's/.*=//'`
29    if [ -z $VERSION ]; then
30       VERSION=$T
31    else
32       VERSION="$VERSION.$T"
33    fi
34 done
35 echo "Version number is: $VERSION"
36
37    # create a new working dir named with the "name-version" schema
38 echo "Creating debianized source tree ..."
39 OLDDIR=`basename \`pwd\``
40 NEWDIR="$OLDDIR-$VERSION"
41 cd ..
42 if [ -d $NEWDIR ]; then
43    echo "'../$NEWDIR' already exists, please remove it before continue"
44    exit 1
45 fi
46 cp -r $OLDDIR $NEWDIR
47 cd $NEWDIR
48 echo "Debianized source tree starts at `pwd`"
49
50    # autopippe: autoconf, automake, aclocal, ...
51 echo "Executing auto-* tools ..."
52 source debian/autopippe.helm
53 echo "auto-* executed!"
54
55    # remove CVS related files, and other garbage
56 echo "Removing garbage files ..."
57 find . -regex '.*\.cvsignore' -exec rm -f {} \;
58 find . -regex '.*CVS.*' -and -type d -exec rm -rf {} \;
59 GARBAGES=`egrep -v '^#' debian/garbage.helm`
60 for p in $GARBAGES; do
61    find . -name $p -exec rm -f {} \;
62 done
63 echo "Garbage removed!"
64
65    # fix remote symlinks
66 echo "Dereferencing absolute symlinks ..."
67 PWD=`pwd`
68 for l in `find . -type l -maxdepth 1`; do # loop on symlink in this dir
69    SOURCE=$l
70    TARGET=`readlink $l`
71    if `echo $TARGET | egrep "^/" > /dev/null`; then
72       echo "$SOURCE -> $TARGET"
73       rm -f $SOURCE
74       cp $TARGET $SOURCE
75    fi # if symlink does not begin with "/" then it is relative
76 done
77 echo "Dereferencing done!"
78
79    # upgrade debian changelog
80 echo "Upgrading debian changelog version to $VERSION ..."
81 dch --newversion $VERSION
82 echo "Debian changelog upgraded!"
83
84 #    # build debian native source package
85 # echo -n "Building debian (native) source package: "
86 # DEBVERSION=`dpkg-parsechangelog -ldebian/changelog | egrep '^Version: ' | sed -e 's/Version: //'`
87 # DEBNAME=`dpkg-parsechangelog -ldebian/changelog | egrep '^Source: ' | sed -e 's/Source: //'`
88 # SOURCEPKGFILE="$DEBNAME""_""$DEBVERSION.tar.gz"
89 # echo "../$SOURCEPKGFILE"
90 # cd ..
91 # $TAR $TARFLAGS -f $SOURCEPKGFILE $NEWDIR
92
93 echo
94 echo "Debianization is over."
95 echo "Please change to ../$NEWDIR in order to build the debian package."
96
97