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
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
def compile_makefile(self, srcroot): tmpl = self.tmpl_env.get_template('packaging/Makefile.in') stmts = [] for r, dirs, files in os.walk(srcroot): relroot = re.sub(re.escape(srcroot), '', r) relroot = '/' if relroot == '' else relroot if relroot != '/': stm = 'mkdir -p ${DESTDIR}%s' % relroot stmts.append(stm) for f in files: fsrc = fs.gluejoin(srcroot, relroot, f) f = fs.gluejoin(relroot, f) mode = 755 if os.access(fsrc, os.X_OK) else 644 stm = 'install -m%s %s ${DESTDIR}%s' % (mode, f[1:], f) stmts.append(stm) stmts = self.compile_makefile_extra_stmts(stmts) stmts = '\n'.join(['\t' + stm for stm in stmts]) + '\n' content = tmpl.render( statements=stmts, ) fp = join(srcroot, 'Makefile') open(fp, 'wt').write(content)
def patch_src(self, destdir): paths = [ self.sitepkgs_root, join(self.sitepkgs_root, 'cmdline'), ] context = { '(?m)(EXTRA_PATHS\s*=\s*).*$': '\g<1>{0}'.format(repr(paths)), } fp = fs.gluejoin(destdir, 'cmdline', 'zsm-client.py') text.patch_file(context, fp, dest=fp, literal=False) fp = fs.gluejoin(destdir, 'cmdline', 'cli') text.patch_file(context, fp, dest=fp, literal=False)
def patch_src(self, destdir): paths = [ self.sitepkgs_root, join(self.sitepkgs_root, 'cmdline'), ] context = { '(?m)(EXTRA_PATHS\s*=\s*).*$': '\g<1>{0}'.format(repr(paths)), } fp = fs.gluejoin(destdir, 'cmdline', 'zsm-client.py') text.patch_file(context, fp, dest=fp, literal=False) fp = fs.gluejoin(destdir, 'cmdline', 'cli') text.patch_file(context, fp, dest=fp, literal=False)
def patch_src(self, destdir): paths = [ self.sitepkgs_root, ] context = { '(?m)(EXTRA_PATHS\s*=\s*).*$': '\g<1>{0}'.format(repr(paths)), } fp = fs.gluejoin(destdir, 'deploy.py') text.patch_file(context, fp, dest=fp, literal=False) context.update({ '(?m)(PERFORM_RELOAD\s*=\s*).*$': '\g<1>False', '(?m)(SETTINGS_MODULE\s*=\s*).*$': '\g<1>{0}'.format(repr('zsm.settings')), }) fp = fs.gluejoin(destdir, 'webservice', 'manage.py') text.patch_file(context, fp, dest=fp, literal=False)
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
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