コード例 #1
0
ファイル: test_builder.py プロジェクト: dante-signal31/vdist
def generate_rpm_from_git_setup_compile(centos_version):
    builder_parameters = {
        "app": 'geolocate',
        "version": '1.3.0',
        "source": git(
            uri='https://github.com/dante-signal31/geolocate',
            branch='master'
        ),
        "profile": centos_version,
        "compile_python": True,
        "python_version": '3.4.4',
        "fpm_args": '--maintainer [email protected] -a native --url '
                    'https://github.com/dante-signal31/geolocate --description '
                    '"This program accepts any text and searchs inside every IP'
                    ' address. With each of those IP addresses, '
                    'geolocate queries '
                    'Maxmind GeoIP database to look for the city and '
                    'country where'
                    ' IP address or URL is located. Geolocate is designed to be'
                    ' used in console with pipes and redirections along with '
                    'applications like traceroute, nslookup, etc.'
                    ' " --license BSD-3 --category net',
        "requirements_path": '/REQUIREMENTS.txt',
        "runtime_deps": ["libssl1.0.0", ]
    }
    target_file = _generate_rpm(builder_parameters, centos_version)
    file_list = _read_rpm_contents(target_file)
    # At this point only a folder should remain if everything is correct.
    correct_install_path = "/opt/geolocate"
    assert all((True if correct_install_path in file_entry else False
                for file_entry in file_list))
    # Geolocate launcher should be in bin folder too.
    geolocate_launcher = "/opt/geolocate/bin/geolocate"
    assert geolocate_launcher in file_list
コード例 #2
0
def _generate_rpm_from_git_nosetup_compile(centos_version):
    builder_parameters = {
        "app":
        'jtrouble',
        "version":
        '1.0.0',
        "source":
        git(uri='https://github.com/objectified/jtrouble', branch='master'),
        "profile":
        centos_version,
        "package_install_root":
        "/opt",
        "python_basedir":
        "/opt/python",
        "compile_python":
        True,
        "python_version":
        '3.4.4',
    }
    target_file = _generate_rpm(builder_parameters, centos_version)
    file_list = _read_rpm_contents(target_file)
    # At this point only two folders should remain if everything is correct:
    # application folder and compiled interpreter folder.
    correct_folders = ["/opt/jtrouble", "/opt/python"]
    assert all((True if any(folder in file_entry
                            for folder in correct_folders) else False
                for file_entry in file_list))
    assert any(correct_folders[0] in file_entry for file_entry in file_list)
    assert any(correct_folders[1] in file_entry for file_entry in file_list)
コード例 #3
0
ファイル: test_builder.py プロジェクト: GetAttached/vdist
def _generate_rpm_from_git_nosetup_nocompile(centos_version):
    with temporary_directory() as output_dir:
        builder_parameters = {
            "app": 'jtrouble',
            "version": '1.0.0',
            "source": git(
                uri='https://github.com/objectified/jtrouble',
                branch='master'
            ),
            "profile": centos_version,
            "compile_python": False,
            # Here happens the same than in
            # test_generate_deb_from_git_setup_nocompile()
            "python_version": '3.4.4',
            "python_basedir": '/usr',
            "output_folder": output_dir,
            "output_script": True
        }
        target_file = _generate_rpm(builder_parameters)
        file_list = _read_rpm_contents(target_file)
        # At this point only two folders should remain if everything is correct:
        # application folder and python basedir folder.
        correct_folders = ["/opt/jtrouble", "/usr"]
        assert all((True if any(folder in file_entry for folder in correct_folders)
                    else False
                    for file_entry in file_list))
        # If python basedir was properly packaged then /usr/bin/python should be
        # there.
        python_interpreter = "/usr/bin/python"
        assert python_interpreter in file_list
