Warning, /sdk/kde-dev-scripts/create_svnignore is written in an unsupported language. File is not indexed.
0001 #!/usr/bin/env bash 0002 # This script makes a preliminary svn:ignore in the current dir by 0003 # adding some standard stuff according to Makefile.am. 0004 # License: GPL 0005 0006 addignore() { 0007 if ! test -f svnignore.tmp; then 0008 svn pg svn:ignore . | sed -e "s, *,," | grep -v '^$' > svnignore.tmp 0009 addedsomething=0 0010 fi 0011 if ! grep -x -F -q "$1" svnignore.tmp; then 0012 echo "$1" >> svnignore.tmp && echo "added $1 to svn:ignore" 0013 sort -u -o svnignore.tmp svnignore.tmp 0014 addedsomething=1 0015 fi 0016 } 0017 0018 recurse=0 0019 if test $# -eq 1; then 0020 if test "$1" = "-r"; then 0021 recurse=1 0022 fi 0023 fi 0024 0025 handledir() { 0026 ( 0027 cd $1 0028 trap "rm svnignore.tmp" 1 2 15 0029 addedsomething=0 0030 if test -f CMakeLists.txt; then 0031 if test $recurse -eq 1; then 0032 echo "Entering $1" 0033 fi 0034 addignore Makefile 0035 addignore CMakeFiles 0036 addignore cmake_install.cmake 0037 addignore DartTestfile.txt 0038 addignore install_icons.cmake 0039 addignore progress.make 0040 grep -q kde4_automoc CMakeLists.txt && addignore "*.moc" 0041 grep -q kde4_add_dcop_skels CMakeLists.txt && addignore "*.kidl" 0042 grep -q kde4_add_dcop_skels CMakeLists.txt && addignore "*_skel.c*" 0043 grep -q kde4_add_dcop_stubs CMakeLists.txt && addignore "*_stub.cpp" 0044 #TODO add binary 0045 0046 elif test -f Makefile.am; then 0047 if test $recurse -eq 1; then 0048 echo "Entering $1" 0049 fi 0050 addignore Makefile 0051 addignore Makefile.in 0052 0053 bins=`perl -p -e 's/\\\s*\n/ /g' Makefile.am | grep _PROGRAMS | sed -e 's/.*=\s*//;s/#.*//;s/\$([^)]*)//'` 0054 if test -n "$bins"; then 0055 addignore ".libs" 0056 addignore ".deps" 0057 for prog in $bins; do 0058 addignore "$prog" 0059 done 0060 fi 0061 grep -q LIBRARIES Makefile.am && addignore ".libs" 0062 grep -q METASOURCES Makefile.am && addignore "*.moc" 0063 fgrep -q .skel Makefile.am && addignore "*.kidl" 0064 fgrep -q .skel Makefile.am && addignore "*_skel.c*" 0065 fgrep -q .stub Makefile.am && addignore "*_stub.cpp" 0066 0067 grep -q "^include.*/Doxyfile.am$" Makefile.am && addignore "Doxyfile" 0068 else 0069 qmakefiles=`ls -1 *.pro 2>/dev/null` 0070 if test -n "$qmakefiles"; then 0071 if test $recurse -eq 1; then 0072 echo "Entering $1" 0073 fi 0074 addignore Makefile 0075 addignore .obj 0076 addignore .moc 0077 addignore "*.moc" 0078 addignore "moc_*.cpp" 0079 addignore .ui 0080 for f in `ls -1 *.pro`; do 0081 if fgrep -q debug_and_release $f; then 0082 addignore "Makefile.Debug" 0083 addignore "Makefile.Release" 0084 fi 0085 template=`grep ^TEMPLATE $f | sed -e 's/.*=[ \t]*//'` 0086 if test -z "$template" -o "$template" = "app"; then 0087 target=`grep ^TARGET $f | sed -e 's/.*=[ \t]*//'` 0088 test -z "$target" && target=`echo $f | sed -e 's/\.pro$//'` 0089 addignore $target 0090 addignore $target.exe 0091 # addignore $target.app # Mac OSX, but only gui apps (grep for CONFIG?) 0092 fi 0093 # RESOURCES = foo.qrc -> addignore qrc_foo.cpp 0094 for resource in `perl -p -e 's/\\\s*\n/ /g' $f | grep ^RESOURCES | sed -e 's/.*=\s*//;s/#.*//;s/\$([^)]*)//'`; do 0095 addignore qrc_`echo $resource | sed -e 's/\.qrc$/\.cpp/'` 0096 done 0097 # FORMS = foo.ui -> addignore ui_foo.h 0098 for form in `perl -p -e 's/\\\s*\n/ /g' $f | grep ^FORMS | sed -e 's/.*=\s*//;s/#.*//;s/\$([^)]*)//'`; do 0099 addignore ui_`echo $form | sed -e 's/\.ui$/\.h/'` 0100 done 0101 done 0102 else 0103 echo "Skipping $1" 0104 fi 0105 fi 0106 if test "$addedsomething" = 1; then 0107 svn propset svn:ignore -F svnignore.tmp . 0108 fi 0109 rm -f svnignore.tmp 0110 ) 0111 } 0112 0113 qmakefiles=`ls -1 *.pro 2>/dev/null` 0114 if test -f Makefile.am -o -n "$qmakefiles" -o -f CMakeLists.txt; then 0115 if test $recurse -eq 1; then 0116 find . -type d | egrep -v 'CVS|.svn' | sed -e 's,/$,,' | \ 0117 while read dir; do 0118 handledir $dir 0119 done 0120 else 0121 handledir . 0122 fi 0123 else 0124 echo "No Makefile.am found!" 0125 fi 0126