コード例 #1
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,
                           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))

        return True
コード例 #2
0
ファイル: source.py プロジェクト: echharp/cerbero
    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
コード例 #3
0
ファイル: source.py プロジェクト: deepak6/cerbero
    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:
                    return False
            except Exception:
                pass
            shutil.rmtree(self.build_dir)
        if not os.path.exists(self.build_dir):
            os.mkdir(self.build_dir)
        if self.supports_non_src_build:
            return

        # 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)
            shell.apply_patch(patch, self.build_dir, self.strip)

        return True
コード例 #4
0
ファイル: source.py プロジェクト: jpakkane/cerbero
    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
コード例 #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))
コード例 #6
0
ファイル: source.py プロジェクト: llenroc/cerbero
 def apply_patches(self):
     '''
     Applies patches contains in the self name variable.
     '''
     for patch in list(OrderedDict.fromkeys(self.patches)):
         if not os.path.isabs(patch):
             patch = self.relative_path(patch)
         shell.apply_patch(patch, self.build_dir, self.strip)
コード例 #7
0
ファイル: source.py プロジェクト: fluendo/cerbero
 def apply_patches(self):
     '''
     Applies patches contains in the self name variable.
     '''
     for patch in list(OrderedDict.fromkeys(self.patches)):
         if not os.path.isabs(patch):
             patch = self.relative_path(patch)
         shell.apply_patch(patch, self.build_dir, self.strip)
コード例 #8
0
ファイル: source.py プロジェクト: AlertMe/cerbero
    def extract(self):
        if os.path.exists(self.build_dir):
            shutil.rmtree(self.build_dir)

        shutil.copytree(self.repo_dir, self.build_dir)

        for patch in self.patches:
            if not os.path.isabs(patch):
                patch = self.relative_path(patch)
            shell.apply_patch(patch, self.build_dir, self.strip)
コード例 #9
0
    async def extract(self):
        if os.path.exists(self.build_dir):
            shutil.rmtree(self.build_dir)

        shutil.copytree(self.repo_dir, self.build_dir)

        for patch in self.patches:
            if not os.path.isabs(patch):
                patch = self.relative_path(patch)
            shell.apply_patch(patch, self.build_dir, self.strip, logfile=get_logfile(self))
コード例 #10
0
    def _apply_patches(self, patches_dir):
        if not os.path.isdir(patches_dir):
            # FIXME: Add logs
            return

        # list patches in this directory
        patches = [os.path.join(patches_dir, x) for x in
                   os.listdir(patches_dir) if x.endswith('.patch')]
        # apply patches
        for patch in patches:
            shell.apply_patch(self.build_dir, patch)
コード例 #11
0
ファイル: source.py プロジェクト: arturoc/ofxGStreamer
 def extract(self):
     m.action(_('Extracting tarball to %s') % self.build_dir)
     shell.unpack(self.download_path, self.config.sources)
     if self.tarball_dirname is not None:
         if os.path.exists(self.build_dir):
             shutil.rmtree(self.build_dir)
         os.rename(os.path.join(self.config.sources, self.tarball_dirname),
                 self.build_dir)
     for patch in self.patches:
         if not os.path.isabs(patch):
             patch = self.relative_path(patch)
         shell.apply_patch(patch, self.build_dir, self.strip)
コード例 #12
0
ファイル: source.py プロジェクト: deepak6/cerbero
 def extract(self):
     m.action(_('Extracting tarball to %s') % self.build_dir)
     shell.unpack(self.download_path, self.config.sources)
     if self.tarball_dirname is not None:
         if os.path.exists(self.build_dir):
             shutil.rmtree(self.build_dir)
         os.rename(os.path.join(self.config.sources, self.tarball_dirname),
                   self.build_dir)
     for patch in self.patches:
         if not os.path.isabs(patch):
             patch = self.relative_path(patch)
         shell.apply_patch(patch, self.build_dir, self.strip)
コード例 #13
0
ファイル: source.py プロジェクト: fedenunez/cerbero-rbeolibs
 def extract(self):
     m.action(_('Extracting tarball to %s') % self.build_dir)
     if os.path.exists(self.build_dir):
         shutil.rmtree(self.build_dir)
     super().extract(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)
コード例 #14
0
ファイル: source.py プロジェクト: abuecher/cerbero
 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)
コード例 #15
0
ファイル: source.py プロジェクト: centricular/cerbero
 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)