コード例 #4
0
ファイル: test_builder.py プロジェクト: dante-signal31/vdist
def test_generate_deb_from_git_nosetup_nocompile():
    builder_parameters = {
        "app": 'jtrouble',
        "version": '1.0.0',
        "source": git(
            uri='https://github.com/objectified/jtrouble',
            branch='master'
        ),
        "profile": 'ubuntu-trusty',
        "compile_python": False,
        # Here happens the same than in
        # test_generate_deb_from_git_setup_nocompile()
        "python_version": '3.4.4',
        "python_basedir": '/usr',
    }
    target_file = _generate_deb(builder_parameters)
    file_list_purged = _get_purged_deb_file_list(target_file,
                                                 DEB_NOCOMPILE_FILTER)
    # At this point only two folders should remain if everything is correct:
    # application folder and python basedir folder.
    correct_folders = ["./opt/jtrouble", "./usr"]
    assert all((True if any(folder in file_entry for folder in correct_folders)
                else False
                for file_entry in file_list_purged))
    # If python basedir was properly packaged then /usr/bin/python should be
    # there.
    python_interpreter = "./usr/bin/python2.7"
    assert python_interpreter in file_list_purged
コード例 #5
0
def test_generate_deb_from_git_nosetup_compile():
    builder_parameters = {
        "app":
        'jtrouble',
        "version":
        '1.0.0',
        "source":
        git(uri='https://github.com/objectified/jtrouble', branch='master'),
        "profile":
        'ubuntu-trusty',
        "package_install_root":
        "/opt",
        "python_basedir":
        "/opt/python",
        "compile_python":
        True,
        "python_version":
        '3.4.4',
    }
    target_file = _generate_deb(builder_parameters)
    file_list_purged = _get_purged_deb_file_list(target_file,
                                                 DEB_COMPILE_FILTER)
    # At this point only two folders should remain if everything is correct:
    # application folder and compiled interpreter folder.
    correct_folders = ["./opt/jtrouble", "./opt/python"]
    assert all((True if any(folder in file_entry
                            for folder in correct_folders) else False
                for file_entry in file_list_purged))
    assert any(correct_folders[0] in file_entry
               for file_entry in file_list_purged)
    assert any(correct_folders[1] in file_entry
               for file_entry in file_list_purged)
コード例 #6
0
ファイル: test_builder.py プロジェクト: dante-signal31/vdist
def test_generate_deb_from_git_nosetup_compile():
    builder_parameters = {"app": 'jtrouble',
                          "version": '1.0.0',
                          "source": git(
                                uri='https://github.com/objectified/jtrouble',
                                branch='master'
                          ),
                          "profile": 'ubuntu-trusty',
                          "package_install_root": "/opt",
                          "python_basedir": "/opt/python",
                          "compile_python": True,
                          "python_version": '3.4.4', }
    target_file = _generate_deb(builder_parameters)
    file_list_purged = _get_purged_deb_file_list(target_file,
                                                 DEB_COMPILE_FILTER)
    # At this point only two folders should remain if everything is correct:
    # application folder and compiled interpreter folder.
    correct_folders = ["./opt/jtrouble", "./opt/python"]
    assert all((True if any(folder in file_entry for folder in correct_folders)
                else False
                for file_entry in file_list_purged))
    assert any(correct_folders[0] in file_entry
               for file_entry in file_list_purged)
    assert any(correct_folders[1] in file_entry
               for file_entry in file_list_purged)
コード例 #7
0
ファイル: test_builder.py プロジェクト: dante-signal31/vdist
def generate_rpm_from_git_nosetup_nocompile(centos_version):
    builder_parameters = {
        "app": 'jtrouble',
        "version": '1.0.0',
        "source": git(
            uri='https://github.com/objectified/jtrouble',
            branch='master'
        ),
        "profile": centos_version,
        "compile_python": False,
        # Here happens the same than in
        # test_generate_deb_from_git_setup_nocompile()
        "python_version": '3.4.4',
        "python_basedir": '/usr',
    }
    target_file = _generate_rpm(builder_parameters, centos_version)
    file_list = _read_rpm_contents(target_file)
    # At this point only two folders should remain if everything is correct:
    # application folder and python basedir folder.
    correct_folders = ["/opt/jtrouble", "/usr"]
    assert all((True if any(folder in file_entry for folder in correct_folders)
                else False
                for file_entry in file_list))
    # If python basedir was properly packaged then /usr/bin/python should be
    # there.
    python_interpreter = "/usr/bin/python"
    assert python_interpreter in file_list
