Exemplo n.º 1
0
    def extract(self):
        if os.path.exists(self.build_dir):
            # fix read-only permissions
            if self.config.platform == Platform.WINDOWS:
                shell.call('chmod -R +w .git/', self.build_dir, fail=False)
            try:
                commit_hash = git.get_hash(self.repo_dir, self.commit)
                checkout_hash = git.get_hash(self.build_dir, 'HEAD')
                if commit_hash == checkout_hash and not self.patches:
                    return False
            except Exception:
                pass
            shutil.rmtree(self.build_dir)
        if not os.path.exists(self.build_dir):
            os.mkdir(self.build_dir)

        # checkout the current version
        git.local_checkout(self.build_dir, self.repo_dir, self.commit)

        for patch in self.patches:
            if not os.path.isabs(patch):
                patch = self.relative_path(patch)

            if self.strip == 1:
                git.apply_patch(patch, self.build_dir)
            else:
                shell.apply_patch(patch, self.build_dir, self.strip)

        return True
Exemplo n.º 2
0
    async def extract(self):
        if os.path.exists(self.config_src_dir):
            try:
                commit_hash = git.get_hash(self.repo_dir, self.commit, logfile=get_logfile(self))
                checkout_hash = git.get_hash(self.config_src_dir, 'HEAD', logfile=get_logfile(self))
                if commit_hash == checkout_hash and not self.patches:
                    return False
            except Exception:
                pass
            shutil.rmtree(self.config_src_dir)
        if not os.path.exists(self.config_src_dir):
            os.makedirs(self.config_src_dir)

        # checkout the current version
        await git.local_checkout(self.config_src_dir, self.repo_dir, self.commit, logfile=get_logfile(self))

        for patch in self.patches:
            if not os.path.isabs(patch):
                patch = self.relative_path(patch)

            if self.strip == 1:
                git.apply_patch(patch, self.config_src_dir, logfile=get_logfile(self))
            else:
                shell.apply_patch(patch, self.config_src_dir, self.strip, logfile=get_logfile(self))

        return True
Exemplo n.º 3
0
    def extract(self):
        if os.path.exists(self.build_dir):
            try:
                commit_hash = git.get_hash(self.repo_dir, self.commit)
                checkout_hash = git.get_hash(self.build_dir, 'HEAD')
                if commit_hash == checkout_hash and not self.patches:
                    return False
            except Exception:
                pass
            shutil.rmtree(self.build_dir)
        if not os.path.exists(self.build_dir):
            os.mkdir(self.build_dir)

        # checkout the current version
        git.local_checkout(self.build_dir, self.repo_dir, self.commit)

        for patch in self.patches:
            if not os.path.isabs(patch):
                patch = self.relative_path(patch)

            if self.strip == 1:
                git.apply_patch(patch, self.build_dir)
            else:
                shell.apply_patch(patch, self.build_dir, self.strip)

        return True
Exemplo n.º 4
0
    def extract(self):
        if os.path.exists(self.build_dir):
            try:
                commit_hash = git.get_hash(self.repo_dir, self.commit)
                checkout_hash = git.get_hash(self.build_dir, 'HEAD')
                if commit_hash == checkout_hash and not self.patches:
                    return False
            except Exception:
                pass
            shutil.rmtree(self.build_dir)
        if not os.path.exists(self.build_dir):
            os.mkdir(self.build_dir)

        # checkout the current version
        git.local_checkout(self.build_dir, self.repo_dir, self.commit)

        for patch in self.patches:
            if not os.path.isabs(patch):
                patch = self.relative_path(patch)

            if self.strip == 1:
                git.apply_patch(patch, self.build_dir)
            else:
                shell.apply_patch(patch, self.build_dir, self.strip)

        return True
Exemplo n.º 5
0
    async def extract(self):
        m.action(_('Extracting tarball to %s') % self.build_dir,
                 logfile=get_logfile(self))
        if os.path.exists(self.build_dir):
            shutil.rmtree(self.build_dir)

        unpack_dir = self.config.sources
        if self.tarball_is_bomb:
            unpack_dir = self.build_dir
        await self.extract_tarball(unpack_dir)

        if self.tarball_dirname is not None:
            extracted = os.path.join(unpack_dir, self.tarball_dirname)
            # Since we just extracted this, a Windows anti-virus might still
            # have a lock on files inside it.
            shell.windows_proof_rename(extracted, self.build_dir)

        git.init_directory(self.build_dir, logfile=get_logfile(self))
        for patch in self.patches:
            if not os.path.isabs(patch):
                patch = self.relative_path(patch)
            if self.strip == 1:
                git.apply_patch(patch,
                                self.build_dir,
                                logfile=get_logfile(self))
            else:
                shell.apply_patch(patch,
                                  self.build_dir,
                                  self.strip,
                                  logfile=get_logfile(self))
Exemplo n.º 6
0
 def extract(self):
     m.action(_('Extracting tarball to %s') % self.build_dir)
     if os.path.exists(self.build_dir):
         shutil.rmtree(self.build_dir)
     shell.unpack(self.download_path, self.config.sources)
     if self.tarball_dirname is not None:
         os.rename(os.path.join(self.config.sources, self.tarball_dirname),
                 self.build_dir)
     git.init_directory(self.build_dir)
     for patch in self.patches:
         if not os.path.isabs(patch):
             patch = self.relative_path(patch)
         if self.strip == 1:
             git.apply_patch(patch, self.build_dir)
         else:
             shell.apply_patch(patch, self.build_dir, self.strip)
Exemplo n.º 7
0
 def extract(self):
     m.action(_('Extracting tarball to %s') % self.build_dir)
     if os.path.exists(self.build_dir):
         shutil.rmtree(self.build_dir)
     try:
         shell.unpack(self.download_path, self.config.sources)
     except (IOError, EOFError, tarfile.ReadError):
         m.action(_('Corrupted or partial tarball, redownloading...'))
         self.fetch(redownload=True)
         shell.unpack(self.download_path, self.config.sources)
     if self.tarball_dirname is not None:
         os.rename(os.path.join(self.config.sources, self.tarball_dirname),
                   self.build_dir)
     git.init_directory(self.build_dir)
     for patch in self.patches:
         if not os.path.isabs(patch):
             patch = self.relative_path(patch)
         if self.strip == 1:
             git.apply_patch(patch, self.build_dir)
         else:
             shell.apply_patch(patch, self.build_dir, self.strip)
Exemplo n.º 8
0
 def extract(self):
     m.action(_('Extracting tarball to %s') % self.build_dir)
     if os.path.exists(self.build_dir):
         shutil.rmtree(self.build_dir)
     try:
         shell.unpack(self.download_path, self.config.sources)
     except (IOError, EOFError, tarfile.ReadError):
         m.action(_('Corrupted or partial tarball, redownloading...'))
         self.fetch(redownload=True)
         shell.unpack(self.download_path, self.config.sources)
     if self.tarball_dirname is not None:
         os.rename(os.path.join(self.config.sources, self.tarball_dirname),
                 self.build_dir)
     git.init_directory(self.build_dir)
     for patch in self.patches:
         if not os.path.isabs(patch):
             patch = self.relative_path(patch)
         if self.strip == 1:
             git.apply_patch(patch, self.build_dir)
         else:
             shell.apply_patch(patch, self.build_dir, self.strip)