~louis/ubuntu/trusty/clamav/lp799623_fix_logrotate

« back to all changes in this revision

Viewing changes to libclamav/c++/llvm/utils/llvmdo

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2010-03-12 11:30:04 UTC
  • mfrom: (0.41.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20100312113004-b0fop4bkycszdd0z
Tags: 0.96~rc1+dfsg-0ubuntu1
* New upstream RC - FFE (LP: #537636):
  - Add OfficialDatabaseOnly option to clamav-base.postinst.in
  - Add LocalSocketGroup option to clamav-base.postinst.in
  - Add LocalSocketMode option to clamav-base.postinst.in
  - Add CrossFilesystems option to clamav-base.postinst.in
  - Add ClamukoScannerCount option to clamav-base.postinst.in
  - Add BytecodeSecurity opiton to clamav-base.postinst.in
  - Add DetectionStatsHostID option to clamav-freshclam.postinst.in
  - Add Bytecode option to clamav-freshclam.postinst.in
  - Add MilterSocketGroup option to clamav-milter.postinst.in
  - Add MilterSocketMode option to clamav-milter.postinst.in
  - Add ReportHostname option to clamav-milter.postinst.in
  - Bump libclamav SO version to 6.1.0 in libclamav6.install
  - Drop clamdmon from clamav.examples (no longer shipped by upstream)
  - Drop libclamav.a from libclamav-dev.install (not built by upstream)
  - Update SO version for lintian override for libclamav6
  - Add new Bytecode Testing Tool, usr/bin/clambc, to clamav.install
  - Add build-depends on python and python-setuptools for new test suite
  - Update debian/copyright for the embedded copy of llvm (using the system
    llvm is not currently feasible)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
##===- utils/llvmdo - Counts Lines Of Code -------------------*- Script -*-===##
 
3
 
4
#                     The LLVM Compiler Infrastructure
 
5
#
 
6
# This file is distributed under the University of Illinois Open Source
 
7
# License. See LICENSE.TXT for details.
 
8
 
9
##===----------------------------------------------------------------------===##
 
10
#
 
11
# This script is a general purpose "apply" function for the source files in LLVM
 
12
# It uses "find" to locate all the source files and then applies the user's 
 
13
# command to them. As such, this command is often not used by itself much but
 
14
# the other find related tools (countloc.sh,llvmgrep,getsrcs.sh,userloc.sh) are
 
15
# all based on this script.  This script defines "what is a source file" in 
 
16
# LLVM and so should be maintained if new directories, new file extensions, 
 
17
# etc. are used in LLVM as it progresses.
 
18
#
 
19
# Usage:
 
20
#  llvmdo [-topdir DIR] [-dirs "DIRNAMES..."] [-code-only] PROGRAM ARGS...
 
21
#
 
22
# The -topdir option allows you to specify the llvm source root directly. If it
 
23
# is not specified then it will be obtained with llvm-config which must be built
 
24
# and in your path.
 
25
#
 
26
# The -dirs argument allows you to specify the set of directories that are 
 
27
# searched. The default list of directories searched is:
 
28
#   include lib tools utils runtime autoconf docs test examples projects
 
29
# Note that you must use quotes around the list of directory names. 
 
30
#
 
31
# The -code-only option specifies that only those files that are considered 
 
32
# "code" should be visited. HTML documentation is considered code, but things 
 
33
# like README files, etc. are not.
 
34
#
 
35
# Finally, you simply specify whatever program you want to run against each 
 
36
# file and the arguments to give it. The PROGRAM will be given the file name 
 
37
# as its last argument.
 
38
##===----------------------------------------------------------------------===##
 
39
 
 
40
if test $# -lt 1 ; then
 
41
  echo "Usage: llvmdo [-topdir DIR] [-dirs "DIRNAMES..."] [-code-only] PROGRAM ARGS..."
 
42
  exit 1
 
43
fi
 
44
 
 
45
if test "$1" = "-topdir" ; then
 
46
  TOPDIR="$2"
 
47
  shift; shift;
 
48
else
 
49
  TOPDIR=`llvm-config --src-root`
 
50
fi
 
51
 
 
52
if test "$1" = "-dirs" ; then
 
53
  LLVMDO_DIRS="$2"
 
54
  shift ; shift
 
55
elif test -z "$LLVMDO_DIRS" ; then
 
56
  LLVMDO_DIRS="include lib tools utils runtime autoconf docs test examples projects cmake"
 
57
fi
 
58
 
 
59
if test "$1" = "-code-only" ; then
 
60
  CODE_ONLY="set"
 
61
  shift
 
62
else
 
63
  CODE_ONLY=""
 
64
fi
 
65
 
 
66
if test "$1" = "" ; then
 
67
  echo "Missing program name to run"
 
68
  exit 1
 
69
fi
 
70
 
 
71
PROGRAM=`which $1`
 
72
if test ! -x "$PROGRAM" ; then
 
73
  echo "Can't execute $1"
 
74
  exit 1
 
75
fi
 
76
shift;
 
77
 
 
78
paths_to_ignore="\
 
79
  -path */CVS -o \
 
80
  -path */CVS/* -o \
 
81
  -path */.svn/ -o \
 
82
  -path */.svn/* -o \
 
83
  -path docs/doxygen/* -o \
 
84
  -path docs/CommandGuide/html/* -o \
 
85
  -path docs/CommandGuide/man/* -o \
 
86
  -path docs/CommandGuide/ps/* -o \
 
87
  -path docs/CommandGuide/man/* -o \
 
88
  -path docs/HistoricalNotes/* -o \
 
89
  -path docs/img/* -o \
 
90
  -path */.libs/* -o \
 
91
  -path lib/Support/bzip2/* -o \
 
92
  -path projects/llvm-test/* \
 
93
"
 
94
files_to_match="\
 
95
     -name *.ac \
 
96
  -o -name *.b \
 
97
  -o -name *.c \
 
98
  -o -name *.cc \
 
99
  -o -name *.cfg \
 
100
  -o -name *.cpp \
 
101
  -o -name *.css \
 
102
  -o -name *.def \
 
103
  -o -name *.el \
 
104
  -o -name *.exp \
 
105
  -o -name *.footer \
 
106
  -o -name *.gnuplot' \
 
107
  -o -name *.h \
 
108
  -o -name *.header \
 
109
  -o -name *.html \
 
110
  -o -name *.in \
 
111
  -o -name *.inc \
 
112
  -o -name *.intro \
 
113
  -o -name *.l \
 
114
  -o -name *.ll \
 
115
  -o -name *.lst \
 
116
  -o -name *.m4 \
 
117
  -o -name *.pod \
 
118
  -o -name *.pl \
 
119
  -o -name *.py \
 
120
  -o -name *.sh \
 
121
  -o -name *.schema \
 
122
  -o -name *.st \
 
123
  -o -name *.tcl \
 
124
  -o -name *.td \
 
125
  -o -name *.tr \
 
126
  -o -name *.y \
 
127
  -o -name Make* \
 
128
  -o -name *.cmake \
 
129
  -o -name llvmdo \
 
130
  -o -name llvmgrep \
 
131
  -o -name check-each-file \
 
132
  -o -name codgen-diff \
 
133
  -o -name cvsupdate \
 
134
  -o -name llvm-native-gcc \
 
135
  -o -name llvm-native-gxx \
 
136
  -o -name makellvm \
 
137
  -o -path include/llvm/ADT/ilist \
 
138
  -o -path test/\*.ll \
 
139
  -o -path test/Scripts/not \
 
140
  -o -path runtime/\*.ll \
 
141
"
 
142
if test -z "$CODE_ONLY" ; then
 
143
  files_to_match="$files_to_match \
 
144
    -o -name *.txt \
 
145
    -o -name *.TXT \
 
146
    -o -name *.vim \
 
147
    -o -name vimrc \
 
148
    -o -name README \
 
149
    -o -name COPYING.LIB \
 
150
    -o -name LICENSE* "
 
151
fi
 
152
files_to_ignore="\
 
153
     -name \.* \
 
154
  -o -name *~ \
 
155
  -o -name #* \
 
156
  -o -name *.cvs \
 
157
  -o -name configure \
 
158
  -o -name slow.ll \
 
159
  -o -name *libtool* \
 
160
  -o -name ltdl* \
 
161
  -o -name ltdl.m4 \
 
162
  -o -name ltmain.m4 \
 
163
  -o -name ltmain.sh \
 
164
  -o -name aclocal.m4 \
 
165
  -o -name acinclude.m4 \
 
166
  -o -name *LoopSimplifyCrash.ll \
 
167
  -o -name *AST-Remove.ll \
 
168
  -o -name PPCPerfectShuffle.h \
 
169
"
 
170
 
 
171
if test -d "$TOPDIR" ; then
 
172
  cd $TOPDIR
 
173
  # Have to use the right "find" on a per-platform basis. Most platforms have
 
174
  # Gnu find as "find", but Solaris does not.
 
175
  case `uname -s` in
 
176
    SunOS) find_prog=gfind ;;
 
177
    *) find_prog=find ;;
 
178
  esac
 
179
  # Turn off file name generation (globbing) so that substitution of the
 
180
  # variables doesn't cause the shell to create lists of file names
 
181
  set -f
 
182
  $find_prog $LLVMDO_DIRS -type f \
 
183
    \( $paths_to_ignore \) -prune \
 
184
    -o \( \( $files_to_match \) \! \( $files_to_ignore \) \
 
185
    -exec $PROGRAM "$@" {} \; \)
 
186
else
 
187
  echo "Can't find LLVM top directory in $TOPDIR"
 
188
fi