コード例 #8
0
def test_generate_deb_from_git_nosetup_nocompile():
    builder_parameters = {
        "app":
        'jtrouble',
        "version":
        '1.0.0',
        "source":
        git(uri='https://github.com/objectified/jtrouble', branch='master'),
        "profile":
        'ubuntu-trusty',
        "compile_python":
        False,
        # Here happens the same than in
        # test_generate_deb_from_git_setup_nocompile()
        "python_version":
        '3.4.4',
        "python_basedir":
        '/usr',
    }
    target_file = _generate_deb(builder_parameters)
    file_list_purged = _get_purged_deb_file_list(target_file,
                                                 DEB_NOCOMPILE_FILTER)
    # At this point only two folders should remain if everything is correct:
    # application folder and python basedir folder.
    correct_folders = ["./opt/jtrouble", "./usr"]
    assert all((True if any(folder in file_entry
                            for folder in correct_folders) else False
                for file_entry in file_list_purged))
    # If python basedir was properly packaged then /usr/bin/python should be
    # there.
    python_interpreter = "./usr/bin/python2.7"
    assert python_interpreter in file_list_purged
コード例 #9
0
ファイル: test_builder.py プロジェクト: GetAttached/vdist
def _generate_rpm_from_git_setup_compile(centos_version):
    with temporary_directory() as output_dir:
        builder_parameters = {
            "app": 'vdist',
            "version": '1.1.0',
            "source": git(
                uri='https://github.com/dante-signal31/vdist',
                branch='vdist_tests'
            ),
            "profile": centos_version,
            "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
        }
        target_file = _generate_rpm(builder_parameters)
        file_list = _read_rpm_contents(target_file)
        # At this point only a folder should remain if everything is correct.
        correct_install_path = "/opt/vdist"
        assert all((True if correct_install_path in file_entry else False
                    for file_entry in file_list))
        # vdist launcher should be in bin folder too.
        vdist_launcher = "/opt/vdist/bin/vdist"
        assert vdist_launcher in file_list
コード例 #10
0
ファイル: test_builder.py プロジェクト: GetAttached/vdist
def test_generate_deb_from_git_setup_compile():
    with temporary_directory() as output_dir:
        builder_parameters = {
            "app": 'geolocate',
            "version": '1.4.1',
            "source": git(
                uri='https://github.com/dante-signal31/geolocate',
                branch='vdist_tests'
            ),
            "profile": 'ubuntu-trusty',
            "compile_python": True,
            "python_version": '3.5.3',
            "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
        }
        target_file = _generate_deb(builder_parameters)
        file_list_purged = _get_purged_deb_file_list(target_file,
                                                     DEB_COMPILE_FILTER)
        # At this point only a folder should remain if everything is correct.
        correct_install_path = "./opt/geolocate"
        assert all((True if correct_install_path in file_entry else False
                    for file_entry in file_list_purged))
        # Geolocate launcher should be in bin folder too.
        geolocate_launcher = "./opt/geolocate/bin/geolocate"
        assert geolocate_launcher in file_list_purged
コード例 #11
0
def test_build_projectroot_from_uri():
    build = Build(name='my build',
                  app='myapp',
                  version='1.0',
                  source=git(uri='https://github.com/objectified/vdist',
                             branch='release-1.0'),
                  profile='ubuntu-trusty')
    assert build.get_project_root_from_source() == 'vdist'
コード例 #12
0
ファイル: test_builder.py プロジェクト: dante-signal31/vdist
def test_generate_deb_from_git():
    builder_parameters = {"app": 'vdist-test-generate-deb-from-git',
                          "version": '1.0',
                          "source": git(
                              uri='https://github.com/objectified/vdist',
                              branch='master'
                          ),
                          "profile": 'ubuntu-trusty'}
    _ = _generate_deb(builder_parameters)
