last fuzzy translated...
[midnight-commander.git] / maint / mcsnap
blobc3c01a9b209695a7eafd874510f16f595d02adce
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 # upload to .in* files, then rename.
10 # build tarball, select level of testing
11 # (dist, distcheck, warning checks)
14 set -e
16 # Version to make patches against.
17 # Make sure to have it unpacked in /usr/src
18 BASE_VERSION="4.6.0-pre1"
20 # Local directories
21 MC_BASE_DIR="/usr/src/mc-$BASE_VERSION"
22 RPM_SRC_DIR="/usr/src/redhat"
24 # Location of the snapshot directory
25 SITE="login.ibiblio.org"
26 DIR="/public/ftp/pub/Linux/utils/file/managers/mc/snapshots"
28 MCVERSION=`ls mc*.tar.gz | sort | sed -n '$s/\.tar\.gz//p'`
29 MCNAME=mc-`date "+%Y-%m-%d-%H" --utc`.tar.gz
30 MCTARBALL="$MCVERSION.tar.gz"
32 if test -z "$MCVERSION" || test ! -f "$MCTARBALL"; then
33 echo "No tarball found!!!"
34 exit 1
37 rm -f $RPM_SRC_DIR/RPMS/i386/mc-*.i386.rpm
38 rpm -tb "$MCTARBALL"
39 MC_RPM=`echo $RPM_SRC_DIR/RPMS/i386/mc-*.i386.rpm`
40 if test ! -f $MC_RPM; then
41 echo "Failed to compile package!!!"
42 exit 1
45 # Make a patch against the latest released version
46 MC_PATCH="mc-$BASE_VERSION-current.diff.bz2"
47 if test ! -d $MC_BASE_DIR; then
48 echo "Cannot find unpacked base version!!!"
49 exit 1
51 rm -f mc-$BASE_VERSION-current.diff mc-$BASE_VERSION-current.diff.bz2
53 # Don't bother to merge PO-files, we are skipping them in the patch
54 make distdir MSGMERGE=
56 # Sometimes GNU diff returns 1 for unclear reasons
57 diff -urN -x po $MC_BASE_DIR mc-*/ >mc-$BASE_VERSION-current.diff || :
58 bzip2 mc-$BASE_VERSION-current.diff
60 echo "Copying $MCTARBALL to $SITE"
61 scp "$MCTARBALL" "$SITE:$DIR/$MCNAME"
63 # Remove old tarballs
64 MCFILES=`ssh $SITE ls $DIR | egrep '^mc.*\.tar\.gz' | sort | sed '$d'`
65 for i in $MCFILES; do
66 echo "Removing $i"
67 ssh $SITE rm -f "$DIR/$i"
68 done
70 echo "Copying $MC_RPM to $SITE"
71 scp "$MC_RPM" "$SITE:$DIR/"
73 # Remove old RPM packages
74 MCFILES=`ssh $SITE ls $DIR | egrep '^mc.*\.rpm' | sort | sed '$d'`
75 for i in $MCFILES; do
76 echo "Removing $i"
77 ssh $SITE rm -f "$DIR/$i"
78 done
80 echo "Copying $MC_PATCH to $SITE"
81 scp "$MC_PATCH" "$SITE:$DIR/"
83 # Remove old patches
84 MCFILES=`ssh $SITE ls $DIR | egrep '^mc.*\.diff\.bz2' | sort | sed '$d'`
85 for i in $MCFILES; do
86 echo "Removing $i"
87 ssh $SITE rm -f "$DIR/$i"
88 done
91 echo "Done"