~ubuntu-branches/ubuntu/intrepid/kdesdk/intrepid-updates

« back to all changes in this revision

Viewing changes to scripts/create_svnignore

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2008-05-28 10:11:43 UTC
  • mto: This revision was merged to the branch mainline in revision 37.
  • Revision ID: james.westby@ubuntu.com-20080528101143-gzc3styjz1b70zxu
Tags: upstream-4.0.80
ImportĀ upstreamĀ versionĀ 4.0.80

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/sh
 
1
#!/usr/bin/env bash
2
2
# This script makes a preliminary svn:ignore in the current dir by
3
3
# adding some standard stuff according to Makefile.am.
4
4
# License: GPL
26
26
        (
27
27
        cd $1
28
28
        trap "rm svnignore.tmp" 1 2 15
29
 
        if test -f Makefile.am; then
 
29
        addedsomething=0
 
30
        if test -f CMakeLists.txt; then
 
31
                if test $recurse -eq 1; then
 
32
                        echo "Entering $1"
 
33
                fi
 
34
                addignore Makefile
 
35
        addignore CMakeFiles
 
36
        addignore cmake_install.cmake
 
37
        addignore DartTestfile.txt
 
38
        addignore install_icons.cmake
 
39
        addignore progress.make
 
40
                grep -q kde4_automoc CMakeLists.txt && addignore "*.moc" 
 
41
                grep -q kde4_add_dcop_skels CMakeLists.txt && addignore "*.kidl"
 
42
                grep -q kde4_add_dcop_skels CMakeLists.txt && addignore "*_skel.c*"
 
43
                grep -q kde4_add_dcop_stubs CMakeLists.txt && addignore "*_stub.cpp"
 
44
                #TODO add binary
 
45
 
 
46
        elif test -f Makefile.am; then
30
47
                if test $recurse -eq 1; then
31
48
                        echo "Entering $1"
32
49
                fi
33
50
                addignore Makefile
34
51
                addignore Makefile.in
35
 
 
36
 
                bins=`perl -p -e 's/\\\s*\n/ /g' Makefile.am | egrep '_PROGRAMS|_LTLIBRARIES|_LIBRARIES' | sed -e 's/.*=\s*//;s/#.*//;s/\$([^)]*)//'`
 
52
                
 
53
                bins=`perl -p -e 's/\\\s*\n/ /g' Makefile.am | grep _PROGRAMS | sed -e 's/.*=\s*//;s/#.*//;s/\$([^)]*)//'`
37
54
                if test -n "$bins"; then
38
55
                        addignore ".libs"
39
56
                        addignore ".deps"
46
63
                fgrep -q .skel Makefile.am && addignore "*.kidl"
47
64
                fgrep -q .skel Makefile.am && addignore "*_skel.c*"
48
65
                fgrep -q .stub Makefile.am && addignore "*_stub.cpp"
49
 
                if fgrep -q .ui Makefile.am; then
50
 
                        uis=`ls -1 *.ui 2>/dev/null`
51
 
                        for ui in $uis; do
52
 
                                addignore ${ui/.ui/.h}
53
 
                                addignore ${ui/.ui/.cpp}
54
 
                        done
55
 
                fi
56
66
                
57
67
                grep -q "^include.*/Doxyfile.am$" Makefile.am && addignore "Doxyfile"
58
 
 
59
 
                if test "$addedsomething" = 1; then
60
 
                    svn propset svn:ignore -F svnignore.tmp .
 
68
        else
 
69
                qmakefiles=`ls -1 *.pro 2>/dev/null`
 
70
                if test -n "$qmakefiles"; then
 
71
                        if test $recurse -eq 1; then
 
72
                                echo "Entering $1"
 
73
                        fi
 
74
                        addignore Makefile
 
75
                        addignore .obj
 
76
                        addignore .moc
 
77
                        addignore .ui
 
78
                        for f in `ls -1 *.pro`; do
 
79
                           if fgrep -q debug_and_release $f; then
 
80
                            addignore "Makefile.Debug"
 
81
                            addignore "Makefile.Release"
 
82
                           fi
 
83
                           template=`grep ^TEMPLATE $f | sed -e 's/.*=[ \t]*//'`
 
84
                           if test -z "$template" -o "$template" = "app"; then
 
85
                                target=`grep ^TARGET $f | sed -e 's/.*=[ \t]*//'`
 
86
                                test -z "$target" && target=`echo $f | sed -e 's/\.pro$//'`
 
87
                                addignore $target
 
88
                                addignore $target.exe
 
89
                                # addignore $target.app # Mac OSX, but only gui apps (grep for CONFIG?)
 
90
                           fi
 
91
                           # RESOURCES = foo.qrc -> addignore qrc_foo.cpp
 
92
                           for resource in `perl -p -e 's/\\\s*\n/ /g' $f | grep ^RESOURCES | sed -e 's/.*=\s*//;s/#.*//;s/\$([^)]*)//'`; do
 
93
                              addignore qrc_`echo $resource | sed -e 's/\.qrc$/\.cpp/'`
 
94
                           done
 
95
                           # FORMS = foo.ui -> addignore ui_foo.h
 
96
                           for form in `perl -p -e 's/\\\s*\n/ /g' $f | grep ^FORMS | sed -e 's/.*=\s*//;s/#.*//;s/\$([^)]*)//'`; do
 
97
                              addignore ui_`echo $form | sed -e 's/\.ui$/\.h/'`
 
98
                           done
 
99
                        done
 
100
                else
 
101
                        echo "Skipping $1"
61
102
                fi
62
 
                rm svnignore.tmp
63
 
        else
64
 
                echo "Skipping $1"
65
 
        fi
 
103
        fi
 
104
        if test "$addedsomething" = 1; then
 
105
            svn propset svn:ignore -F svnignore.tmp .
 
106
        fi
 
107
        rm -f svnignore.tmp
66
108
        )
67
109
}
68
110
 
69
 
 
70
 
if test -f Makefile.am; then
 
111
qmakefiles=`ls -1 *.pro 2>/dev/null`
 
112
if test -f Makefile.am -o -n "$qmakefiles" -o -f CMakeLists.txt; then
71
113
        if test $recurse -eq 1; then
72
114
                find . -type d | egrep -v 'CVS|.svn' | sed -e 's,/$,,' | \
73
115
                while read dir; do