コード例 #13
0
def _generate_rpm_from_git(centos_version):
    builder_parameters = {
        "app": 'vdist-test-generate-rpm-from-git',
        "version": '1.0',
        "source": git(uri='https://github.com/objectified/vdist',
                      branch='master'),
        "profile": centos_version
    }
    _ = _generate_rpm(builder_parameters, centos_version)
コード例 #14
0
def test_generate_deb_from_git():
    builder_parameters = {
        "app": 'vdist-test-generate-deb-from-git',
        "version": '1.0',
        "source": git(uri='https://github.com/objectified/vdist',
                      branch='master'),
        "profile": 'ubuntu-trusty'
    }
    _ = _generate_deb(builder_parameters)
コード例 #15
0
ファイル: test_builder.py プロジェクト: dante-signal31/vdist
def generate_rpm_from_git(centos_version):
    builder_parameters = {"app": 'vdist-test-generate-rpm-from-git',
                          "version": '1.0',
                          "source": git(
                              uri='https://github.com/objectified/vdist',
                              branch='master'
                          ),
                          "profile": centos_version}
    _ = _generate_rpm(builder_parameters, centos_version)
コード例 #16
0
ファイル: test_builder.py プロジェクト: pingf/vdist
def test_generate_deb_from_git_setup_nocompile():
    with temporary_directory() as output_dir:
        builder_parameters = {
            "app":
            'geolocate',
            "version":
            '1.4.1',
            "source":
            git(uri='https://github.com/dante-signal31/geolocate',
                branch='vdist_tests'),
            "profile":
            'ubuntu-trusty',
            "compile_python":
            False,
            "python_version":
            '3.5.3',
            # Lets suppose custom python package is already installed and its root
            # folder is /usr. Actually I'm using default installed python3
            # package, it's is going to be a huge package but this way don't
            # need a private package repository.
            "python_basedir":
            '/usr',
            "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
        }
        target_file = _generate_deb(builder_parameters)
        file_list_purged = _get_purged_deb_file_list(target_file,
                                                     DEB_NOCOMPILE_FILTER)
        # At this point only a folder should remain if everything is correct.
        correct_install_path = "./usr"
        assert all((True if correct_install_path in file_entry else False
                    for file_entry in file_list_purged))
        # If python basedir was properly packaged then /usr/bin/python should be
        # there.
        python_interpreter = "./usr/bin/python2.7"
        assert python_interpreter in file_list_purged
        # If application was properly packaged then launcher should be in bin folder
        # too.
        geolocate_launcher = "./usr/local/bin/geolocate"
        assert geolocate_launcher in file_list_purged
コード例 #17
0
ファイル: test_builder.py プロジェクト: objectified/vdist
def test_generate_deb_from_git_setup_nocompile():
    builder_parameters = {
        "app":
        'geolocate',
        "version":
        '1.3.0',
        "source":
        git(uri='https://github.com/dante-signal31/geolocate',
            branch='master'),
        "profile":
        'ubuntu-trusty',
        "compile_python":
        False,
        "python_version":
        '3.4.4',
        # Lets suppose custom python package is already installed and its root
        # folder is /usr. Actually I'm using default installed python3
        # package, it's is going to be a huge package but this way don't
        # need a private package repository.
        "python_basedir":
        '/usr',
        "fpm_args":
        '--maintainer [email protected] -a native --url '
        'https://github.com/dante-signal31/geolocate --description '
        '"This program accepts any text and searchs inside'
        ' every IP '
        'address. With each of those IP addresses, '
        'geolocate queries '
        'Maxmind GeoIP database to look for the city and '
        'country where'
        ' IP address or URL is located. Geolocate is designed to be'
        ' used in console with pipes and redirections along with '
        'applications like traceroute, nslookup, etc.'
        ' " --license BSD-3 --category net',
        "requirements_path":
        '/REQUIREMENTS.txt',
        "runtime_deps": [
            "libssl1.0.0",
        ]
    }
    target_file = _generate_deb(builder_parameters)
    file_list_purged = _get_purged_deb_file_list(target_file,
                                                 DEB_NOCOMPILE_FILTER)
    # At this point only a folder should remain if everything is correct.
    correct_install_path = "./usr"
    assert all((True if correct_install_path in file_entry else False
                for file_entry in file_list_purged))
    # If python basedir was properly packaged then /usr/bin/python should be
    # there.
    python_interpreter = "./usr/bin/python2.7"
    assert python_interpreter in file_list_purged
    # If application was properly packaged then launcher should be in bin folder
    # too.
    geolocate_launcher = "./usr/bin/geolocate"
    assert geolocate_launcher in file_list_purged
