def fallback_resolver(key, peer_packages, rosdistro=self.rosdistro): if key in peer_packages: return [ sanitize_package_name(rosify_package_name(key, rosdistro)) ] return default_fallback_resolver(key, peer_packages)
def test_multi_package_repository(directory=None): """ Release a multi package catkin (groovy) repository. """ directory = directory if directory is not None else os.getcwd() # Setup pkgs = ['foo', 'bar_ros', 'baz'] upstream_dir = create_upstream_repository(pkgs, directory) upstream_url = 'file://' + upstream_dir release_url = create_release_repo( upstream_url, 'git', 'groovy_devel', 'groovy') release_dir = os.path.join(directory, 'foo_release_clone') release_client = get_vcs_client('git', release_dir) assert release_client.checkout(release_url) with change_directory(release_dir): # First run everything with bloom_answer(bloom_answer.ASSERT_NO_QUESTION): cmd = 'git-bloom-release{0} groovy' if 'BLOOM_VERBOSE' not in os.environ: cmd = cmd.format(' --quiet') else: cmd = cmd.format('') user(cmd, silent=False) ### ### Import upstream ### # does the upstream branch exist? assert branch_exists('upstream', local_only=True), "no upstream branch" # does the upstrea/0.1.0 tag exist? ret, out, err = user('git tag', return_io=True) assert out.count('upstream/0.1.0') == 1, "no upstream tag created" # Is the package.xml from upstream in the upstream branch now? with inbranch('upstream'): for pkg in pkgs: with change_directory(pkg): assert os.path.exists( os.path.join('debian', 'something.udev')), \ "Lost the debian overlaid files in upstream branch" assert os.path.exists('white space.txt~'), \ "Lost file with whitespace in name in upstream branch" assert os.path.exists('package.xml'), \ "upstream did not import: " + os.listdir() with open('package.xml') as f: assert f.read().count('0.1.0'), "not right file" ### ### Release generator ### # Check the environment after the release generator ret, out, err = user('git tag', return_io=True) for pkg in pkgs: # Does the release/pkg branch exist? assert branch_exists('release/groovy/' + pkg), \ "no release/groovy/" + pkg + " branch" # Does the patches/release/pkg branch exist? assert branch_exists('patches/release/groovy/' + pkg), \ "no patches/release/groovy/" + pkg + " branch" # Did the release tag get created? assert out.count('release/groovy/' + pkg + '/0.1.0-0') == 1, \ "no release tag created for " + pkg # Is there a package.xml in the top level? with inbranch('release/groovy/' + pkg): assert os.path.exists('package.xml'), "release branch invalid" # Is it the correct package.xml for this pkg? package_xml = open('package.xml', 'r').read() assert package_xml.count('<name>' + pkg + '</name>'), \ "incorrect package.xml for " + str(pkg) # Make a patch with inbranch('release/groovy/' + pkgs[0]): user('echo "This is a change" >> README.md') user('git add README.md') user('git commit -m "added a readme" --allow-empty') ### ### Release generator, again ### with bloom_answer(bloom_answer.ASSERT_NO_QUESTION): ret = user('git-bloom-generate -y rosrelease groovy -s upstream') # patch import should have reported OK assert ret == code.OK, "actually returned ({0})".format(ret) # Check the environment after the release generator ret, out, err = user('git tag', return_io=True) for pkg in pkgs: # Does the release/pkg branch exist? assert branch_exists('release/groovy/' + pkg), \ "no release/groovy/" + pkg + " branch" # Does the patches/release/pkg branch exist? assert branch_exists('patches/release/groovy/' + pkg), \ "no patches/release/groovy/" + pkg + " branch" # Did the release tag get created? assert out.count('release/groovy/' + pkg + '/0.1.0-0') == 1, \ "no release tag created for " + pkg # Is there a package.xml in the top level? with inbranch('release/groovy/' + pkg): assert os.path.exists(os.path.join('debian', 'something.udev')), \ "Lost the debian overlaid files in release branch" assert os.path.exists('white space.txt~'), \ "Lost file with whitespace in name in release branch" assert os.path.exists('package.xml'), "release branch invalid" # Is it the correct package.xml for this pkg? with open('package.xml', 'r') as f: assert f.read().count('<name>' + pkg + '</name>'), \ "incorrect package.xml for " + str(pkg) ### ### ROSDebian Generator ### # Check the environment after the release generator ret, out, err = user('git tag', return_io=True) for pkg in pkgs: for distro in ['oneiric', 'precise', 'quantal']: pkg_san = sanitize_package_name(pkg) # Does the debian/distro/pkg branch exist? assert branch_exists('debian/groovy/' + distro + '/' + pkg), \ "no debian/groovy/" + pkg + " branch" # Does the patches/debian/distro/pkg branch exist? patches_branch = 'patches/debian/groovy/' + distro + '/' + pkg assert branch_exists(patches_branch), \ "no " + patches_branch + " branch" # Did the debian tag get created? tag = 'debian/ros-groovy-' + pkg_san + '_0.1.0-0_' + distro assert out.count(tag) == 1, \ "no '" + tag + "'' tag created for '" + pkg + "': `\n" + \ out + "\n`" # Is there a package.xml in the top level? with inbranch('debian/groovy/' + distro + '/' + pkg): assert os.path.exists( os.path.join('debian', 'something.udev')), \ "Lost the debian overlaid files in debian branch" assert os.path.exists('white space.txt~'), \ "Lost file with whitespace in name in debian branch" assert os.path.exists('package.xml'), "debian branch invalid" # Is there blank lins due to no Conflicts/Replaces? # See: https://github.com/ros-infrastructure/bloom/pull/329 with open(os.path.join('debian', 'control'), 'r') as f: assert f.read().count('\n\nHomepage:') == 0, \ "Extra blank line before Homepage detected." # Is it the correct package.xml for this pkg? with open('package.xml', 'r') as f: assert f.read().count('<name>' + pkg + '</name>'), \ "incorrect package.xml for " + str(pkg)
def test_multi_package_repository(directory=None): """ Release a multi package catkin (groovy) repository. """ directory = directory if directory is not None else os.getcwd() # Setup pkgs = ['foo', 'bar_ros', 'baz'] upstream_dir = create_upstream_repository(pkgs, directory, format_versions=[1, 2, 3]) upstream_url = 'file://' + upstream_dir release_url = create_release_repo(upstream_url, 'git', 'groovy_devel', 'groovy') release_dir = os.path.join(directory, 'foo_release_clone') release_client = get_vcs_client('git', release_dir) assert release_client.checkout(release_url) with change_directory(release_dir): # First run everything with bloom_answer(bloom_answer.ASSERT_NO_QUESTION): cmd = 'git-bloom-release{0} groovy' if 'BLOOM_VERBOSE' not in os.environ: cmd = cmd.format(' --quiet') else: cmd = cmd.format('') user(cmd, silent=False) ### ### Import upstream ### # does the upstream branch exist? assert branch_exists('upstream', local_only=True), "no upstream branch" # does the upstrea/0.1.0 tag exist? ret, out, err = user('git tag', return_io=True) assert out.count('upstream/0.1.0') == 1, "no upstream tag created" # Is the package.xml from upstream in the upstream branch now? with inbranch('upstream'): for pkg in pkgs: with change_directory(pkg): assert os.path.exists( os.path.join('debian', 'something.udev')), \ "Lost the debian overlaid files in upstream branch" assert os.path.exists('white space.txt~'), \ "Lost file with whitespace in name in upstream branch" assert os.path.exists('package.xml'), \ "upstream did not import: " + os.listdir() with open('package.xml') as f: assert f.read().count('0.1.0'), "not right file" ### ### Release generator ### # Check the environment after the release generator ret, out, err = user('git tag', return_io=True) for pkg in pkgs: # Does the release/pkg branch exist? assert branch_exists('release/groovy/' + pkg), \ "no release/groovy/" + pkg + " branch" # Does the patches/release/pkg branch exist? assert branch_exists('patches/release/groovy/' + pkg), \ "no patches/release/groovy/" + pkg + " branch" # Did the release tag get created? assert out.count('release/groovy/' + pkg + '/0.1.0-0') == 1, \ "no release tag created for " + pkg # Is there a package.xml in the top level? with inbranch('release/groovy/' + pkg): assert os.path.exists('package.xml'), "release branch invalid" # Is it the correct package.xml for this pkg? package_xml = open('package.xml', 'r').read() assert package_xml.count('<name>' + pkg + '</name>'), \ "incorrect package.xml for " + str(pkg) # Make a patch with inbranch('release/groovy/' + pkgs[0]): user('echo "This is a change" >> README.md') user('git add README.md') user('git commit -m "added a readme" --allow-empty') ### ### Release generator, again ### with bloom_answer(bloom_answer.ASSERT_NO_QUESTION): ret = user('git-bloom-generate -y rosrelease groovy -s upstream') # patch import should have reported OK assert ret == code.OK, "actually returned ({0})".format(ret) # Check the environment after the release generator ret, out, err = user('git tag', return_io=True) for pkg in pkgs: # Does the release/pkg branch exist? assert branch_exists('release/groovy/' + pkg), \ "no release/groovy/" + pkg + " branch" # Does the patches/release/pkg branch exist? assert branch_exists('patches/release/groovy/' + pkg), \ "no patches/release/groovy/" + pkg + " branch" # Did the release tag get created? assert out.count('release/groovy/' + pkg + '/0.1.0-0') == 1, \ "no release tag created for " + pkg # Is there a package.xml in the top level? with inbranch('release/groovy/' + pkg): assert os.path.exists(os.path.join('debian', 'something.udev')), \ "Lost the debian overlaid files in release branch" assert os.path.exists('white space.txt~'), \ "Lost file with whitespace in name in release branch" assert os.path.exists('package.xml'), "release branch invalid" # Is it the correct package.xml for this pkg? with open('package.xml', 'r') as f: assert f.read().count('<name>' + pkg + '</name>'), \ "incorrect package.xml for " + str(pkg) ### ### ROSDebian Generator ### # Check the environment after the release generator ret, out, err = user('git tag', return_io=True) for pkg in pkgs: for distro in ['oneiric', 'precise', 'quantal']: pkg_san = sanitize_package_name(pkg) # Does the debian/distro/pkg branch exist? assert branch_exists('debian/groovy/' + distro + '/' + pkg), \ "no debian/groovy/" + pkg + " branch" # Does the patches/debian/distro/pkg branch exist? patches_branch = 'patches/debian/groovy/' + distro + '/' + pkg assert branch_exists(patches_branch), \ "no " + patches_branch + " branch" # Did the debian tag get created? tag = 'debian/ros-groovy-' + pkg_san + '_0.1.0-0_' + distro assert out.count(tag) == 1, \ "no '" + tag + "'' tag created for '" + pkg + "': `\n" + \ out + "\n`" # Is there a package.xml in the top level? with inbranch('debian/groovy/' + distro + '/' + pkg): assert os.path.exists( os.path.join('debian', 'something.udev')), \ "Lost the debian overlaid files in debian branch" assert os.path.exists('white space.txt~'), \ "Lost file with whitespace in name in debian branch" assert os.path.exists('package.xml'), "debian branch invalid" # Is there blank lins due to no Conflicts/Replaces? # See: https://github.com/ros-infrastructure/bloom/pull/329 with open(os.path.join('debian', 'control'), 'r') as f: assert f.read().count('\n\nHomepage:') == 0, \ "Extra blank line before Homepage detected." # Is it the correct package.xml for this pkg? with open('package.xml', 'r') as f: package_xml = f.read() assert package_xml.count('<name>' + pkg + '</name>'), \ "incorrect package.xml for " + str(pkg) format_version = int( re.search('format="(\d+)"', package_xml).group(1)) # Is there a copyright file for this pkg? if format_version <= 2: assert not os.path.exists( os.path.join('debian', 'copyright')), \ "debian/copyright should not be generated" else: with open('debian/copyright', 'r') as f: assert pkg + ' license' in f.read(), \ "debian/copyright does not include right license text"
def fallback_resolver(key, peer_packages, rosdistro=self.rosdistro): if key in peer_packages: return [sanitize_package_name(rosify_package_name(key, rosdistro))] return default_fallback_resolver(key, peer_packages)