def compute_missing(distros, arches, fqdn, rosdistro, sourcerpm_only=False, wet_only=False): """ Compute what packages are missing from a repo based on the rosdistro files, both wet and dry. """ repo_url = 'http://%s/smd-ros-building' % fqdn rd = Rosdistro(rosdistro) # We take the intersection of repo-specific targets with default # targets. if distros: target_distros = distros else: target_distros = rd.get_target_distros() missing = {} for short_package_name in rd.get_package_list(): #print ('Analyzing WET stack "%s" for "%s"' % (r['url'], target_distros)) # todo check if sourcerpm is present with the right version rpm_name = redhatify_package_name(rosdistro, short_package_name) expected_version = rd.get_version(short_package_name, full_version=True) missing[short_package_name] = [] for d in target_distros: d_ver = fedora_release_version(d) if not repo.rpm_in_repo(repo_url, rpm_name, str(expected_version) + "\.fc" + d_ver, d, 'SRPMS'): missing[short_package_name].append((d, 'SRPMS')) if not sourcerpm_only: for a in arches: if not repo.rpm_in_repo(repo_url, rpm_name, str(expected_version) + "\.fc" + d_ver, d, a): missing[short_package_name].append((d, a)) if not sourcerpm_only and not wet_only: #dry stacks # dry dependencies dist = load_distro(distro_uri(rosdistro)) distro_arches = [] for d in target_distros: for a in arches: distro_arches.append((d, a)) for s in dist.stacks: #print ("Analyzing DRY job [%s]" % s) expected_version = dry_get_stack_version(s, dist) # sanitize undeclared versions for string substitution if not expected_version: expected_version = '' missing[s] = [] # for each distro arch check if the RPM is present. If not trigger the build. for (d, a) in distro_arches: if not repo.rpm_in_repo(repo_url, redhatify_package_name(rosdistro, s), expected_version + "\.fc" + fedora_release_version(d), d, a): missing[s].append((d, a)) return missing