コード例 #18
0
def test_build_projectroot_from_uri():
    build = Build(
        name='my build',
        app='myapp',
        version='1.0',
        source=git(
            uri='https://github.com/objectified/vdist',
            branch='release-1.0'
        ),
        profile='ubuntu-trusty'
    )
    assert build.get_project_root_from_source() == 'vdist'
コード例 #19
0
ファイル: test_builder.py プロジェクト: GetAttached/vdist
def test_generate_deb_from_git():
    with temporary_directory() as output_dir:
        builder_parameters = {"app": 'vdist-test-generate-deb-from-git',
                              "version": '1.0',
                              "source": git(
                                  uri='https://github.com/dante-signal31/vdist',
                                  branch='vdist_tests'
                              ),
                              "profile": 'ubuntu-trusty',
                              "output_folder": output_dir,
                              "output_script": True}
        _ = _generate_deb(builder_parameters)
コード例 #20
0
ファイル: test_builder.py プロジェクト: GetAttached/vdist
def _generate_rpm_from_git_suffixed(centos_version):
    with temporary_directory() as output_dir:
        builder_parameters = {"app": 'vdist-test-generate-deb-from-git-suffixed',
                              "version": '1.0',
                              "source": git(
                                uri='https://github.com/dante-signal31/vdist.git',
                                branch='vdist_tests'
                              ),
                              "profile": centos_version,
                              "output_folder": output_dir,
                              "output_script": True}
        _ = _generate_rpm(builder_parameters)
コード例 #21
0
 def _process_listable_arguments(self, arguments):
     argument_keys = set(arguments.keys())
     listable_arguments_found = LISTABLE_ARGUMENTS.intersection(
         argument_keys)
     for argument in listable_arguments_found:
         generated_list = _create_list(arguments[argument])
         if argument == "source_git":
             self.builder_parameters["source"] = source.git(
                 generated_list[0], generated_list[1])
         if argument == "source_git_directory":
             self.builder_parameters["source"] = source.git_directory(
                 generated_list[0], generated_list[1])
         if argument in ["runtime_deps", "build_deps"]:
             self.builder_parameters[argument] = generated_list
コード例 #22
0
def _generate_rpm_from_git_setup_nocompile(centos_version):
    builder_parameters = {
        "app":
        'geolocate',
        "version":
        '1.3.0',
        "source":
        git(uri='https://github.com/dante-signal31/geolocate',
            branch='master'),
        "profile":
        centos_version,
        "compile_python":
        False,
        "python_version":
        '3.4.4',
        # Lets suppose custom python package is already installed and its root
        # folder is /usr. Actually I'm using default installed python3
        # package, it's is going to be a huge package but this way don't
        # need a private package repository.
        "python_basedir":
        '/usr',
        "fpm_args":
        FPM_ARGS,
        "requirements_path":
        '/REQUIREMENTS.txt',
        "runtime_deps": [
            "libssl1.0.0",
        ],
        "after_install":
        'packaging/postinst.sh',
        "after_remove":
        'packaging/postuninst.sh'
    }
    target_file = _generate_rpm(builder_parameters, centos_version)
    file_list = _read_rpm_contents(target_file)
    # At this point only a folder should remain if everything is correct.
    correct_install_path = "/usr"
    assert all((True if correct_install_path in file_entry else False
                for file_entry in file_list))
    # If python basedir was properly packaged then /usr/bin/python should be
    # there.
    python_interpreter = "/usr/bin/python"
    assert python_interpreter in file_list
    # If application was properly packaged then launcher should be in bin folder
    # too.
    geolocate_launcher = "/usr/bin/geolocate"
    assert geolocate_launcher in file_list
