def _test_unary_package_repository(release_dir, version, directory=None): print("Testing in {0} at version {1}".format(release_dir, version)) 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/<version> tag exist? ret, out, err = user('git tag', return_io=True) assert out.count('upstream/' + version) == 1, "no upstream tag created" # Is the package.xml from upstream in the upstream branch now? with inbranch('upstream'): assert os.path.exists('package.xml'), \ "upstream did not import: '" + os.getcwd() + "': " + \ str(os.listdir(os.getcwd())) 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" with open('package.xml') as f: package_xml = f.read() assert package_xml.count(version), "not right file" ### ### Release generator ### # patch import should have reported OK assert ret == code.OK, "actually returned ({0})".format(ret) # do the proper branches exist? assert branch_exists('release/groovy/foo'), \ "no release/groovy/foo branch" assert branch_exists('patches/release/groovy/foo'), \ "no patches/release/groovy/foo branch" # was the release tag created? ret, out, err = user('git tag', return_io=True) expected = 'release/groovy/foo/' + version + '-0' assert out.count(expected) == 1, \ "no release tag created, expected: '{0}'".format(expected) ### ### Make patch ### with inbranch('release/groovy/foo'): 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.islink('include/sym/foo.h'), "Symbolic link lost during pipeline" if os.path.exists('include/foo.h'): user('git rm include/foo.h') else: if not os.path.exists('include'): os.makedirs('include') user('touch include/foo.h') user('git add include/foo.h') user('git commit -m "A release patch" --allow-empty') ### ### Test import and export ### with inbranch('release/groovy/foo'): export_cmd.export_patches() remove_cmd.remove_patches() import_cmd.import_patches() ### ### Release generator, again ### # patch import should have reported OK assert ret == code.OK, "actually returned ({0})".format(ret) # do the proper branches exist? assert branch_exists('release/groovy/foo'), \ "no release/groovy/foo branch" assert branch_exists('patches/release/groovy/foo'), \ "no patches/release/groovy/foo branch" # was the release tag created? ret, out, err = user('git tag', return_io=True) assert out.count('release/groovy/foo/' + version) == 1, \ "no release tag created"
def _test_unary_package_repository(release_dir, version, directory=None): print("Testing in {0} at version {1}".format(release_dir, version)) 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/<version> tag exist? ret, out, err = user('git tag', return_io=True) assert out.count('upstream/' + version) == 1, "no upstream tag created" # Is the package.xml from upstream in the upstream branch now? with inbranch('upstream'): assert os.path.exists('package.xml'), \ "upstream did not import: '" + os.getcwd() + "': " + \ str(os.listdir(os.getcwd())) 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" with open('package.xml') as f: package_xml = f.read() assert package_xml.count(version), "not right file" ### ### Release generator ### # patch import should have reported OK assert ret == code.OK, "actually returned ({0})".format(ret) # do the proper branches exist? assert branch_exists('release/groovy/foo'), \ "no release/groovy/foo branch" assert branch_exists('patches/release/groovy/foo'), \ "no patches/release/groovy/foo branch" # was the release tag created? ret, out, err = user('git tag', return_io=True) expected = 'release/groovy/foo/' + version + '-0' assert out.count(expected) == 1, \ "no release tag created, expected: '{0}'".format(expected) ### ### Make patch ### with inbranch('release/groovy/foo'): 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.islink( 'include/sym/foo.h'), "Symbolic link lost during pipeline" if os.path.exists('include/foo.h'): user('git rm include/foo.h') else: if not os.path.exists('include'): os.makedirs('include') user('touch include/foo.h') user('git add include/foo.h') user('git commit -m "A release patch" --allow-empty') ### ### Test import and export ### with inbranch('release/groovy/foo'): export_cmd.export_patches() remove_cmd.remove_patches() import_cmd.import_patches() ### ### Release generator, again ### # patch import should have reported OK assert ret == code.OK, "actually returned ({0})".format(ret) # do the proper branches exist? assert branch_exists('release/groovy/foo'), \ "no release/groovy/foo branch" assert branch_exists('patches/release/groovy/foo'), \ "no patches/release/groovy/foo branch" # was the release tag created? ret, out, err = user('git tag', return_io=True) assert out.count('release/groovy/foo/' + version) == 1, \ "no release tag created"
def _test_unary_package_repository(release_dir, version, directory=None): print("Testing in {0} at version {1}".format(release_dir, version)) 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/<version> tag exist? ret, out, err = user("git tag", return_io=True) assert out.count("upstream/" + version) == 1, "no upstream tag created" # Is the package.xml from upstream in the upstream branch now? with inbranch("upstream"): assert os.path.exists("package.xml"), ( "upstream did not import: '" + os.getcwd() + "': " + str(os.listdir(os.getcwd())) ) with open("package.xml") as f: package_xml = f.read() assert package_xml.count(version), "not right file" ### ### Release generator ### # patch import should have reported OK assert ret == code.OK, "actually returned ({0})".format(ret) # do the proper branches exist? assert branch_exists("release/groovy/foo"), "no release/groovy/foo branch" assert branch_exists("patches/release/groovy/foo"), "no patches/release/groovy/foo branch" # was the release tag created? ret, out, err = user("git tag", return_io=True) assert out.count("release/groovy/foo/" + version + "-0") == 1, "no release tag created" ### ### Make patch ### with inbranch("release/groovy/foo"): if os.path.exists("include/foo.h"): user("git rm include/foo.h") else: if not os.path.exists("include"): os.makedirs("include") user("touch include/foo.h") user("git add include/foo.h") user('git commit -m "A release patch" --allow-empty') ### ### Test import and export ### with inbranch("release/groovy/foo"): export_cmd.export_patches() remove_cmd.remove_patches() import_cmd.import_patches() ### ### Release generator, again ### # patch import should have reported OK assert ret == code.OK, "actually returned ({0})".format(ret) # do the proper branches exist? assert branch_exists("release/groovy/foo"), "no release/groovy/foo branch" assert branch_exists("patches/release/groovy/foo"), "no patches/release/groovy/foo branch" # was the release tag created? ret, out, err = user("git tag", return_io=True) assert out.count("release/groovy/foo/" + version) == 1, "no release tag created"