File: get-orig-source-from-svn

package info (click to toggle)
codeblocks 16.01%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 85,352 kB
  • sloc: cpp: 665,947; ansic: 48,306; sh: 32,198; xml: 29,690; makefile: 6,054; asm: 3,827; python: 3,251; f90: 1,202; pascal: 839; yacc: 291; perl: 261; sed: 16
file content (105 lines) | stat: -rwxr-xr-x 2,851 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#! /bin/sh

# This script is used to generate the codeblocks orig tarball used for this
# package.
# It is based on ubuntus get-orig-source script.
# Modified by Jens Lody (jens@codeblocks.org) to fetch an orig tarball from codeblocks
# subversion archive.

# Some variables to make maintaining this script easier
CODEBLOCKS_BASE_VERSION="16.01svn"
CODEBLOCKS_SVN_URL="http://svn.code.sf.net/p/codeblocks/code/trunk"
CODEBLOCKS_LOCAL_DIR="../codeblocks-$CODEBLOCKS_BASE_VERSION-download/codeblocks-$CODEBLOCKS_BASE_VERSION"
OLD_DIR=`pwd`

USAGE='This script is used to generate the orig tarball used in building 
Debian packages from codeblocks svn (HEAD). 
Usage: get-orig-source-from-svn [OPTION] 
 
 -h, --help                 Display this help message. 
 --remove-upstream-dir      Remove downloaded files.
'

while [ "$#" -gt "0" ]
do
    case "$1" in
        --remove-upstream-dir)
            REMOVE_UPSTREAM_DIR=1
            shift
            ;;
        -h|--help|*)
            echo >&2 "${USAGE}"
            exit 1
            ;;
    esac
done

set -e

# Function to download files. Takes two parameters, the directory name of the
# url to use, and the filename of the file.
download() {
    local url="$1"
    local target="$2"
    mkdir -p $target
    svn co $1 $2 --non-interactive
}

# The rest is our main functions.
#Download the files
echo "Now downloading svn sources"
download $CODEBLOCKS_SVN_URL $CODEBLOCKS_LOCAL_DIR

# cd to source-dir
echo "change directory to $CODEBLOCKS_LOCAL_DIR"
cd $CODEBLOCKS_LOCAL_DIR

# update Changelog
echo "update Changelog"
./updateChangeLog.sh

# run bootstrap
echo "update/create Makefile's and configure-script"
./bootstrap

# fetching actual svn-revision
if svn --xml info >/dev/null 2>&1; then
	SVN_REV=`svn --xml info | tr -d '\r\n' | sed -e 's/.*<commit.*revision="\([0-9]*\)".*<\/commit>.*/\1/'`
elif svn --version --quiet >/dev/null 2>&1; then
	SVN_REV=`svn info | grep "^Revision:" | cut -d" " -f2`
else
	SVN_REV=0
fi

if [ "$SVN_REV" -eq "0" ]; then
    echo "Error retrieving svn version, can not continue !"
    exit 1
fi

CODEBLOCKS_ORIG_TARBALL=codeblocks_$CODEBLOCKS_BASE_VERSION$SVN_REV.orig.tar.gz

if [ -f ../../$CODEBLOCKS_ORIG_TARBALL ]; then
    echo "We already have the newest revision in $CODEBLOCKS_ORIG_TARBALL ."
    exit 0
fi


# Create source tarball
echo "Create sources tarball"
#echo "pre-configuring sources"
#./configure --enable-keep-dlls=no
cd ..
echo "creating tarball $CODEBLOCKS_ORIG_TARBALL "
tar zcf $CODEBLOCKS_ORIG_TARBALL --exclude=".svn" --exclude="autom4te.cache" --exclude="*.dll" codeblocks-$CODEBLOCKS_BASE_VERSION

# Move tarball to right directory
mv $CODEBLOCKS_ORIG_TARBALL ..

cd $OLD_DIR
./update_revision.sh

# Perform cleanup
if [ ! -z "$REMOVE_UPSTREAM_DIR" ]; then
    echo "Removing upstream files."
    rm -rf $CODEBLOCKS_LOCAL_DIR
fi