sde-commit: Changed commit message generator to use pkg: instead of [pkg]
[opensde-nopast.git] / scripts / Create-SrcTar
blob7327585b75d558b5cb8bdd0fdbaa4c4e8a90db00
1 #!/bin/bash
2 # --- SDE-COPYRIGHT-NOTE-BEGIN ---
3 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
5 # Filename: scripts/Create-SrcTar
6 # Copyright (C) 2006 - 2008 The OpenSDE Project
7 # Copyright (C) 2004 - 2006 The T2 SDE Project
8 # Copyright (C) 1998 - 2003 Clifford Wolf
10 # More information can be found in the files COPYING and README.
12 # This program is free software; you can redistribute it and/or modify
13 # it under the terms of the GNU General Public License as published by
14 # the Free Software Foundation; version 2 of the License. A copy of the
15 # GNU General Public License can be found in the file COPYING.
16 # --- SDE-COPYRIGHT-NOTE-END ---
18 sderootdirs="scripts bin etc lib doc src package architecture target"
19 sderootfiles="README COPYING"
21 eval "$( egrep '^sdever=' lib/libsde.in )"
23 echo -n 'Creating source tar ... '
25 # Create temp source base dir
27 tmp="`mktemp -d -p $PWD src.srctar.XXXXXXXXXX`"
28 srctar=opensde-$sdever
29 [ -d ".svn/" ] && srctar="$srctar-r$( svn info --xml | sed -n -e 's, *revision="\([0-9]*\)".*,\1,p' | head -n 1 )"
31 rm -rf "$tmp/$srctar"
32 mkdir -p "$tmp/$srctar"
34 # Create tar file
38 cd "$tmp"
40 # Directories
43 for x in $sderootdirs; do
44 ln -s ../../$x "$srctar/$x"
45 y="$y $srctar/$x/*"
46 done
48 #Files
50 for x in $sderootfiles; do
51 cp ../$x "$tmp/$srctar/$x"
52 y="$y $srctar/$x"
53 done
55 tar --owner root --group root \
56 --exclude .svn --exclude CVS \
57 --exclude .git -cO $y
58 ) | bzip2 -c - > ${1:-$srctar.tar.bz2}.$$
60 # Done.
62 rm -rf $tmp/
63 mv ${1:-$srctar.tar.bz2}.$$ ${1:-$srctar.tar.bz2}
64 du -sh ${1:-$srctar.tar.bz2} | tr '\t' ' '