00001
00002
00003 HUDSON_DEBBUILD_CONFIG = """<?xml version="1.0" encoding="UTF-8"?>
00004 <project>
00005 <actions/>
00006 <description>Trigger for building source debs</description>
00007 <keepDependencies>false</keepDependencies>
00008 <properties>
00009 <hudson.model.ParametersDefinitionProperty>
00010 <parameterDefinitions>
00011 <hudson.model.StringParameterDefinition>
00012 <name>STACK_NAME</name>
00013 <description>ROS stack name</description>
00014 <defaultValue>ALL</defaultValue>
00015 </hudson.model.StringParameterDefinition>
00016 </parameterDefinitions>
00017 </hudson.model.ParametersDefinitionProperty>
00018 </properties>
00019 <scm class="hudson.scm.SubversionSCM">
00020 <locations>
00021 <hudson.scm.SubversionSCM_-ModuleLocation>
00022 <remote>https://code.ros.org/svn/release/trunk</remote>
00023 <local>release</local>
00024 </hudson.scm.SubversionSCM_-ModuleLocation>
00025 <hudson.scm.SubversionSCM_-ModuleLocation>
00026 <remote>https://code.ros.org/svn/ros/stacks/ros_release/trunk</remote>
00027 <local>ros_release</local>
00028 </hudson.scm.SubversionSCM_-ModuleLocation>
00029 </locations>
00030 <useUpdate>true</useUpdate>
00031 <doRevert>false</doRevert>
00032 <excludedRegions/>
00033 <includedRegions/>
00034 <excludedUsers/>
00035 <excludedRevprop/>
00036 <excludedCommitMessages/>
00037 </scm>
00038 <assignedNode>hudson-devel</assignedNode>
00039 <canRoam>false</canRoam>
00040 <disabled>false</disabled>
00041 <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
00042 <authToken>RELEASE_BUILD_DEBS</authToken>
00043 <triggers class="vector"/>
00044 <concurrentBuild>false</concurrentBuild>
00045 <builders>
00046 <hudson.tasks.Shell>
00047 <command>echo %(rosdistro)s
00048 echo $STACK_NAME
00049 echo %(osdistro)s
00050 echo %(arch)s
00051
00052 sudo apt-get install pbuilder git-core -y qemu-kvm-extras-static
00053
00054 cat > $WORKSPACE/build.bash << DELIM
00055 source /opt/ros/cturtle/setup.sh
00056 export ROS_PACKAGE_PATH=$WORKSPACE/ros_release:$WORKSPACE/release:$ROS_PACKAGE_PATH
00057
00058 rosrun rosdeb build_debs.py %(rosdistro)s $STACK_NAME %(osdistro)s %(arch)s --force --besteffort
00059 DELIM
00060
00061 bash $WORKSPACE/build.bash</command>
00062 </hudson.tasks.Shell>
00063 </builders>
00064 <publishers>
00065 <hudson.tasks.BuildTrigger>
00066 <childProjects>debbuild-status</childProjects>
00067 <threshold>
00068 <name>SUCCESS</name>
00069 <ordinal>0</ordinal>
00070 <color>BLUE</color>
00071 </threshold>
00072 </hudson.tasks.BuildTrigger>
00073 <hudson.tasks.Mailer>
00074 <recipients/>
00075 <dontNotifyEveryUnstableBuild>true</dontNotifyEveryUnstableBuild>
00076 <sendToIndividuals>false</sendToIndividuals>
00077 </hudson.tasks.Mailer>
00078 </publishers>
00079 <buildWrappers/>
00080 </project>
00081
00082 """
00083
00084
00085
00086 import roslib; roslib.load_manifest("job_generation")
00087 import rosdistro
00088 from job_generation.jobs_common import *
00089 import optparse
00090
00091
00092 def debbuild_job_name(rosdistro, ubuntu, arch):
00093 return "-".join(["debbuild-build-debs", rosdistro, ubuntu, arch])
00094
00095
00096
00097 def create_debbuild_configs(osdistro, rosdistro, arch):
00098
00099
00100 configs = {}
00101 name = debbuild_job_name(rosdistro, osdistro, arch)
00102
00103 hudson_config = HUDSON_DEBBUILD_CONFIG
00104
00105 configs[name] = hudson_config%{'osdistro':osdistro, 'rosdistro':rosdistro, 'arch':arch}
00106 return configs
00107
00108
00109
00110
00111 usage_str = "usage: %prog --rosdistro ROSDISTRO [--architecture ARCH ] [--os OS_CODENAME] [--delete] [--nowait]"
00112
00113 def main():
00114 parser = optparse.OptionParser(usage=usage_str)
00115 parser.add_option('--rosdistro', action='store', dest='rosdistro', help='which rosdistro to use')
00116 parser.add_option('--architecture', action='append', dest='arch', help='Architecture to target')
00117 parser.add_option('--codename', action='append', dest='codename', help='Codename to target')
00118 parser.add_option('--wait', action='store_true', dest='wait', default=False, help='Wait for running jobs to finish, instead of skipping')
00119 parser.add_option('--delete', action='store_true', dest='delete', default=False, help='Delete the specified job')
00120
00121
00122 (options, args) = parser.parse_args()
00123 if not options.rosdistro:
00124 parser.parse_error("rosdistro required")
00125 if options.rosdistro:
00126 rosdistro_list = [options.rosdistro]
00127
00128
00129 os_list = ['lucid', 'maverick', 'natty']
00130 arch_list = ['i386', 'amd64', 'armel']
00131
00132 if options.codename:
00133 os_list = options.codename
00134 if options.arch:
00135 arch_list = options.arch
00136
00137 print os_list, arch_list, rosdistro_list
00138
00139
00140 debbuild_configs = {}
00141 for rosdistro in rosdistro_list:
00142 for arch in arch_list:
00143 for o in os_list:
00144 debbuild_configs.update(create_debbuild_configs(o, rosdistro, arch))
00145
00146
00147
00148
00149 print "Scheduling updates"
00150 schedule_jobs(debbuild_configs, options.wait, options.delete)
00151
00152
00153 if __name__ == '__main__':
00154 main()
00155
00156
00157
00158