Ejemplo n.º 1
0
    def configure_step(self):
        """Dedicated configure step for Mono: install Mono from RPM (if provided), then run configure."""

        # install Mono from RPMs if provided (because we need Mono to build Mono)
        if self.rpms:

            # prepare path for installing RPMs in
            monorpms_path = os.path.join(self.builddir, "monorpms")
            try:
                os.makedirs(os.path.join(monorpms_path, 'rpm'))
            except OSError as err:
                raise EasyBuildError("Failed to create directories for installing Mono RPMs in: %s", err)

            self.src = self.rpms
            self.rebuildRPM = True

            # rebuild RPMs to make them relocatable
            Rpm.configure_step(self)

            # prepare to install RPMs
            self.log.debug("Initializing temporary RPM repository to install to...")
            cmd = "rpm --initdb --dbpath /rpm --root %s" % monorpms_path
            run_cmd(cmd, log_all=True, simple=True)

            # install RPMs one by one
            for rpm in self.src:
                self.log.debug("Installing RPM %s ..." % rpm['name'])
                if os.path.exists(rpm['path']):
                    cmd = ' '.join([
                        "rpm -i",
                        "--dbpath %(inst)s/rpm",
                        "--force",
                        "--relocate /=%(inst)s",
                        "--badreloc",
                        "--nodeps --nopost",
                        "%(rpm)s",
                    ]) % {
                        'inst': monorpms_path,
                        'rpm': rpm['path'],
                    }
                    run_cmd(cmd,log_all=True,simple=True)
                else:
                    raise EasyBuildError("RPM file %s not found", rpm['path'])

            # create patched version of gmcs command
            self.log.debug("Making our own copy of gmcs (one that works).")

            mygmcs_path = os.path.join(monorpms_path, 'usr', 'bin', 'mygmcs')
            try:
                shutil.copy(os.path.join(monorpms_path, 'usr' ,'bin', 'gmcs'), mygmcs_path)
            except OSError as err:
                raise EasyBuildError("Failed to copy gmcs to %s: %s", mygmcs_path, err)

            rpls = [
                ("exec /usr/bin/mono", "exec %s/usr/bin/mono" % monorpms_path),
                ("`/usr/bin/monodir`", "%s/usr/lib64/mono" % monorpms_path),
            ]
            apply_regex_substitutions(mygmcs_path, rpls)

            self.log.debug("Patched version of gmcs (%s): %s" % (mygmcs_path, read_file(mygmcs_path)))

            # initiate bootstrap: build/install Mono with installed RPMs to temporary path
            tmp_mono_path = os.path.join(self.builddir, "tmp_mono")
            self.log.debug("Build/install temporary Mono version in %s using installed RPMs..." % tmp_mono_path)

            par = ''
            if self.cfg['parallel']:
                par = "-j %s" % self.cfg['parallel']

            config_cmd = "%s ./configure --prefix=%s %s" % (self.cfg['preconfigopts'], tmp_mono_path, self.cfg['configopts'])
            build_cmd = ' '.join([
                "%(prebuildopts)s"
                "make %(par)s",
                "EXTERNAL_MCS=%(path)s/usr/bin/mygmcs",
                "EXTERNAL_RUNTIME=%(path)s/usr/bin/mono",
                "%(buildopts)s",
            ]) %{
                'prebuildopts': self.cfg['prebuildopts'],
                'par': par,
                'path': monorpms_path,
                'buildopts': self.cfg['buildopts'],
            }
            install_cmd = "make install"

            for cmd in [config_cmd, build_cmd, install_cmd]:
                run_cmd(cmd, log_all=True, simple=True)

            more_buildopts = ' '.join([
                "EXTERNAL_MCS=%(path)s/bin/gmcs",
                "EXTERNAL_RUNTIME=%(path)s/bin/mono",
            ]) % {'path': tmp_mono_path}
            self.cfg.update('buildopts', more_buildopts)

            self.src = self.mono_srcs

        # continue with normal configure, and subsequent make, make install
        ConfigureMake.configure_step(self)
