This file is indexed.

/usr/lib/eclipse/buildscripts/pde-build is in eclipse-pde 3.8.1-7.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
#!/bin/bash

# args:  [-f <feature>] [-d <dependencies (outside SDK)>] [-a <additional build args>] [-j <JVM args>] [-v] [-D] [-o <Orbit dependencies>]

function usage {
cat << _EOF_
usage: $0 [<options>]

Use PDE Build to build Eclipse features

Optional arguments:
   -h      Show this help message
   -f      Feature ID to build
   -d      Plugin dependencies in addition to Eclipse SDK
           (space-separated, names on which to glob features and plugins)
   -a      Additional build arguments (ex. -DjavacSource=1.5)
   -j      VM arguments (ex. -DJ2SE-1.5=%{_jvmdir}/java/jre/lib/rt.jar)
   -v      Be verbose
   -D      Debug platform itself (passes -consolelog -debug to Eclipse)
   -o      Directory containing Orbit-style dependencies
   -z      Comma-delimited list of dependency zips (not for use during RPM build)
_EOF_
}

function copyPlatform {
    # This seems silly but I was running into issues with empty strings
    # counting as arguments to copy-platform -- overholt, 2008-03
    if [ -z "$dependencies" ]; then
        if [ $verbose -eq 1 ]; then
            echo "/bin/sh -x /usr/lib/eclipse/buildscripts/copy-platform $SDK $datadir/eclipse"
            /bin/sh -x /usr/lib/eclipse/buildscripts/copy-platform $SDK $datadir/eclipse
        else
            echo "/bin/sh /usr/lib/eclipse/buildscripts/copy-platform $SDK $datadir/eclipse"
            /bin/sh /usr/lib/eclipse/buildscripts/copy-platform $SDK $datadir/eclipse
        fi
    else
        if [ $verbose -eq 1 ]; then
            echo "/bin/sh -x /usr/lib/eclipse/buildscripts/copy-platform $SDK $datadir/eclipse $dependencies"
            /bin/sh -x /usr/lib/eclipse/buildscripts/copy-platform $SDK $datadir/eclipse $dependencies
        else
            echo "/bin/sh /usr/lib/eclipse/buildscripts/copy-platform $SDK $datadir/eclipse $dependencies"
            /bin/sh /usr/lib/eclipse/buildscripts/copy-platform $SDK $datadir/eclipse $dependencies
        fi
    fi
}

function findFeatureId {
    # We can determine the feature ID if we have only one
    numFeatures=$(find $sourceDir -name feature.xml | wc -l)
    if [ $numFeatures -ne 1 ]; then
        #echo "# features found = $numFeatures"
        echo "Cannot determine feature ID.  Please specify with -f."
        usage
        exit 1
    fi
    
    featureXml=$(find $sourceDir -name feature.xml)
    
    # Taken from Ben Konrath's package-build
    # make an ant build files to extract the id from the feature.xml
    buildFile=$buildDir/findFeatureForRPM-tmp-build.xml
    
    echo "<project default=\"main\">
    	<target name=\"main\">
                   	<xmlproperty file=\"$featureXml\" collapseAttributes=\"true\"/>
    		<fail unless=\"feature.id\" message=\"feature.id not set\"/>
                   	<echo message=\"\${feature.id}\" />
            </target>
    </project>" > $buildFile
    
    featureId=$(ant -Dbasedir=$sourceDir -f $buildFile 2>&1 | grep echo | cut --delimiter=' ' -f 7)
    rm $buildFile
}

function findFeatureNameAndVersion {
    featureXml=$(find $sourceDir -name feature.xml | while read f; do grep -l id=\"$featureId\" $f; done)
    
    buildFile=$buildDir/findFeatureForRPM-tmp-build.xml
    
    echo "<project default=\"main\">
    	<target name=\"main\">
                   	<xmlproperty file=\"$featureXml\" collapseAttributes=\"true\"/>
    		<fail unless=\"feature.id\" message=\"feature.id not set\"/>
                   	<echo message=\"\${feature.label}\" />
            </target>
    </project>" > $buildFile
    
    featureName=$(ant -Dbasedir=$sourceDir -f $buildFile 2>&1 | grep echo | sed "s/.*\[echo\]\ //")
    rm $buildFile

    echo "<project default=\"main\">
    	<target name=\"main\">
                   	<xmlproperty file=\"$featureXml\" collapseAttributes=\"true\"/>
    		<fail unless=\"feature.id\" message=\"feature.id not set\"/>
                   	<echo message=\"\${feature.version}\" />
            </target>
    </project>" > $buildFile
    
    featureVersion=$(ant -Dbasedir=$sourceDir -f $buildFile 2>&1 | grep echo | sed "s/.*\[echo\]\ //")
    rm $buildFile
}

function findMaxBREE {
	manifests=$(find $sourceDir -name MANIFEST.MF)
	maxBree=1.4
	for i in $manifests; do
		breeLine=$(cat $i|grep RequiredExecutionEnvironment|cut -c37-|sed 's/^ *\(.*\) *$/\1/')
		case $breeLine in
         "J2SE-1.5")
         	 bree=1.5
             ;;
         "JavaSE-1.6")
         	 bree=1.6
             ;;
     	esac
     	if [ "$bree" \> "$maxBree" ]; then
     		maxBree=$bree
     	fi
    done
}

