def build_deb(build): """Build the .deb described by the given build description. :param build: Description of a debian build :type build: dict """ # Specialize a series of name templates for the given build odl_dir_name = odl_dir_template.substitute(build) odl_dir_path = os.path.join(templates_dir, os.pardir, odl_dir_name) odl_deb = odl_deb_template.substitute(build) # Call helper script to build the required debian files build_debfiles.build_debfiles(build) # Call a helper function to cache the artifacts required for each build odl_tarball_path = cache.cache_build(build) # Move ODL's tarball to the specialized OpenDaylight directory shutil.copy(odl_tarball_path, odl_dir_path) # Build debian package os.chdir(odl_dir_path) subprocess.call(["dpkg-buildpackage", "-us -uc -b", odl_dir_path], shell=True) # Install opendaylight's dependencies control_file_path = os.path.join(odl_dir_path, "debian/control") subprocess.call(["sudo mk-build-deps -i " + control_file_path], shell=True) os.chdir(project_root) # Copy the .debs from their output dir to the cache dir shutil.copy(odl_deb, cache_dir)
def build_deb(build): """Build the .deb described by the given build description. :param build: Description of a debian build, typically from build_vars.yaml :type build: dict """ # Specialize a series of name templates for the given build odl_dir_name = odl_dir_template.substitute(build) odl_dir_path = os.path.join(templates_dir, os.pardir, odl_dir_name) odl_deb = odl_deb_template.substitute(build) # Call helper script to build the required debian files build_debfiles.build_debfiles(build) # Call a helper function to cache the artifacts required for each build odl_tarball_path = cache.cache_build(build) # Move ODL's tarball to the specialized OpenDaylight directory shutil.copy(odl_tarball_path, odl_dir_path) # Build debian package os.chdir(odl_dir_path) subprocess.call(["dpkg-buildpackage", "-us -uc -b", odl_dir_path], shell=True) # Install opendaylight's dependencies control_file_path = os.path.join(odl_dir_path, "debian/control") subprocess.call(["sudo mk-build-deps -i " + control_file_path], shell=True) os.chdir(project_root) # Copy the .debs from their output dir to the cache dir shutil.copy(odl_deb, cache_dir)
def build_rpm(build): """Build the RPMs described by the given build description. :param build: Description of an RPM build, typically from build_vars.yaml :type build: dict """ # Specialize a series of name templates for the given build odl_tarball = odl_template.substitute(build) odl_rpm = rpm_template.substitute(build) odl_srpm = srpm_template.substitute(build) odl_specfile = specfile_template.substitute(build) unitfile_tarball = unitfile_tb_template.substitute(build) # After building strings from the name templates, build their full path odl_tarball_path = os.path.join(cache_dir, odl_tarball) unitfile_tarball_path = os.path.join(cache_dir, unitfile_tarball) specfile_path = os.path.join(specs_dir, odl_specfile) spec_in_path = os.path.join(spec_in_dir, odl_specfile) rpm_out_path = os.path.join(rpm_out_dir, odl_rpm) srpm_out_path = os.path.join(srpm_out_dir, odl_srpm) # Call a helper function to cache the artifacts required for each build cache.cache_build(build) # Call helper script to build the required RPM .spec files build_specs.build_spec(build) # Clean up old rpmbuild dir structure if it exists if os.path.isdir(rpmbuild_dir): shutil.rmtree(rpmbuild_dir) # Create rpmbuild dir structure subprocess.call("rpmdev-setuptree") # Move unitfile, tarball and specfile to correct rpmbuild dirs shutil.copy(odl_tarball_path, src_in_dir) shutil.copy(unitfile_tarball_path, src_in_dir) shutil.copy(specfile_path, spec_in_dir) # Call rpmbuild, build both SRPMs/RPMs subprocess.call(["rpmbuild", "-ba", spec_in_path]) # Copy the RPMs/SRPMs from their output dir to the cache dir shutil.copy(rpm_out_path, cache_dir) shutil.copy(srpm_out_path, cache_dir)