Last fuzzy updated...
[midnight-commander.git] / maint / mcsnap
blob104efe4cf462d0bd1964b8df10b96312d9f8e4a3
1 #! /bin/sh
3 # This script takes the compiled tarball, makes an RPM package and
4 # a patch against the latest released version, then uploads
5 # everything over ssh and removes old snapshots.
6 # Run this script in the directory where mc was built.
8 # TODO:
9 # build tarball, select level of testing
10 # (dist, distcheck, warning checks)
13 # $1 - file to upload, $2 - shell mask to erase
14 function upload() {
15 echo "Uploading $1 to $SITE"
16 name="`basename $1`"
17 scp "$1" "$SITE:$DIR/.in.$name"
18 ssh $SITE "rm -f $DIR/$2; mv $DIR/.in.$name $DIR/$name"
21 set -e
23 # Version to make patches against.
24 # Make sure to have it unpacked in /usr/src
25 BASE_VERSION="4.6.0-pre1"
27 # Local directories
28 MC_BASE_DIR="/usr/src/mc-$BASE_VERSION"
29 MC_CVS_DIR="/usr/src/mc"
30 MC_BUILD_DIR="/usr/src/mc.snap"
31 RPM_SRC_DIR="/usr/src/redhat"
33 # Location of the snapshot directory
34 SITE="login.ibiblio.org"
35 DIR="/public/ftp/pub/Linux/utils/file/managers/mc/snapshots"
37 cd "$MC_CVS_DIR"
38 cvs up -dPA
39 rm -rf "$MC_BUILD_DIR"
40 cp -a "$MC_CVS_DIR" "$MC_BUILD_DIR"
41 cd "$MC_BUILD_DIR"
43 # Sanity check
44 if ! test -f ./autogen.sh || ! test -f src/screen.c; then
45 echo "Not in the MC CVS working directory"
46 exit 1
49 # Remove old tarballs and build the new one
50 rm -f "mc*.tar.gz"
51 MCVERSION=`date "+%Y-%m-%d-%H" --utc`
52 cp -f configure.in configure.in.cvs
53 sed "s/AM_INIT_AUTOMAKE([^)]*)/AM_INIT_AUTOMAKE(mc, $MCVERSION)/" \
54 configure.in.cvs >configure.in
55 ./autogen.sh
56 make all
57 make distcheck
59 # Make sure that the new tarball exists
60 MCTARBALL="mc-$MCVERSION.tar.gz"
61 if test ! -f "$MCTARBALL"; then
62 echo "No tarball found!!!"
63 exit 1
66 # Make an RPM package
67 rm -f $RPM_SRC_DIR/RPMS/i386/mc-*.i386.rpm
68 rm -rf $RPM_SRC_DIR/BUILD/mc-*/
69 rpmbuild -tb "$MCTARBALL"
70 MC_RPM=`echo $RPM_SRC_DIR/RPMS/i386/mc-*.i386.rpm`
71 if test ! -f $MC_RPM; then
72 echo "Failed to compile package!!!"
73 exit 1
76 # Make a patch against the latest released version
77 MC_PATCH="mc-$BASE_VERSION-$MCVERSION.diff"
78 MC_PATCH_BZ2="$MC_PATCH.bz2"
79 if test ! -d $MC_BASE_DIR; then
80 echo "Cannot find unpacked base version!!!"
81 exit 1
83 rm -f $MC_PATCH $MC_PATCH_BZ2
85 # Don't merge PO-files, we are skipping them in the patch
86 make distdir MSGMERGE=false
88 # Sometimes GNU diff returns 1 for unclear reasons
89 diff -urN -x po $MC_BASE_DIR mc-*/ >$MC_PATCH || :
90 bzip2 $MC_PATCH
92 upload "$MCTARBALL" "mc*.tar.gz"
93 upload "$MC_RPM" "mc*.i386.rpm"
94 upload "$MC_PATCH_BZ2" "mc*.diff.bz2"
96 echo "Done"