def build_package(version): """ Build package out of a puppet module. """ args, extra_args = parse_version_extra_args(version.extra_args) install_dir = tempfile.mkdtemp() pwd = getcwd() try: # install the module cmd = ['puppet', 'module', 'install', args.modulename, '--target-dir=%s' % install_dir, '--version=%s' % version] subprocess.check_call(cmd) # build the package modulename = version.userdata['name'] moduledir = join(install_dir, modulename) chdir(moduledir) create_package("puppet-%s" % modulename, modulename, str(version), extra_args) for deb in glob.glob("*.deb"): shutil.move(join(moduledir, deb), "%s/" % pwd) finally: chdir(pwd) shutil.rmtree(install_dir)
def build_package(version): """ Build package out of a puppet module. """ args, extra_args = parse_version_extra_args(version.extra_args) install_dir = tempfile.mkdtemp() pwd = getcwd() try: # install the module cmd = [ 'puppet', 'module', 'install', args.modulename, '--target-dir=%s' % install_dir, '--version=%s' % version ] subprocess.check_call(cmd) # build the package modulename = version.userdata['name'] moduledir = join(install_dir, modulename) chdir(moduledir) create_package("puppet-%s" % modulename, modulename, str(version), extra_args) for deb in glob.glob("*.deb"): shutil.move(join(moduledir, deb), "%s/" % pwd) finally: chdir(pwd) shutil.rmtree(install_dir)
def build_package(version): """ Build package out of a puppet module. """ log.debug("Building puppet module version {0} with fpm.".format(version)) with version.checkout_tag: full_name = basename(getcwd()) short_name = full_name.replace('puppet-', '') create_package(full_name, short_name, str(version), version.extra_args)