コード例 #23
0
ファイル: test_builder.py プロジェクト: dante-signal31/vdist
def test_generate_deb_from_git_setup_nocompile():
    builder_parameters = {
        "app": 'geolocate',
        "version": '1.3.0',
        "source": git(
            uri='https://github.com/dante-signal31/geolocate',
            branch='master'
        ),
        "profile": 'ubuntu-trusty',
        "compile_python": False,
        "python_version": '3.4.4',
        # Lets suppose custom python package is already installed and its root
        # folder is /usr. Actually I'm using default installed python3
        # package, it's is going to be a huge package but this way don't
        # need a private package repository.
        "python_basedir": '/usr',
        "fpm_args": '--maintainer [email protected] -a native --url '
                    'https://github.com/dante-signal31/geolocate --description '
                    '"This program accepts any text and searchs inside'
                    ' every IP '
                    'address. With each of those IP addresses, '
                    'geolocate queries '
                    'Maxmind GeoIP database to look for the city and '
                    'country where'
                    ' IP address or URL is located. Geolocate is designed to be'
                    ' used in console with pipes and redirections along with '
                    'applications like traceroute, nslookup, etc.'
                    ' " --license BSD-3 --category net',
        "requirements_path": '/REQUIREMENTS.txt',
        "runtime_deps": ["libssl1.0.0", ]
    }
    target_file = _generate_deb(builder_parameters)
    file_list_purged = _get_purged_deb_file_list(target_file,
                                                 DEB_NOCOMPILE_FILTER)
    # At this point only a folder should remain if everything is correct.
    correct_install_path = "./usr"
    assert all((True if correct_install_path in file_entry else False
                for file_entry in file_list_purged))
    # If python basedir was properly packaged then /usr/bin/python should be
    # there.
    python_interpreter = "./usr/bin/python2.7"
    assert python_interpreter in file_list_purged
    # If application was properly packaged then launcher should be in bin folder
    # too.
    geolocate_launcher = "./usr/bin/geolocate"
    assert geolocate_launcher in file_list_purged
コード例 #24
0
ファイル: test_builder.py プロジェクト: objectified/vdist
def test_generate_deb_from_git_setup_compile():
    builder_parameters = {
        "app":
        'geolocate',
        "version":
        '1.3.0',
        "source":
        git(uri='https://github.com/dante-signal31/geolocate',
            branch='master'),
        "profile":
        'ubuntu-trusty',
        "compile_python":
        True,
        "python_version":
        '3.4.4',
        "fpm_args":
        '--maintainer [email protected] -a native --url '
        'https://github.com/dante-signal31/geolocate --description '
        '"This program accepts any text and searchs inside every IP'
        ' address. With each of those IP addresses, '
        'geolocate queries '
        'Maxmind GeoIP database to look for the city and '
        'country where'
        ' IP address or URL is located. Geolocate is designed to be'
        ' used in console with pipes and redirections along with '
        'applications like traceroute, nslookup, etc.'
        ' " --license BSD-3 --category net',
        "requirements_path":
        '/REQUIREMENTS.txt',
        "runtime_deps": [
            "libssl1.0.0",
        ]
    }
    target_file = _generate_deb(builder_parameters)
    file_list_purged = _get_purged_deb_file_list(target_file,
                                                 DEB_COMPILE_FILTER)
    # At this point only a folder should remain if everything is correct.
    correct_install_path = "./opt/geolocate"
    assert all((True if correct_install_path in file_entry else False
                for file_entry in file_list_purged))
    # Geolocate launcher should be in bin folder too.
    geolocate_launcher = "./opt/geolocate/bin/geolocate"
    assert geolocate_launcher in file_list_purged
コード例 #25
0
ファイル: test_builder.py プロジェクト: mjuenema/vdist
def test_generate_deb_from_git():
    builder = Builder()
    builder.add_build(
        app='vdist-test-generate-deb-from-git',
        version='1.0',
        source=git(
            uri='https://github.com/objectified/vdist',
            branch='master'
        ),
        profile='ubuntu-trusty'
    )
    builder.build()

    homedir = os.path.expanduser('~')
    target_file = os.path.join(
        homedir,
        '.vdist',
        'dist',
        'vdist-test-generate-deb-from-git-1.0-ubuntu-trusty',
        'vdist-test-generate-deb-from-git_1.0_amd64.deb'
    )
    assert os.path.isfile(target_file)
    assert os.path.getsize(target_file) > 0
