def test_rpmbuild(self): out = backtick_osg_build(["rpmbuild", self.pkg_dir]) try: self.assertRegexpMatches( out, r'(?ms)The following RPM[(]s[)] have been created:\n', "rpm created message not found") except: errprintf("Problems found. Output:\n%s", out) raise
def svn_export(path, rev, destpath): """Run svn export on a revision rev of path into destpath""" try: checked_backtick( ["svn", "export", opj(C.SVN_ROOT, path) + "@" + rev, "-r", rev, destpath], err2out=True) except CalledProcessError as err: errprintf("Error in svn export:\n%s", err.output) raise
def svn_export(path, rev, destpath): '''Run svn export on a revision rev of path into destpath''' try: checked_backtick([ "svn", "export", opj(C.SVN_ROOT, path) + "@" + rev, "-r", rev, destpath ], err2out=True) except CalledProcessError as err: errprintf("Error in svn export:\n%s", err.output) raise
def test_rpmbuild(self): out = backtick_osg_build(["rpmbuild", self.pkg_dir]) try: self.assertRegexpMatches( out, r'(?ms) >> The following RPM[(]s[)] have been created:\n' r'[^\n]+' r'yum-remove-osg-1[.]0-0[.]2[.]osg[.]el\d[.]noarch[.]rpm', "rpm created message not found") except: errprintf("Problems found. Output:\n%s", out) raise
def test_lint(self): out = backtick_osg_build(["lint", self.pkg_dir]) try: self.assertRegexpMatches( out, re.escape("1 packages and 0 specfiles checked"), "unexpected number of packages checked") self.assertRegexpMatches( out, re.escape("rpmlint found problems with condor"), "expected problems not found") except: errprintf("Problems found. Output:\n%s", out) raise
def check_for_mock_group(self): username = pwd.getpwuid(os.getuid()).pw_name try: mock_group = grp.getgrnam('mock') except KeyError: errprintf("mock group not found") return False try: if username in mock_group.gr_mem: return True except AttributeError: pass errprintf("%s not in mock group", username) return False
def test_lint(self): out = backtick_osg_build(["lint", self.pkg_dir]) try: self.assertRegexpMatches( out, re.escape("yum-remove-osg.src:25: E: hardcoded-library-path"), "expected error not found") self.assertRegexpMatches( out, re.escape("1 packages and 0 specfiles checked"), "unexpected number of packages checked") self.assertRegexpMatches( out, re.escape("rpmlint found problems with yum-remove-osg"), "expected problems not found") except: errprintf("Problems found. Output:\n%s", out) raise
from unittest import makeSuite import sys import osgbuild.constants as C from osgbuild import main from osgbuild import srpm from osgbuild.utils import (checked_backtick, checked_call, CalledProcessError, find_file, errprintf) TRUNK = "native/redhat/trunk" initial_wd = os.getcwd() osg_build_path = find_file('osg-build', [initial_wd, '/usr/bin']) if not osg_build_path: errprintf("osg-build script not found!") sys.exit(255) osg_build_command = [osg_build_path] def common_setUp(path, rev): '''Create a temporary directory, ensure it gets deleted on exit, cd to it, and check out a specific revision of a path from our SVN. ''' working_dir = tempfile.mkdtemp(prefix="osg-build-test-") atexit.register(shutil.rmtree, working_dir) os.chdir(working_dir) svn_export(path, rev, os.path.basename(path)) return opj(working_dir, os.path.basename(path))
from osgbuild.utils import ( checked_backtick, checked_call, CalledProcessError, find_file, errprintf, unslurp) TRUNK = "native/redhat/trunk" initial_wd = os.getcwd() osg_build_path = find_file('osg-build', [initial_wd, '/usr/bin']) if not osg_build_path: errprintf("osg-build script not found!") sys.exit(255) osg_build_command = [osg_build_path] def go_to_temp_dir(): working_dir = tempfile.mkdtemp(prefix="osg-build-test-") atexit.register(shutil.rmtree, working_dir) os.chdir(working_dir) return working_dir def common_setUp(path, rev): """Create a temporary directory, ensure it gets deleted on exit, cd to it, and check out a specific revision of a path from our SVN.