示例#1
0
    def run(self, unpack_src=False):
        """Common operations for extensions: unpacking sources, patching, ..."""

        # unpack file if desired
        if unpack_src:
            targetdir = os.path.join(self.master.builddir, remove_unwanted_chars(self.name))
            self.ext_dir = extract_file("%s" % self.src, targetdir, extra_options=self.unpack_options)

        # patch if needed
        if self.patches:
            for patchfile in self.patches:
                if not apply_patch(patchfile, self.ext_dir):
                    raise EasyBuildError("Applying patch %s failed", patchfile)
    def run(self, unpack_src=False):
        """Common operations for extensions: unpacking sources, patching, ..."""

        # unpack file if desired
        if unpack_src:
            targetdir = os.path.join(self.master.builddir, remove_unwanted_chars(self.name))
            self.ext_dir = extract_file("%s" % self.src, targetdir, extra_options=self.unpack_options)

        # patch if needed
        if self.patches:
            for patchfile in self.patches:
                if not apply_patch(patchfile, self.ext_dir):
                    self.log.error("Applying patch %s failed" % patchfile)
示例#3
0
    def test_apply_patch(self):
        """ Test apply_patch """
        testdir = os.path.dirname(os.path.abspath(__file__))
        tmpdir = self.test_prefix
        path = ft.extract_file(os.path.join(testdir, 'sandbox', 'sources', 'toy', 'toy-0.0.tar.gz'), tmpdir)
        toy_patch = os.path.join(testdir, 'sandbox', 'sources', 'toy', 'toy-0.0_typo.patch')

        self.assertTrue(ft.apply_patch(toy_patch, path))
        patched = ft.read_file(os.path.join(path, 'toy-0.0', 'toy.source'))
        pattern = "I'm a toy, and very proud of it"
        self.assertTrue(pattern in patched)

        # trying the patch again should fail
        self.assertErrorRegex(EasyBuildError, "Couldn't apply patch file", ft.apply_patch, toy_patch, path)
    def test_apply_patch(self):
        """ Test apply_patch """
        testdir = os.path.dirname(os.path.abspath(__file__))
        tmpdir = self.test_prefix
        path = ft.extract_file(
            os.path.join(testdir, 'sandbox', 'sources', 'toy',
                         'toy-0.0.tar.gz'), tmpdir)
        toy_patch = os.path.join(testdir, 'sandbox', 'sources', 'toy',
                                 'toy-0.0_typo.patch')

        self.assertTrue(ft.apply_patch(toy_patch, path))
        patched = ft.read_file(os.path.join(path, 'toy-0.0', 'toy.source'))
        pattern = "I'm a toy, and very proud of it"
        self.assertTrue(pattern in patched)

        # trying the patch again should fail
        self.assertErrorRegex(EasyBuildError, "Couldn't apply patch file",
                              ft.apply_patch, toy_patch, path)
示例#5
0
    def configure_step(self):
        """Apply coreutils patch from source and run configure"""
        # 1.822.3 -> 8.22
        coreutils_version = re.sub(r"^\d+.(\d+)(\d\d).\d+", r"\1.\2", self.version)
        coreutils_patch = "coreutils-%s.patch" % coreutils_version
        patch_path = os.path.join(self.builddir, "%s-%s" % (self.name, self.version), "patch", coreutils_patch)
        if os.path.isfile(patch_path):
            self.log.info("coreutils patch found at %s", patch_path)
        else:
            raise EasyBuildError("Could not find the patch for coreutils: %s", coreutils_patch)

        coreutils_path = glob.glob(os.path.join(self.builddir, "coreutils-*"))
        if not coreutils_path:
            raise EasyBuildError("Could not find the coreutils directory")

        if not apply_patch(patch_path, coreutils_path[0]):
            raise EasyBuildError("Applying coreutils patch %s failed", coreutils_patch)

        super(EB_mutil, self).configure_step()
示例#6
0
    def configure_step(self):
        """Apply coreutils patch from source and run configure"""
        # 1.822.3 -> 8.22
        coreutils_version = re.sub(r"^\d+.(\d+)(\d\d).\d+", r"\1.\2", self.version)
        coreutils_patch = "coreutils-%s.patch" % coreutils_version
        patch_path = os.path.join(self.builddir, "%s-%s" % (self.name, self.version), "patch", coreutils_patch)
        if os.path.isfile(patch_path):
            self.log.info("coreutils patch found at %s", patch_path)
        else:
            raise EasyBuildError("Could not find the patch for coreutils: %s", coreutils_patch)

        coreutils_path = glob.glob(os.path.join(self.builddir, "coreutils-*"))
        if not coreutils_path:
            raise EasyBuildError("Could not find the coreutils directory")

        if not apply_patch(patch_path, coreutils_path[0]):
            raise EasyBuildError("Applying coreutils patch %s failed", coreutils_patch)

        super(EB_mutil, self).configure_step()
示例#7
0
    def run(self):
        """Perform the actual Python package build/installation procedure"""

        # extract_file
        if not self.src:
            self.log.error("No source found for Python package %s, required for installation. (src: %s)" % \
                           (self.name, self.src))
        self.ext_dir = extract_file("%s" % self.src, "%s/%s" % (self.builddir, self.name), extra_options=self.unpack_options)

        # patch if needed
        if self.patches:
            for patchfile in self.patches:
                if not apply_patch(patchfile, self.ext_dir):
                    self.log.error("Applying patch %s failed" % patchfile)

        # configure, build_step, test, make install
        self.configure_step()
        self.build_step()
        self.test_step()
        self.install_step()