sourceDir=$PWD
buildDir=$PWD/build
SDK=$buildDir/SDK
homeDir=$buildDir/home
workspaceDir=$homeDir/workspace
datadir=/usr/lib
pdeBuildDir=$datadir/eclipse/dropins/sdk/plugins/org.eclipse.pde.build_3.8.1.dist

featureId=
dependencies=
additionalArgs=
vmArgs=
verbose=0
dryRun=0
debugPlatform=0
orbitDepsDir=
p2Generate=
testing=false
zipDeps=

# See above.  r = dry run (used for testing)
while getopts “hf:d:z:a:j:tvrDo:” OPTION
do
     case $OPTION in
         h)
             usage
             exit
             ;;
         f)
             featureId=$OPTARG
             ;;
         d)
             dependencies=$OPTARG
             ;;
         a)
             additionalArgs=$OPTARG
             ;;
         j)
             vmArgs=$OPTARG
             ;;
         t)
             testing=true
             ;;
         v)
             verbose=1
             ;;
         r)
             dryRun=1
             ;;
         D)
             debugPlatform=1
             ;;
         o)
             orbitDepsDir=$OPTARG
             ;;
         z)
             zipDeps=$OPTARG
             ;;
         ?)
             usage
             exit 1
             ;;
     esac
done

echo "mkdir -p $buildDir"
if [ $dryRun -ne 1 ]; then
    mkdir -p $buildDir
fi

# Eclipse may try to write to the building user's home directory so we create a
# temporary one for use by the build.
echo "mkdir -p $homeDir"
if [ $dryRun -ne 1 ]; then
    mkdir -p $homeDir
fi

echo "mkdir -p $workspaceDir"
if [ $dryRun -ne 1 ]; then
    mkdir -p $workspaceDir
fi

if [ -z $featureId ]; then
    findFeatureId
fi

if [ -z $featureId ]; then
    echo "Cannot determine feature ID.  Please specify with -f."
    usage
    exit 1
fi

findFeatureNameAndVersion

echo "Building feature = $featureId."

if [ -z "$dependencies" ]; then
    if [ $verbose -eq 1 ]; then
        echo "Assuming no dependencies except Eclipse SDK."
    fi
fi

# Symlink the SDK and dependencies for build
if [ -z "$dependencies" ]; then
    echo "Symlinking SDK into $SDK directory."
else
    echo "Symlinking SDK and \"$dependencies\" into $SDK directory."
fi
if [ $dryRun -ne 1 ]; then
    copyPlatform
fi

if [ $debugPlatform -eq 1 ]; then
    debugPlatformArgs="-debug -consolelog"
fi

if [ "x$orbitDepsDir" != "x" ]; then
    orbitDeps="-DorbitDepsDir=$orbitDepsDir"
fi

if [ "x$zipDeps" != "x" ]; then
    OLD_IFS="$IFS"
    IFS=","
    zipDepsArray=($zipDeps)
    IFS="$OLD_IFS"
    numZips=${#zipDepsArray[@]}
    for (( i=0; i< $numZips; i++ )); do
        thisZip=${zipDepsArray[$i]}
        thisFile=$(basename $thisZip)
        thisURL=$(echo $thisZip | sed s/$thisFile//)
        if [ ! -e $thisFile ]; then
            wget -q $thisZip
        fi
        mkdir -p tmp
        unzip -q -o $thisFile -d tmp
        cp -raf tmp/eclipse/features/* $SDK/features
        cp -raf tmp/eclipse/plugins/* $SDK/plugins
        rm -rf tmp
        thisZip=
        thisFile=
        thisURL=
    done
fi
if [ -z "$additionalArgs" ]; then
	findMaxBREE
	additionalArgs="-DjavacSource=$maxBree -DjavacTarget=$maxBree"
fi

echo "Starting build:"

launcherJar=$(ls $SDK/plugins | grep "org.eclipse.equinox.launcher_")

if [ $testing != true ]; then
  java -cp $SDK/plugins/${launcherJar} \
    -Duser.home=$homeDir \
    $vmArgs \
    org.eclipse.core.launcher.Main \
    -data $workspaceDir \
    -application org.eclipse.ant.core.antRunner \
    $debugPlatformArgs \
    -Dtype=feature \
    -Did=$featureId \
    -DbaseLocation=$SDK \
    -DsourceDirectory=$sourceDir \
    -DbuildDirectory=$buildDir \
    -Dbuilder=$datadir/eclipse/dropins/sdk/plugins/org.eclipse.pde.build_3.8.1.dist/templates/package-build \
    $orbitDeps \
    -Dtesting="$testing" \
    $additionalArgs \
    -f $pdeBuildDir/scripts/build.xml
else
  echo "\
  java -cp $SDK/plugins/${launcherJar} \
    -Duser.home=$homeDir \
    $vmArgs \
    org.eclipse.core.launcher.Main \
    -data $workspaceDir \
    -application org.eclipse.ant.core.antRunner \
    $debugPlatformArgs \
    -Dtype=feature \
    -Did=$featureId \
    -DbaseLocation=$SDK \
    -DsourceDirectory=$sourceDir \
    -DbuildDirectory=$buildDir \
    -Dbuilder=$datadir/eclipse/dropins/sdk/plugins/org.eclipse.pde.build_3.8.1.dist/templates/package-build \
    $orbitDeps \
    -Dtesting=\"$testing\" \
    $additionalArgs \
    -f $pdeBuildDir/scripts/build.xml
  "
fi

exit $?