Jump to: navigation, search

Difference between revisions of "Build Workshop 3: Build Hard With A Purpose/How Build Works"

(Entry point: start.sh)
(Entry point: start.sh)
Line 20: Line 20:
 
* small hacks for modeling projects
 
* small hacks for modeling projects
 
* set up commonSriptsDir and configfile variables (cleanup?)
 
* set up commonSriptsDir and configfile variables (cleanup?)
 +
 
<source lang=bash>
 
<source lang=bash>
 
commonScriptsDir=$writableBuildRoot/build/org.eclipse.dash.common.releng/tools/scripts
 
commonScriptsDir=$writableBuildRoot/build/org.eclipse.dash.common.releng/tools/scripts
Line 26: Line 27:
 
configfile=$commonScriptsDir/../../server.properties
 
configfile=$commonScriptsDir/../../server.properties
 
</source>
 
</source>
 +
 
* set environment variables (could use a bit of cleanup)
 
* set environment variables (could use a bit of cleanup)
 +
 
<source lang=bash>
 
<source lang=bash>
 
export HOME=$writableBuildRoot
 
export HOME=$writableBuildRoot
Line 44: Line 47:
 
</source>
 
</source>
  
 +
* look for PHP (I think we can remove this)
  
 
<source lang=bash>
 
<source lang=bash>
 +
# get path to PHP interpreter
 +
if [ -x /usr/bin/php ]; then
 +
PHP=/usr/bin/php
 +
elif [ -x /usr/bin/php5 ]; then
 +
PHP=/usr/bin/php5
 +
elif [ -x /usr/bin/php4 ]; then
 +
PHP=/usr/bin/php4
 +
else
 +
PHP=php
 +
fi
 
</source>
 
</source>
 +
 +
* set projectPath (remove "modeling"), hasProblem and hasFailed variables
 +
<source lang=bash>
 +
projectPath=modeling/$projectName/$subprojectName;
 +
 +
hasProblem="";
 +
hasFailed="";
 +
</source>
 +
 +
* checkBuildStatus() function (uses checkBuildStatus.php ... will need refactoring)
 +
* sendEmail() function (requires checkBuildStatus())
 +
* set downloadsDir and buildDir variables
 +
<source lang=bash>
 +
downloadsDir=$writableBuildRoot/build/downloads
 +
buildDir=$writableBuildRoot/build/$projectName/$subprojectName/downloads/drops/$version/$buildType$buildTimestamp
 +
</source>
 +
 +
* output the environment variables used by the build
 +
* if projRelengBranch not passed in, set it to $branch
 +
* for all dependency arguments passed in (-URL), download them unless they already exist in $downloadsDir
 +
** checkZipExists() uses checkZipExists.xml
 +
* create build directory and cd to it
 +
<source lang=bash>
 +
mkdir -p $buildDir/eclipse; cd $buildDir;
 +
</source>
 +
 +
* set up build.cfg and store some properties in it (including those already set in $tmpfile ... could probably echo to $buildcfg earlier)
 +
<source lang=bash>
 +
buildcfg="$buildDir/build.cfg";
 +
 +
cat $tmpfile >> $buildcfg;
 +
echo "" >> $buildcfg;
 +
rm -fr $tmpfile
 +
 +
echo "skipFetch=true" >> $buildcfg;
 +
echo "localSourceCheckoutDir=$localSourceCheckoutDir" >> $buildcfg
 +
</source>
 +
 +
* for each of org.eclipse.dash.common.releng, org.eclipse.$subjprojectName2.releng, and org.eclipse.releng.basebuilder, copy existing checkouts from either $writableBuildRoot/build, $writableBuildRoot/build/<item>_<branch> OR export from CVS
 +
** Example:
 +
** if $writableBuildRoot/build/org.eclipse.dash.common.releng exists, copy it to $buildDir/org.eclipse.dash.common.releng
 +
** else if $writableBuildRoot/build/org.eclipse.dash.common.releng_${commonRelengBranch} exists, copy it to $buildDir/org.eclipse.dash.common.releng
 +
** else if $buildDir/org.eclipse.dash.common.releng doesn't exist, export it from CVS
 +
<source lang=bash>
 +
# Defaults
 +
quietCVS=-Q
 +
commonRelengBranch="HEAD"
 +
cvs -d :pserver:anonymous@dev.eclipse.org:/cvsroot/technology $quietCVS ex -r $commonRelengBranch -d org.eclipse.dash.common.releng org.eclipse.dash/athena/org.eclipse.dash.commonbuilder/org.eclipse.dash.commonbuilder.releng"
 +
</source>
 +
 +
* cd to CBI tools/scripts directory in $buildDir
 +
* set up some more variables and append them to build.cfg
 +
<source lang=bash>
 +
relengBuilderDir=$buildDir/org.eclipse.$subprojectName2.releng
 +
relengCommonBuilderDir=$buildDir/org.eclipse.dash.common.releng
 +
relengBaseBuilderDir=$buildDir/org.eclipse.releng.basebuilder
 +
echo "java.home=$JAVA_HOME" >> $buildcfg;
 +
</source>
 +
 +
* set buildTag to either $mapfileTag or ${buildType}${buildTimestamp}
 +
* set baseLocation=$buildDir/eclipse ($buildDirEclipse) and append it to build.cfg
 +
* mkdir -p $buildDirEclipse $downloadsDir

Revision as of 10:03, 29 October 2008

How CBI Builds work

Input