Ejemplo n.º 2
0
    def configure_step(self):
        """Dedicated configure step for Mono: install Mono from RPM (if provided), then run configure."""

        # install Mono from RPMs if provided (because we need Mono to build Mono)
        if self.rpms:

            # prepare path for installing RPMs in
            monorpms_path = os.path.join(self.builddir, "monorpms")
            try:
                os.makedirs(os.path.join(monorpms_path, 'rpm'))
            except OSError as err:
                raise EasyBuildError(
                    "Failed to create directories for installing Mono RPMs in: %s",
                    err)

            self.src = self.rpms
            self.rebuildRPM = True

            # rebuild RPMs to make them relocatable
            Rpm.configure_step(self)

            # prepare to install RPMs
            self.log.debug(
                "Initializing temporary RPM repository to install to...")
            cmd = "rpm --initdb --dbpath /rpm --root %s" % monorpms_path
            run_cmd(cmd, log_all=True, simple=True)

            # install RPMs one by one
            for rpm in self.src:
                self.log.debug("Installing RPM %s ..." % rpm['name'])
                if os.path.exists(rpm['path']):
                    cmd = ' '.join([
                        "rpm -i",
                        "--dbpath %(inst)s/rpm",
                        "--force",
                        "--relocate /=%(inst)s",
                        "--badreloc",
                        "--nodeps --nopost",
                        "%(rpm)s",
                    ]) % {
                        'inst': monorpms_path,
                        'rpm': rpm['path'],
                    }
                    run_cmd(cmd, log_all=True, simple=True)
                else:
                    raise EasyBuildError("RPM file %s not found", rpm['path'])

            # create patched version of gmcs command
            self.log.debug("Making our own copy of gmcs (one that works).")

            mygmcs_path = os.path.join(monorpms_path, 'usr', 'bin', 'mygmcs')
            try:
                shutil.copy(os.path.join(monorpms_path, 'usr', 'bin', 'gmcs'),
                            mygmcs_path)
            except OSError as err:
                raise EasyBuildError("Failed to copy gmcs to %s: %s",
                                     mygmcs_path, err)

            rpls = [
                ("exec /usr/bin/mono", "exec %s/usr/bin/mono" % monorpms_path),
                ("`/usr/bin/monodir`", "%s/usr/lib64/mono" % monorpms_path),
            ]
            apply_regex_substitutions(mygmcs_path, rpls)

            self.log.debug("Patched version of gmcs (%s): %s" %
                           (mygmcs_path, read_file(mygmcs_path)))

            # initiate bootstrap: build/install Mono with installed RPMs to temporary path
            tmp_mono_path = os.path.join(self.builddir, "tmp_mono")
            self.log.debug(
                "Build/install temporary Mono version in %s using installed RPMs..."
                % tmp_mono_path)

            par = ''
            if self.cfg['parallel']:
                par = "-j %s" % self.cfg['parallel']

            config_cmd = "%s ./configure --prefix=%s %s" % (
                self.cfg['preconfigopts'], tmp_mono_path,
                self.cfg['configopts'])
            build_cmd = ' '.join([
                "%(prebuildopts)s"
                "make %(par)s",
                "EXTERNAL_MCS=%(path)s/usr/bin/mygmcs",
                "EXTERNAL_RUNTIME=%(path)s/usr/bin/mono",
                "%(buildopts)s",
            ]) % {
                'prebuildopts': self.cfg['prebuildopts'],
                'par': par,
                'path': monorpms_path,
                'buildopts': self.cfg['buildopts'],
            }
            install_cmd = "make install"

            for cmd in [config_cmd, build_cmd, install_cmd]:
                run_cmd(cmd, log_all=True, simple=True)

            more_buildopts = ' '.join([
                "EXTERNAL_MCS=%(path)s/bin/gmcs",
                "EXTERNAL_RUNTIME=%(path)s/bin/mono",
            ]) % {
                'path': tmp_mono_path
            }
            self.cfg.update('buildopts', more_buildopts)

            self.src = self.mono_srcs

        # continue with normal configure, and subsequent make, make install
        ConfigureMake.configure_step(self)
Ejemplo n.º 3
0
 def extra_options(extra_vars=None):
     """Combine custom easyconfig parameters specific to ConfigureMake and Rpm generic easyblocks."""
     extra_vars = ConfigureMake.extra_options()
     return Rpm.extra_options(extra_vars=extra_vars)
Ejemplo n.º 4
0
 def extra_options(extra_vars=None):
     """Combine custom easyconfig parameters specific to ConfigureMake and Rpm generic easyblocks."""
     extra_vars = ConfigureMake.extra_options()
     return Rpm.extra_options(extra_vars=extra_vars)