コード例 #26
0
def test_generate_deb_from_git_setup_compile():
    builder_parameters = {
        "app":
        'geolocate',
        "version":
        '1.3.0',
        "source":
        git(uri='https://github.com/dante-signal31/geolocate',
            branch='master'),
        "profile":
        'ubuntu-trusty',
        "compile_python":
        True,
        "python_version":
        '3.4.4',
        "fpm_args":
        FPM_ARGS,
        "requirements_path":
        '/REQUIREMENTS.txt',
        "runtime_deps": [
            "libssl1.0.0",
        ],
        "after_install":
        'packaging/postinst.sh',
        "after_remove":
        'packaging/postuninst.sh'
    }
    target_file = _generate_deb(builder_parameters)
    file_list_purged = _get_purged_deb_file_list(target_file,
                                                 DEB_COMPILE_FILTER)
    # At this point only a folder should remain if everything is correct.
    correct_install_path = "./opt/geolocate"
    assert all((True if correct_install_path in file_entry else False
                for file_entry in file_list_purged))
    # Geolocate launcher should be in bin folder too.
    geolocate_launcher = "./opt/geolocate/bin/geolocate"
    assert geolocate_launcher in file_list_purged
コード例 #27
0
ファイル: test_builder.py プロジェクト: dante-signal31/vdist
def generate_rpm_from_git_nosetup_compile(centos_version):
    builder_parameters = {"app": 'jtrouble',
                          "version": '1.0.0',
                          "source": git(
                                uri='https://github.com/objectified/jtrouble',
                                branch='master'
                          ),
                          "profile": centos_version,
                          "package_install_root": "/opt",
                          "python_basedir": "/opt/python",
                          "compile_python": True,
                          "python_version": '3.4.4', }
    target_file = _generate_rpm(builder_parameters, centos_version)
    file_list = _read_rpm_contents(target_file)
    # At this point only two folders should remain if everything is correct:
    # application folder and compiled interpreter folder.
    correct_folders = ["/opt/jtrouble", "/opt/python"]
    assert all((True if any(folder in file_entry for folder in correct_folders)
                else False
                for file_entry in file_list))
    assert any(correct_folders[0] in file_entry
               for file_entry in file_list)
    assert any(correct_folders[1] in file_entry
               for file_entry in file_list)
コード例 #28
0
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]
コード例 #29
0
ファイル: package.py プロジェクト: xiyangliu/pydemo
from vdist.builder import Builder
from vdist.source import git

builder = Builder()

builder.add_build(
    app='pydemo',
    version='1.0',
    source=git(
        uri='https://github.com/xiyangliu/pydemo',
        branch='master'
    ),
    profile='ubuntu-trusty'
)

builder.build()
コード例 #30
0
"""
This example shows how you can use vdist to use a subdirectory
under your source tree to use as the base for your OS package
You will still be able to use git branching to point to the right
release, since vdist will first checkout the parent, and set apart
the subdirectory after switching to the right branch
"""
from vdist.builder import Builder
from vdist.source import git

builder = Builder()

builder.add_build(
    name="my great project",
    app="myproject",
    version="1.0",
    source=git(uri="https://github.com/someuser/someproject", branch="your-release-branch"),
    profile="ubuntu-trusty",
    # specify 'subapp' as the working directory for this build;
    # this means that only the subapp directory will be built and
    # packaged
    # This also means that vdist will look for a pip requirements
    # file in this directory
    working_dir="subapp",
)

builder.build()
コード例 #31
0
                'applications like traceroute, nslookup, etc."'
                ' --license BSD-3 --category net',
    "requirements_path": '/REQUIREMENTS.txt',
    "runtime_deps": ["libssl1.0.0", "dummy1.0.0"],
    "output_folder": DUMMY_OUTPUT_FOLDER,
    "after_install": 'packaging/postinst.sh',
    "after_remove": 'packaging/postuninst.sh',
    "output_script": False
}


