Пример #1
0
    def pkg_tarball(self, destdir=None):
        with fs.mkdtemp() as d:
            srcroot = join(d, self.pkgname)
            fs.sh_makedirs(srcroot)

            # Compilation
            etc_zarafa = fs.gluejoin(srcroot, self.conf_root)
            fs.sh_makedirs(etc_zarafa)
            self.compile_cfg_files(etc_zarafa)

            # Include source
            share = fs.gluejoin(srcroot, self.sitepkgs_root)

            self.include_python_packages(self.repo_basedir, share)

            self.patch_src(share)

            # Include dependencies
            self.include_deps(share)

            # Generate makefile
            self.compile_makefile(srcroot)

            destdir = destdir or d

            targz_fp = join(destdir, self.targz_name)
            with archive.tarfile(targz_fp, 'w:gz') as tar:
                tar.add(d, arcname='')

            return targz_fp
Пример #2
0
    def pkg_tarball(self, destdir=None):
        with fs.mkdtemp() as d:
            srcroot = join(d, self.pkgname)
            fs.sh_makedirs(srcroot)

            # Compilation
            etc_zarafa = fs.gluejoin(srcroot, self.conf_root)
            fs.sh_makedirs(etc_zarafa)
            self.compile_cfg_files(etc_zarafa)

            # Include source
            share = fs.gluejoin(srcroot, self.sitepkgs_root)

            self.include_python_packages(self.repo_basedir, share)

            self.patch_src(share)

            # Include dependencies
            self.include_deps(share)

            # Generate makefile
            self.compile_makefile(srcroot)

            destdir = destdir or d

            targz_fp = join(destdir, self.targz_name)
            with archive.tarfile(targz_fp, 'w:gz') as tar:
                tar.add(d, arcname='')

            return targz_fp
Пример #3
0
    def pkg_deb(self):
        with fs.mkdtemp() as d:
            self.do_pkg_deb(destdir=d)

            files = os.listdir(d)
            files = fnmatch.filter(files, '*.deb')
            shutil.copy(join(d, files[0]), self.product_dir)
Пример #4
0
    def pkg_rpm(self):
        with fs.mkdtemp() as d:
            self.do_pkg_rpm(destdir=d)

            rpmdir = join(d, 'rpmbuild', 'RPMS', self.rpmmeta_arch)
            files = os.listdir(rpmdir)
            files = fnmatch.filter(files, '*.rpm')
            shutil.copy(join(rpmdir, files[0]), self.product_dir)
Пример #5
0
    def include_deps(self, destdir=None):
        with fs.mkdtemp() as workon_tmp:
            with virtualenv.venv(workon_tmp, 'pkgtmp') as venv:
                venv.install_pkgs(self.python_rdeps)
                self.include_python_packages(venv.pkgs_location, destdir)

                # allow running more commands while we have the virtualenv
                self.include_deps_post_hook(destdir, venv)
Пример #6
0
    def pkg_tarball(self, destdir=None):
        with fs.mkdtemp() as d:
            srcroot = join(d, self.pkgname)
            fs.sh_makedirs(srcroot)

            # Compilation
            share_root = fs.gluejoin(srcroot, self.share_root)
            fs.sh_makedirs(share_root)
            self.compile_cfg_files(share_root)

            # Generate makefile
            self.compile_makefile(srcroot)

            destdir = destdir or d

            targz_fp = join(destdir, self.targz_name)
            with archive.tarfile(targz_fp, 'w:gz') as tar:
                tar.add(d, arcname='')

            return targz_fp
Пример #7
0
    def pkg_tarball(self, destdir=None):
        with fs.mkdtemp() as d:
            srcroot = join(d, self.pkgname)
            fs.sh_makedirs(srcroot)

            # Compilation
            share_root = fs.gluejoin(srcroot, self.share_root)
            fs.sh_makedirs(share_root)
            self.compile_cfg_files(share_root)

            # Generate makefile
            self.compile_makefile(srcroot)

            destdir = destdir or d

            targz_fp = join(destdir, self.targz_name)
            with archive.tarfile(targz_fp, 'w:gz') as tar:
                tar.add(d, arcname='')

            return targz_fp
Пример #8
0
def get_zarafa_schema():
    ldap_env = LdapEnv.get()

    with fs.mkdtemp() as d:
        shutil.copyfile(join(env.ldap_schema_dir, 'zarafa.schema'),
                        join(d, 'zarafa.schema'))

        context = {
            'include\s+zarafa\.schema':
            'include {0}'.format(join(d, 'zarafa.schema')),
            '__LDAP_ETC_PATH__':
            ldap_env.etc_path_orig,
        }
        conv_fp = join(d, 'schema_convert.conf')
        text.patch_file(context,
                        join(env.ldap_schema_dir, 'schema_convert.conf.in'),
                        dest=conv_fp,
                        literal=False)

        # debian6: fails to find slaptest without abs path
        env.run('/usr/sbin/slaptest -f {0} -F {1}'.format(conv_fp, d))

        ldif_file = join(d, 'cn=config', 'cn=schema', 'cn={4}zarafa.ldif')
        context = {
            '(?m)^structuralObjectClass: .*$': '',
            '(?m)^entryUUID: .*$': '',
            '(?m)^creatorsName: .*$': '',
            '(?m)^createTimestamp: .*$': '',
            '(?m)^entryCSN: .*$': '',
            '(?m)^modifiersName: .*$': '',
            '(?m)^modifyTimestamp: .*$': '',
            '(?m)^dn: .*': 'dn: {0}'.format(env.ldap_custom_schema_dn),
            '(?m)^cn: .*': 'cn: {0}'.format(env.ldap_custom_schema_cn),
        }
        text.patch_file(context, ldif_file, dest=ldif_file, literal=False)

        content = open(ldif_file, 'rt').read()
        return content.strip()
Пример #9
0
def get_zarafa_schema():
    ldap_env = LdapEnv.get()

    with fs.mkdtemp() as d:
        shutil.copyfile(
            join(env.ldap_schema_dir, 'zarafa.schema'),
            join(d, 'zarafa.schema'))

        context = {
            'include\s+zarafa\.schema': 'include {0}'.format(join(d, 'zarafa.schema')),
            '__LDAP_ETC_PATH__': ldap_env.etc_path_orig,
        }
        conv_fp = join(d, 'schema_convert.conf')
        text.patch_file(context,
                        join(env.ldap_schema_dir, 'schema_convert.conf.in'),
                        dest=conv_fp, literal=False)

        # debian6: fails to find slaptest without abs path
        env.run('/usr/sbin/slaptest -f {0} -F {1}'.format(conv_fp, d))

        ldif_file = join(d, 'cn=config', 'cn=schema', 'cn={4}zarafa.ldif')
        context = {
            '(?m)^structuralObjectClass: .*$': '',
            '(?m)^entryUUID: .*$': '',
            '(?m)^creatorsName: .*$': '',
            '(?m)^createTimestamp: .*$': '',
            '(?m)^entryCSN: .*$': '',
            '(?m)^modifiersName: .*$': '',
            '(?m)^modifyTimestamp: .*$': '',
            '(?m)^dn: .*': 'dn: {0}'.format(env.ldap_custom_schema_dn),
            '(?m)^cn: .*': 'cn: {0}'.format(env.ldap_custom_schema_cn),
        }
        text.patch_file(context, ldif_file, dest=ldif_file, literal=False)

        content = open(ldif_file, 'rt').read()
        return content.strip()