~ubuntu-branches/ubuntu/quantal/gcc-defaults/quantal-proposed

« back to all changes in this revision

Viewing changes to debian/.svn/text-base/rebuild-gcj-db.svn-base

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2011-07-09 19:23:28 UTC
  • mto: This revision was merged to the branch mainline in revision 66.
  • Revision ID: james.westby@ubuntu.com-20110709192328-2qjsb8io27h12uri
Tags: 1.107
* Enable multiarch build for libgcj-bc. Closes: #633359.
* Don't care about gc[cj]-4.6 build dependencies on m68k.
* Fix last references to obsolete gcj package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/bash
 
2
 
 
3
set -e
 
4
 
 
5
if [ $# -gt 1 ]; then
 
6
    cat 1>&2 <<-EOF
 
7
        rebuild-gcj-db: re-build the gcj classmap database
 
8
        
 
9
        usage: $0 [install|remove]
 
10
        EOF
 
11
    exit 1
 
12
fi
 
13
 
 
14
mode=install
 
15
case "$1" in
 
16
    install|remove)
 
17
        mode=$1;;
 
18
esac
 
19
 
 
20
uname=$(uname -m)
 
21
 
 
22
rebuild_db()
 
23
{
 
24
    dbtool=$1; shift
 
25
    dbLocation=$1; shift
 
26
    dirs=
 
27
 
 
28
    for dir; do [ -d $dir ] && dirs="$dirs $dir"; done
 
29
    if [ -z "$dirs" ]; then
 
30
        # no more dirs with .db files on the system
 
31
        return 0
 
32
    fi
 
33
    mkdir -p $(dirname $dbLocation)
 
34
    if $dbtool -n $dbLocation.tmp 64; then
 
35
        :
 
36
        #case "$uname" in parisc*)
 
37
        #    echo >&2 "$dbtool succeeded unexpectedly"
 
38
        #esac
 
39
    else
 
40
        case "$uname" in
 
41
            m68k)
 
42
                echo >&2 "ERROR: $dbtool did fail; known problem on $uname"
 
43
                return 0;;
 
44
            *)
 
45
                exit 2
 
46
        esac
 
47
    fi
 
48
    find $dirs -follow -name '*.db' -print0 | \
 
49
        xargs -r -0 $dbtool -m $dbLocation.tmp $dbLocation.tmp || exit 1
 
50
    mv $dbLocation.tmp $dbLocation
 
51
}
 
52
 
 
53
 
 
54
rebuild_databases()
 
55
{
 
56
    v=$1
 
57
    dbtool=gcj-dbtool-$1
 
58
    dbLocation=`$dbtool -p || true`
 
59
 
 
60
    if [ -n "$dbLocation" ]; then
 
61
        case "$uname" in m68k)
 
62
            echo >&2 "$dbtool succeeded unexpectedly"
 
63
        esac
 
64
    else
 
65
        case "$uname" in
 
66
            m68k)
 
67
                echo >&2 "ERROR: $dbtool did fail; known problem on $uname"
 
68
                return 0;;
 
69
            *)
 
70
                exit 2
 
71
        esac
 
72
    fi
 
73
 
 
74
    if [ "$mode" = remove ] && [ ! -f "$dbLocation" ]; then
 
75
        # libgcj7-0 or libgcj8 are already removed; no need
 
76
        # to rebuild anything
 
77
        return 0
 
78
    fi
 
79
    rebuild_db \
 
80
        $dbtool \
 
81
        $dbLocation \
 
82
        /usr/share/gcj/classmap.d \
 
83
        /usr/share/gcj-$v/classmap.d
 
84
}
 
85
 
 
86
# still different databases for each gcj-4.x
 
87
 
 
88
if which gcj-dbtool-4.6 >/dev/null 2>&1; then
 
89
    rebuild_databases 4.6
 
90
fi
 
91
 
 
92
if which gcj-dbtool-4.5 >/dev/null 2>&1; then
 
93
    rebuild_databases 4.5
 
94
fi
 
95
 
 
96
if which gcj-dbtool-4.4 >/dev/null 2>&1; then
 
97
    rebuild_databases 4.4
 
98
fi