source: tags/testbuild/util/arb_save

Last change on this file was 11698, checked in by westram, 11 years ago
  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 1.2 KB
Line 
1#!/bin/bash
2
3NAME=`date '+arbsrc_%Y_%m_%d__%H_%M.tgz'`
4
5dump_revision() {
6    (./SOURCE_TOOLS/build_info.pl 1>&2) && \
7      grep ARB_SVN_REVISION ./TEMPLATES/svn_revision.h | \
8      perl -ne 'if (/ARB_SVN_REVISION\s+\"(.*)\"/) { $_=$1; s/:/_/; print $_; }'
9}
10
11REVISION=`dump_revision`
12REVISION_DIR=arbsrc_$REVISION
13echo REVISION_DIR=$REVISION_DIR
14
15
16rm_noerr() {
17    test -f $1 && rm -f $1 
18}
19cleanup() {
20    # rm_noerr arbsrc.lst
21    rm_noerr arbsrc.lst.tmp
22    test -L $REVISION_DIR && rm $REVISION_DIR
23    true
24}
25
26gen_list() {
27    util/arb_srclst.pl $* > arbsrc.lst.tmp || \
28        ( \
29        echo "Failed to build arbsrc.lst" ; \
30        if [ "$*" != "ignore" ] ; then \
31        echo "To ignore this error save manually using 'make save2' (only works in SVN checkout)"; \
32        fi; \
33        false \
34        )
35}
36sort_list() {
37    sort < arbsrc.lst.tmp | perl -pne "s/^\./.\/$REVISION_DIR/g;" > arbsrc.lst
38}
39gen_tarball() {
40    ln -s . $REVISION_DIR && \
41    tar -zcf $NAME --files-from=arbsrc.lst && \
42        ( rm -f arbsrc.tgz ; \
43        ln -s $NAME arbsrc.tgz ; \
44        true )
45}
46
47save() {
48    gen_list $* && sort_list && gen_tarball
49}
50
51(save $* && cleanup && (ls -alG -rt arbsrc*;true)) || \
52(cleanup;echo "Failed to create source tarball";false)
Note: See TracBrowser for help on using the repository browser.