def test_deb_in_repo(self): from rosdeb import deb_in_repo, load_Packages parsed = load_Packages(SHADOW_REPO, 'lucid', 'amd64') self.assert_( deb_in_repo(SHADOW_REPO, parsed[0][0], parsed[0][1], 'lucid', 'amd64')) self.failIf( deb_in_repo(SHADOW_REPO, 'fake', parsed[0][1], 'lucid', 'amd64'))
def test_load_Packages(self): from rosdeb import load_Packages parsed = load_Packages(SHADOW_REPO, 'lucid', 'amd64') # make sure there are some ros packages in the repo matches = [x for x in parsed if x[0].startswith('ros-')] self.assert_(len(matches))
def test_deb_in_repo(self): from rosdeb import deb_in_repo, load_Packages parsed = load_Packages(SHADOW_REPO, 'lucid', 'amd64') self.assert_(deb_in_repo(SHADOW_REPO, parsed[0][0], parsed[0][1], 'lucid', 'amd64')) self.failIf(deb_in_repo(SHADOW_REPO, 'fake', parsed[0][1], 'lucid', 'amd64'))
def generate_allhtml_report(output, distro_name, os_platforms): import hudson h = hudson.Hudson(HUDSON) distro = load_distro(distro_name) main_repo = {} arches = ARCHES for os_platform in os_platforms: for arch in arches: try: main_repo["%s-%s"%(os_platform, arch)] = load_Packages(ROS_REPO, os_platform, arch) except: main_repo["%s-%s"%(os_platform, arch)] = [] fixed_repo = {} arches = ARCHES for os_platform in os_platforms: for arch in arches: try: fixed_repo["%s-%s"%(os_platform, arch)] = load_Packages(SHADOW_FIXED_REPO, os_platform, arch) except: fixed_repo["%s-%s"%(os_platform, arch)] = [] missing_primary = None missing_dep = None counts = {} stacks = {} for stack in distro.stacks.keys(): stacks[stack] = {} for os_platform in os_platforms: for arch in arches: key = "%s-%s"%(os_platform, arch) try: missing_primary, missing_dep, missing_excluded, missing_excluded_dep = get_missing(distro, os_platform, arch) except BadRepo: for s in distro.stacks.iterkeys(): stacks[s][key] = MISSING_REPO counts[key] = "!" continue args = get_missing(distro, os_platform, arch) try: args_fixed = get_missing(distro, os_platform, arch, repo=SHADOW_FIXED_REPO, lock_version=False) except BadRepo: for s in distro.stacks.iterkeys(): stacks[s][key] = MISSING_REPO counts[key] = "!" continue counts[key] = ','.join([str(len(x)) for x in args]) missing_primary, missing_dep, missing_excluded, missing_excluded_dep = args missing_primary_fixed, missing_dep_fixed, missing_excluded_fixed, missing_excluded_dep_fixed = args_fixed for s in missing_primary: if svn_url_exists(sourcedeb_url(distro, s, os_platform)): stacks[s][key] = MISSING_PRIMARY else: stacks[s][key] = MISSING_SOURCEDEB for s in missing_dep: if svn_url_exists(sourcedeb_url(distro, s, os_platform)): stacks[s][key] = MISSING_DEP else: stacks[s][key] = MISSING_SOURCEDEB for s in missing_primary_fixed: if svn_url_exists(sourcedeb_url(distro, s, os_platform)): stacks[s][key] = MISSING_BROKEN else: stacks[s][key] = MISSING_SOURCEDEB for s in missing_dep_fixed: if svn_url_exists(sourcedeb_url(distro, s, os_platform)): stacks[s][key] = MISSING_BROKEN_DEP else: stacks[s][key] = MISSING_SOURCEDEB for s in missing_excluded: stacks[s][key] = MISSING_EXCLUDED for s in missing_excluded_dep: stacks[s][key] = MISSING_EXCLUDED_DEP with open(output, 'w') as f: f.write(get_html_header(distro_name)) f.write(get_html_repository_status(distro, os_platforms, arches)) f.write(get_html_legend()) job = 'debbuild-build-debs' f.write(get_html_table_header(h, distro_name, os_platforms, arches, counts, job)) stack_names = sorted(stacks.keys()) for stack in stack_names: d = stacks[stack] shadow_version = distro.stacks[stack].version # generate URL stack_name = stack stack_version = shadow_version url = SOURCEDEB_DIR_URI%locals() # MISSING_SOURCEDEB is os/arch independent, so treat row as a whole sample_key = "%s-%s"%(os_platforms[0], arches[0]) if sample_key in d and d[sample_key] == MISSING_SOURCEDEB: color = COLORS[d[sample_key]] job_url = sourcedeb_job_url(h, distro_name, stack, shadow_version) f.write('<tr><td bgcolor="%s"><a href="%s">%s %s</a> <a href="%s">[+]</a></td>'%(color, url, stack, shadow_version, job_url)) else: if 0: f.write('<tr><td><a href="%s">%s %s</a></td>'%(url, stack, shadow_version)) else: job_url = sourcedeb_job_url(h, distro_name, stack, shadow_version) # temporarily including [+] for all right now to help bringup maverick f.write('<tr><td><a href="%s">%s %s</a> <a href="%s">[+]</a></td>'%(url, stack, shadow_version, job_url)) for os_platform in os_platforms: for arch in arches: key = "%s-%s"%(os_platform, arch) # compute version in actual repo version_str = '' try: main_match = get_stack_version(main_repo[key], distro_name, stack) fixed_match = get_stack_version(fixed_repo[key], distro_name, stack) if main_match != shadow_version or fixed_match != shadow_version: main_match = main_match or '0' fixed_match = fixed_match or '0' version_str = '<em>'+str(fixed_match)+', '+str(main_match)+'</em>' except Exception, e: print str(e) if key in d: val = d[key] color = COLORS[val] params = {'STACK_NAME': stack} if val == MISSING_SOURCEDEB: f.write('<td bgcolor="%s">%s %s</td>'%(color, val, version_str)) else: url = h.build_job_url('%s-%s-%s-%s'%(job, distro_name, os_platform, arch), parameters=params) f.write('<td bgcolor="%s">%s <a href="%s">[+]</a> %s</td>'% (color, val, url, version_str)) else: f.write('<td> %s </td>'%version_str) f.write('</tr>\n') f.write('\n</table></body></html>')
def generate_allhtml_report(output, distro_name, os_platforms): import hudson h = hudson.Hudson(HUDSON) distro = load_distro(distro_name) main_repo = {} arches = ARCHES for os_platform in os_platforms: for arch in arches: try: main_repo["%s-%s" % (os_platform, arch)] = load_Packages( ROS_REPO, os_platform, arch) except: main_repo["%s-%s" % (os_platform, arch)] = [] fixed_repo = {} arches = ARCHES for os_platform in os_platforms: for arch in arches: try: fixed_repo["%s-%s" % (os_platform, arch)] = load_Packages( SHADOW_FIXED_REPO, os_platform, arch) except: fixed_repo["%s-%s" % (os_platform, arch)] = [] missing_primary = None missing_dep = None counts = {} stacks = {} for stack in distro.stacks.keys(): stacks[stack] = {} for os_platform in os_platforms: for arch in arches: key = "%s-%s" % (os_platform, arch) try: missing_primary, missing_dep, missing_excluded, missing_excluded_dep = get_missing( distro, os_platform, arch) except BadRepo: for s in distro.stacks.iterkeys(): stacks[s][key] = MISSING_REPO counts[key] = "!" continue args = get_missing(distro, os_platform, arch) try: args_fixed = get_missing(distro, os_platform, arch, repo=SHADOW_FIXED_REPO, lock_version=False) except BadRepo: for s in distro.stacks.iterkeys(): stacks[s][key] = MISSING_REPO counts[key] = "!" continue counts[key] = ','.join([str(len(x)) for x in args]) missing_primary, missing_dep, missing_excluded, missing_excluded_dep = args missing_primary_fixed, missing_dep_fixed, missing_excluded_fixed, missing_excluded_dep_fixed = args_fixed for s in missing_primary: if svn_url_exists(sourcedeb_url(distro, s, os_platform)): stacks[s][key] = MISSING_PRIMARY else: stacks[s][key] = MISSING_SOURCEDEB for s in missing_dep: if svn_url_exists(sourcedeb_url(distro, s, os_platform)): stacks[s][key] = MISSING_DEP else: stacks[s][key] = MISSING_SOURCEDEB for s in missing_primary_fixed: if svn_url_exists(sourcedeb_url(distro, s, os_platform)): stacks[s][key] = MISSING_BROKEN else: stacks[s][key] = MISSING_SOURCEDEB for s in missing_dep_fixed: if svn_url_exists(sourcedeb_url(distro, s, os_platform)): stacks[s][key] = MISSING_BROKEN_DEP else: stacks[s][key] = MISSING_SOURCEDEB for s in missing_excluded: stacks[s][key] = MISSING_EXCLUDED for s in missing_excluded_dep: stacks[s][key] = MISSING_EXCLUDED_DEP with open(output, 'w') as f: f.write(get_html_header(distro_name)) f.write(get_html_repository_status(distro, os_platforms, arches)) f.write(get_html_legend()) job = 'debbuild-build-debs' f.write( get_html_table_header(h, distro_name, os_platforms, arches, counts, job)) stack_names = sorted(stacks.keys()) for stack in stack_names: d = stacks[stack] shadow_version = distro.stacks[stack].version # generate URL stack_name = stack stack_version = shadow_version url = SOURCEDEB_DIR_URI % locals() # MISSING_SOURCEDEB is os/arch independent, so treat row as a whole sample_key = "%s-%s" % (os_platforms[0], arches[0]) if sample_key in d and d[sample_key] == MISSING_SOURCEDEB: color = COLORS[d[sample_key]] job_url = sourcedeb_job_url(h, distro_name, stack, shadow_version) f.write( '<tr><td bgcolor="%s"><a href="%s">%s %s</a> <a href="%s">[+]</a></td>' % (color, url, stack, shadow_version, job_url)) else: if 0: f.write('<tr><td><a href="%s">%s %s</a></td>' % (url, stack, shadow_version)) else: job_url = sourcedeb_job_url(h, distro_name, stack, shadow_version) # temporarily including [+] for all right now to help bringup maverick f.write( '<tr><td><a href="%s">%s %s</a> <a href="%s">[+]</a></td>' % (url, stack, shadow_version, job_url)) for os_platform in os_platforms: for arch in arches: key = "%s-%s" % (os_platform, arch) # compute version in actual repo version_str = '' try: main_match = get_stack_version(main_repo[key], distro_name, stack) fixed_match = get_stack_version( fixed_repo[key], distro_name, stack) if main_match != shadow_version or fixed_match != shadow_version: main_match = main_match or '0' fixed_match = fixed_match or '0' version_str = '<em>' + str( fixed_match) + ', ' + str(main_match) + '</em>' except Exception, e: print str(e) if key in d: val = d[key] color = COLORS[val] params = {'STACK_NAME': stack} if val == MISSING_SOURCEDEB: f.write('<td bgcolor="%s">%s %s</td>' % (color, val, version_str)) else: url = h.build_job_url( '%s-%s-%s-%s' % (job, distro_name, os_platform, arch), parameters=params) f.write( '<td bgcolor="%s">%s <a href="%s">[+]</a> %s</td>' % (color, val, url, version_str)) else: f.write('<td> %s </td>' % version_str) f.write('</tr>\n') f.write('\n</table></body></html>')