Required

  1. Project ID (same as portal ex. tools.gef, technology.linuxtools) (-projectid)
  2. Version to use (-version)
  3. CVS Root for project's releng plugin (we will add SVN support soon) <-- could perhaps come from portal in future (-projRelengRoot)
  4. CVS Path for project's releng plugin (we will add SVN support soon) <-- could perhaps come from portal in future (-projRelengPath)
  5. URLs of dependencies (ex. http://download.eclipse.org/eclipse/downloads/drops/R-3.4-200806172000/eclipse-SDK-3.4-linux-gtk.tar.gz) (we will automate this more in the future) (-URL)

Optional

  1. CVS branch of org.eclipse.releng.basebuilder (-basebuilderBranch)
  2. JAVA_HOME (-javaHome)
  3. Path to a local checkout of the source (avoids checking out during build) (-localSourceCheckoutDir)
  4. Nick should probably fill in the rest with all of the options he has

Output

  1. Master zip
  2. SDK zip

Process

Entry point: start.sh

  • build up options from command line input
  • small hacks for modeling projects
  • set up commonSriptsDir and configfile variables (cleanup?)
commonScriptsDir=$writableBuildRoot/build/org.eclipse.dash.common.releng/tools/scripts
mkdir -p $commonScriptsDir
cd $commonScriptsDir
configfile=$commonScriptsDir/../../server.properties
  • set environment variables (could use a bit of cleanup)
export HOME=$writableBuildRoot
if [ "x$javaHome" != "x" ]; then
	export JAVA_HOME=$javaHome;
else # use default
	export JAVA_HOME=$($commonScriptsDir/readProperty.sh $configfile JAVA_HOME)
	javaHome="$JAVA_HOME"
fi
export ANT_HOME=$($commonScriptsDir/readProperty.sh $configfile ANT_HOME);
ANT_BIN=$($commonScriptsDir/readProperty.sh $configfile ANT_BIN);
if [ "x$ANT_BIN" != "x" ]; then
	export ANT=$ANT_BIN
else
	export ANT=$ANT_HOME"/bin/ant";
fi
  • look for PHP (I think we can remove this)
# get path to PHP interpreter
if [ -x /usr/bin/php ]; then
	PHP=/usr/bin/php
elif [ -x /usr/bin/php5 ]; then
	PHP=/usr/bin/php5
elif [ -x /usr/bin/php4 ]; then
	PHP=/usr/bin/php4
else
	PHP=php
fi
  • set projectPath (remove "modeling"), hasProblem and hasFailed variables
projectPath=modeling/$projectName/$subprojectName;
 
hasProblem="";
hasFailed="";
  • checkBuildStatus() function (uses checkBuildStatus.php ... will need refactoring)
  • sendEmail() function (requires checkBuildStatus())
  • set downloadsDir and buildDir variables
downloadsDir=$writableBuildRoot/build/downloads
buildDir=$writableBuildRoot/build/$projectName/$subprojectName/downloads/drops/$version/$buildType$buildTimestamp
  • output the environment variables used by the build
  • if projRelengBranch not passed in, set it to $branch
  • for all dependency arguments passed in (-URL), download them unless they already exist in $downloadsDir
    • checkZipExists() uses checkZipExists.xml
  • create build directory and cd to it
mkdir -p $buildDir/eclipse; cd $buildDir;
  • set up build.cfg and store some properties in it (including those already set in $tmpfile ... could probably echo to $buildcfg earlier)
buildcfg="$buildDir/build.cfg";
 
cat $tmpfile >> $buildcfg;
echo "" >> $buildcfg;
rm -fr $tmpfile
 
echo "skipFetch=true" >> $buildcfg;
echo "localSourceCheckoutDir=$localSourceCheckoutDir" >> $buildcfg
  • for each of org.eclipse.dash.common.releng, org.eclipse.$subjprojectName2.releng, and org.eclipse.releng.basebuilder, copy existing checkouts from either $writableBuildRoot/build, $writableBuildRoot/build/<item>_<branch> OR export from CVS
    • Example:
    • if $writableBuildRoot/build/org.eclipse.dash.common.releng exists, copy it to $buildDir/org.eclipse.dash.common.releng
    • else if $writableBuildRoot/build/org.eclipse.dash.common.releng_${commonRelengBranch} exists, copy it to $buildDir/org.eclipse.dash.common.releng
    • else if $buildDir/org.eclipse.dash.common.releng doesn't exist, export it from CVS
# Defaults
quietCVS=-Q
commonRelengBranch="HEAD"
cvs -d :pserver:anonymous@dev.eclipse.org:/cvsroot/technology $quietCVS ex -r $commonRelengBranch -d org.eclipse.dash.common.releng org.eclipse.dash/athena/org.eclipse.dash.commonbuilder/org.eclipse.dash.commonbuilder.releng"
  • cd to CBI tools/scripts directory in $buildDir
  • set up some more variables and append them to build.cfg
relengBuilderDir=$buildDir/org.eclipse.$subprojectName2.releng
relengCommonBuilderDir=$buildDir/org.eclipse.dash.common.releng
relengBaseBuilderDir=$buildDir/org.eclipse.releng.basebuilder
echo "java.home=$JAVA_HOME" >> $buildcfg;
  • set buildTag to either $mapfileTag or ${buildType}${buildTimestamp}
  • set baseLocation=$buildDir/eclipse ($buildDirEclipse) and append it to build.cfg
  • mkdir -p $buildDirEclipse $downloadsDir