def test_generate_deb_from_directory(): tempdir = tempfile.gettempdir() checkout_dir = os.path.join(tempdir, 'vdist') git_p = subprocess.Popen( ['git', 'clone', 'https://github.com/objectified/vdist', checkout_dir]) git_p.communicate() builder = Builder() builder.add_build( app='vdist-test-generate-deb-from-dir', version='1.0', source=directory( path=checkout_dir, ), profile='ubuntu-trusty' ) builder.build() homedir = os.path.expanduser('~') target_file = os.path.join( homedir, '.vdist', 'dist', 'vdist-test-generate-deb-from-dir-1.0-ubuntu-trusty', 'vdist-test-generate-deb-from-dir_1.0_amd64.deb' ) assert os.path.isfile(target_file) assert os.path.getsize(target_file) > 0
def test_build_projectroot_from_directory(): build = Build(name='my build', app='myapp', version='1.0', source=directory(path='/var/tmp/vdist'), profile='ubuntu-trusty') assert build.get_project_root_from_source() == 'vdist'
def test_build_projectroot_from_directory(): build = Build( name='my build', app='myapp', version='1.0', source=directory(path='/var/tmp/vdist'), profile='ubuntu-trusty' ) assert build.get_project_root_from_source() == 'vdist'
def generate_rpm_from_directory(centos_version): tempdir = tempfile.gettempdir() checkout_dir = os.path.join(tempdir, 'vdist') git_p = subprocess.Popen( ['git', 'clone', 'https://github.com/objectified/vdist', checkout_dir]) git_p.communicate() builder_parameters = {"app": 'vdist-test-generate-deb-from-dir', "version": '1.0', "source": directory(path=checkout_dir, ), "profile": centos_version} _ = _generate_rpm(builder_parameters, centos_version)
def _generate_rpm_from_directory(centos_version): tempdir = tempfile.gettempdir() checkout_dir = os.path.join(tempdir, 'vdist') git_p = subprocess.Popen( ['git', 'clone', 'https://github.com/objectified/vdist', checkout_dir]) git_p.communicate() builder_parameters = { "app": 'vdist-test-generate-deb-from-dir', "version": '1.0', "source": directory(path=checkout_dir, ), "profile": centos_version } _ = _generate_rpm(builder_parameters, centos_version)
def _generate_rpm_from_directory(centos_version): with temporary_directory() as temp_dir, temporary_directory() as output_dir: git_p = subprocess.Popen( ['git', 'clone', 'https://github.com/dante-signal31/vdist', temp_dir]) git_p.communicate() builder_parameters = {"app": 'vdist-test-generate-deb-from-dir', "version": '1.0', "source": directory(path=temp_dir, ), "profile": centos_version, "output_folder": output_dir, "output_script": True} _ = _generate_rpm(builder_parameters)
def _generate_rpm_from_directory(centos_version): with temporary_directory() as temp_dir, temporary_directory( ) as output_dir: os.chdir(temp_dir) ci_tools.run_console_command("git clone {} {}".format( VDIST_GITHUB_REPOSITORY, temp_dir)) ci_tools.run_console_command( "git checkout {}".format(VDIST_TEST_BRANCH)) builder_parameters = { "app": 'vdist-test-generate-deb-from-dir', "version": '1.0', "source": directory(path=temp_dir, ), "profile": centos_version, "output_folder": output_dir, "output_script": True } _ = _generate_rpm(builder_parameters)
from vdist.builder import Builder from vdist.source import directory, git_directory builder = Builder() # build from a local directory builder.add_build(name='my directory based build', app='myproject', version='1.0', source=directory(path='/home/user/dev/yourproject'), profile='centos6') # or, build from a git repo *inside* a local directory builder.add_build(name='my directory based build', app='myproject', version='1.0', source=git_directory(path='/home/user/dev/anotherproject', branch='your-release-branch'), profile='centos6') # .. and build them in parallel builder.build()
def _process_source_directory_argument(self, arguments): if "source_directory" in arguments.keys(): directory = arguments["source_directory"] directory = directory.strip() self.builder_parameters["source"] = source.directory(directory)
import os from vdist.builder import Builder from vdist.source import directory builder = Builder() builder.add_build( app='vdist-django-example', version='1.0', source=directory(path=os.getcwd()), profile='centos6' ) builder.build()
def test_source_type_directory(): s = directory(path='/foo/bar/baz/') assert s['path'] == '/foo/bar/baz'
import os from vdist.builder import Builder from vdist.source import directory builder = Builder() builder.add_build(app='vdist-django-example', version='1.0', source=directory(path=os.getcwd()), profile='centos6') builder.build()
from vdist.builder import Builder from vdist.source import directory, git_directory builder = Builder() # build from a local directory builder.add_build( name='my directory based build', app='myproject', version='1.0', source=directory( path='/home/user/dev/yourproject' ), profile='centos6' ) # or, build from a git repo *inside* a local directory builder.add_build( name='my directory based build', app='myproject', version='1.0', source=git_directory( path='/home/user/dev/anotherproject', branch='your-release-branch' ), profile='centos6' ) # .. and build them in parallel builder.build()
import vdist.builder as builder from vdist.configuration import Configuration from vdist.source import directory app = 'thebideo-comments' version = '1.' + os.environ['BUILD_NUMBER'] python_ver = '3.6.6' root_dir, tmp = os.path.split(os.getcwd()) ln_dir = root_dir + '/' + app os.symlink(os.getcwd(), ln_dir, True) builder_parameters = { "app": app, "version": version, "source": directory(path=ln_dir), "profile": 'centos7', "python_version": python_ver, "requirements_path": '/requirements.txt', "output_folder": './vdist', "runtime_deps": ["compat-openssl10"], "after_install": './package/post-install.sh', "after_upgrade": './package/post-upgrade.sh', "after_remove": './package/post-remove.sh' } configuration = Configuration(builder_parameters) builder.build_package(configuration) os.unlink(ln_dir)
def _get_builder_parameters(app_name, profile_name, temp_dir, output_dir): builder_configurations = { ## TODO: Some tests fail if I leave app_name at "app" but not hardcode it. Give it a second thought and leave coherent. ## TODO: To much code redundancy in these configurations. See how to reduce it. "vdist-test-generate-deb-from-dir": { "app": app_name, "version": '1.0', "source": directory(path=temp_dir, ), "profile": profile_name, "output_folder": output_dir, "output_script": True }, 'vdist-test-generate-rpm-from-dir': { "app": 'vdist-test-generate-rpm-from-dir', "version": '1.0', "source": directory(path=temp_dir, ), "profile": profile_name, "output_folder": output_dir, "output_script": True }, "vdist-test-generate-pkg-from-dir": { "app": app_name, "version": '1.0', "source": directory(path=temp_dir, ), "profile": profile_name, "output_folder": output_dir, "output_script": True }, "vdist-test-generate-deb-from-git-dir": { "app": app_name, "version": '1.0', "source": git_directory(path=temp_dir, branch='vdist_tests'), "profile": 'ubuntu-lts', "output_folder": output_dir, "output_script": True }, "vdist-test-generate-rpm-from-git-dir": { "app": app_name, "version": '1.0', "source": git_directory(path=temp_dir, branch='vdist_tests'), "profile": profile_name, "output_folder": output_dir, "output_script": True }, "vdist-test-generate-pkg-from-git-dir": { "app": app_name, "version": '1.0', "source": git_directory(path=temp_dir, branch='vdist_tests'), "profile": profile_name, "output_folder": output_dir, "output_script": True }, "vdist-test-generate-deb-from-git-suffixed": { "app": app_name, "version": '1.0', "source": git(uri='https://github.com/dante-signal31/vdist.git', branch='vdist_tests'), "profile": profile_name, "output_folder": output_dir, "output_script": True }, "vdist-test-generate-rpm-from-git-suffixed": { "app": app_name, "version": '1.0', "source": git(uri='https://github.com/dante-signal31/vdist.git', branch='vdist_tests'), "profile": profile_name, "output_folder": output_dir, "output_script": True }, "vdist-test-generate-pkg-from-git-suffixed": { "app": app_name, "version": '1.0', "source": git(uri='https://github.com/dante-signal31/vdist.git', branch='vdist_tests'), "profile": profile_name, "output_folder": output_dir, "output_script": True }, "jtrouble_nosetup_nocompile": { "app": 'jtrouble', "version": '1.0.0', "source": git(uri='https://github.com/objectified/jtrouble', branch='master'), "profile": profile_name, "compile_python": False, # Here happens the same than in # test_generate_deb_from_git_setup_nocompile() # "python_version": '3.4.4', "python_basedir": '/root/custom_python', "output_folder": output_dir, "output_script": True }, "geolocate-test-generate-deb-from-git-setup-nocompile": { "app": 'geolocate', "version": '1.4.1', "source": git(uri='https://github.com/dante-signal31/geolocate', branch='vdist_tests'), "profile": profile_name, "compile_python": False, # "python_version": '3.5.3', # Lets suppose custom python package is already installed and its root # folder is /root/custom_python. "python_basedir": '/root/custom_python', "fpm_args": FPM_ARGS_GEOLOCATE, "requirements_path": '/REQUIREMENTS.txt', "build_deps": [ "python3-all-dev", "build-essential", "libssl-dev", "pkg-config", "libdbus-glib-1-dev", "gnome-keyring", "libffi-dev" ], "runtime_deps": ["libssl1.0.0", "python3-dbus", "gnome-keyring"], "after_install": 'packaging/postinst.sh', "after_remove": 'packaging/postuninst.sh', "output_folder": output_dir, "output_script": True }, "geolocate-test_generate_rpm_from_git_setup_nocompile_centos": { "app": 'geolocate', "version": '1.4.1', "source": git(uri='https://github.com/dante-signal31/geolocate', branch='vdist_tests'), "profile": profile_name, "compile_python": False, # "python_version": '3.4.4', # Lets suppose custom python package is already installed and its root # folder is '/root/custom_python'. "python_basedir": '/root/custom_python', "fpm_args": FPM_ARGS_GEOLOCATE, "requirements_path": '/REQUIREMENTS.txt', "build_deps": [ "python3-all-dev", "build-essential", "libssl-dev", "pkg-config", "libdbus-glib-1-dev", "gnome-keyring", "libffi-dev" ], "runtime_deps": ["libssl1.0.0", "python3-dbus", "gnome-keyring"], "after_install": 'packaging/postinst.sh', "after_remove": 'packaging/postuninst.sh', "output_folder": output_dir, "output_script": True }, "geolocate-test-generate-pkg-from-git-setup-nocompile": { "app": 'geolocate', "version": '1.4.1', "source": git(uri='https://github.com/dante-signal31/geolocate', branch='vdist_tests'), "profile": profile_name, "compile_python": False, # "python_version": '3.4.4', # Lets suppose custom python package is already installed and its root # folder is '/root/custom_python'. "python_basedir": '/root/custom_python', "fpm_args": FPM_ARGS_GEOLOCATE, "requirements_path": '/REQUIREMENTS.txt', "build_deps": [ "python3", "base-devel", "openssl", "pkg-config", "dbus-glib", "gnome-keyring", "libffi" ], "runtime_deps": ["openssl", "python-dbus", "gnome-keyring"], "after_install": 'packaging/postinst.sh', "after_remove": 'packaging/postuninst.sh', "output_folder": output_dir, "output_script": True }, "jtrouble-test-generate-package-from-git-nosetup-compile": { "app": 'jtrouble', "version": '1.0.0', "source": git(uri='https://github.com/objectified/jtrouble', branch='master'), "profile": profile_name, "package_install_root": "/opt", "python_basedir": "/opt/python", "compile_python": True, "python_version": '3.4.4', "output_folder": output_dir, "output_script": True }, "vdist-test-generate-package-from-git-setup-compile": { "app": 'vdist', "version": '1.1.0', "source": git(uri='https://github.com/dante-signal31/vdist', branch='vdist_tests'), "profile": profile_name, "compile_python": True, "python_version": '3.5.3', "fpm_args": FPM_ARGS_VDIST, "requirements_path": '/REQUIREMENTS.txt', "runtime_deps": ["openssl", "docker-ce"], "after_install": 'packaging/postinst.sh', "after_remove": 'packaging/postuninst.sh', "output_folder": output_dir, "output_script": True }, "vdist-test-generate-from-git": { "app": app_name, "version": '1.0', "source": git(uri='https://github.com/dante-signal31/vdist', branch='vdist_tests'), "profile": profile_name, "output_folder": output_dir, "output_script": True } } return builder_configurations[app_name]