CORRECT_UBUNTU_PARAMETERS = {
    "app": 'geolocate',
    "version": '1.3.0',
    "source": source.git(
        uri='https://github.com/dante-signal31/geolocate',
        branch='master'
    ),
    "profile": 'ubuntu-trusty',
    "compile_python": True,
    "python_version": '3.4.4',
    "fpm_args": '--maintainer [email protected] -a native --url '
                'https://github.com/dante-signal31/geolocate --description '
                '"This program accepts any text and searchs inside every IP'
                ' address. With each of those IP addresses, '
                'geolocate queries '
                'Maxmind GeoIP database to look for the city and '
                'country where'
                ' IP address or URL is located. Geolocate is designed to be'
                ' used in console with pipes and redirections along with '
                'applications like traceroute, nslookup, etc."'
                ' --license BSD-3 --category net',
コード例 #32
0
ファイル: test_sources.py プロジェクト: wheelpharaoh/vdist
def test_source_type_git():
    s = git(uri='https://github.com/objectified/vdist')
    assert s['uri'] == 'https://github.com/objectified/vdist'

    s = git(uri='https://github.com/objectified/vdist.git')
    assert s['uri'] == 'https://github.com/objectified/vdist'
コード例 #33
0
from vdist.builder import Builder
from vdist.source import git

builder = Builder()

# add CentOS6 build
builder.add_build(
    name="myproject centos6 build",
    app="myproject",
    version="1.0",
    source=git(uri="http://yourgithost.internal/yourcompany/yourproject", branch="master"),
    profile="centos6",
)

# add CentOS7 build
builder.add_build(
    name="myproject centos7 build",
    app="myproject",
    version="1.0",
    source=git(uri="http://yourgithost.internal/yourcompany/yourproject", branch="master"),
    profile="centos7",
)

# add Ubuntu Trusty build
builder.add_build(
    name="myproject ubuntu build",
    app="myproject",
    version="1.0",
    source=git(uri="http://yourgithost.internal/yourcompany/yourproject", branch="master"),
    profile="ubuntu-trusty",
)
コード例 #34
0
available as a custom OS package (something I'd highly
recommend for cross platform stability and packaging
speed)
"""
from vdist.builder import Builder
from vdist.source import git


builder = Builder()

builder.add_build(
    name='my great project',
    app='myproject',
    version='1.0',
    source=git(
        uri='https://github.com/someuser/someproject',
        branch='your-release-branch'
    ),
    profile='ubuntu-trusty',
    # tell vdist not to compile Python
    compile_python=False,
    # point to the basedir your custom Python is installed in
    # vdist will look for $basedir/bin/python
    python_basedir='/opt/mycompany/python',
    # provide your custom Python OS package as a build dependency
    build_deps=['mycompany-python'],
    # provide your custom Python OS package as a runtime dependency
    runtime_deps=['mycompany-python']
)

builder.build()
コード例 #35
0
ファイル: test_sources.py プロジェクト: mjuenema/vdist
def test_source_type_git():
    s = git(uri='https://github.com/objectified/vdist')
    assert s['uri'] == 'https://github.com/objectified/vdist'

    s = git(uri='https://github.com/objectified/vdist.git')
    assert s['uri'] == 'https://github.com/objectified/vdist'
コード例 #36
0
from vdist.builder import Builder
from vdist.source import git

builder = Builder()

# add CentOS6 build
builder.add_build(
    name='myproject centos6 build',
    app='myproject',
    version='1.0',
    source=git(
        uri='http://yourgithost.internal/yourcompany/yourproject',
        branch='master'
    ),
    profile='centos6'
)

# add CentOS7 build
builder.add_build(
    name='myproject centos7 build',
    app='myproject',
    version='1.0',
    source=git(
        uri='http://yourgithost.internal/yourcompany/yourproject',
        branch='master'
    ),
    profile='centos7'
)

# add Ubuntu Trusty build
builder.add_build(