diff options
author | Jorge Olmos <jorge.olmos@flexvdi.com> | 2021-05-03 12:36:41 +0200 |
---|---|---|
committer | Jorge Olmos <jorge.olmos@flexvdi.com> | 2021-05-03 12:37:14 +0200 |
commit | 4e711eaecfd3b56951d068d7e3f052258dbdc2e3 (patch) | |
tree | ecc15b8f9944034d7bfa2e7272dc26e88916540c | |
parent | 7b8fa582aa2db7d17395b2d9deb02cf5f16ad78a (diff) |
source: fix Git extraction path for CMake recipes
When trying to build a recipe that uses both git and CMake, the following error message is shown:
CMake Error: The source directory "/home/jorge/cerbero/sources/android_universal/armv7/my-package-1.2" does not appear to contain CMakeLists.txt.
When using CMake:
self.build_dir == ARCH/PACKAGE-VERSION/_builddir (Path where Git extracts sources)
and
self.config_src_dir == ARCH/PACKAGE-VERSION (Path where Git should extract sources)
The problem is that Git class "extracts" sources to self.build_dir.
build_dir is the path to put binaries (as explained in the message of commit 2d520bfd)
Sources have to be extracted to self.config.sources:
- Tarball Class extracts the sources to self.config.sources.
- self.config.sources is also the path where patches are applied.
Part-of: <https://gitlab.freedesktop.org/gstreamer/cerbero/-/merge_requests/700>
-rw-r--r-- | cerbero/build/build.py | 2 | ||||
-rw-r--r-- | cerbero/build/source.py | 22 |
2 files changed, 13 insertions, 11 deletions
diff --git a/cerbero/build/build.py b/cerbero/build/build.py index 9434026b..c55e5e8f 100644 --- a/cerbero/build/build.py +++ b/cerbero/build/build.py @@ -690,6 +690,8 @@ class CMake (MakefilesBase): shutil.rmtree(cmake_files) self.make += ['VERBOSE=1'] await MakefilesBase.configure(self) + if not os.path.exists(self.build_dir): + os.makedirs(self.build_dir) # as build_dir is different from source dir, makefile location will be in build_dir. self.make_dir = self.build_dir diff --git a/cerbero/build/source.py b/cerbero/build/source.py index 930177c7..5f100024 100644 --- a/cerbero/build/source.py +++ b/cerbero/build/source.py @@ -271,7 +271,7 @@ class Tarball(BaseTarball, Source): await super().fetch(redownload=redownload) async def extract(self): - m.action(_('Extracting tarball to %s') % self.build_dir, logfile=get_logfile(self)) + m.action(_('Extracting tarball to %s') % self.config_src_dir, logfile=get_logfile(self)) if os.path.exists(self.build_dir): shutil.rmtree(self.build_dir) @@ -370,29 +370,29 @@ class Git (GitCache): self.commit = self.config.recipe_commit(self.name) or self.commit async def extract(self): - if os.path.exists(self.build_dir): + 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.build_dir, 'HEAD', 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.build_dir) - if not os.path.exists(self.build_dir): - os.makedirs(self.build_dir) + 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.build_dir, self.repo_dir, self.commit, logfile=get_logfile(self)) + 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.build_dir, logfile=get_logfile(self)) + git.apply_patch(patch, self.config_src_dir, logfile=get_logfile(self)) else: - shell.apply_patch(patch, self.build_dir, self.strip, logfile=get_logfile(self)) + shell.apply_patch(patch, self.config_src_dir, self.strip, logfile=get_logfile(self)) return True @@ -419,9 +419,9 @@ class GitExtractedTarball(Git): return False for match in self.matches: self._files[match] = [] - self._find_files(self.build_dir) + self._find_files(self.config_src_dir) self._files['.in'] = [x for x in self._files['.in'] if - os.path.join(self.build_dir, 'm4') not in x] + os.path.join(self.config_src_dir, 'm4') not in x] self._fix_ts() def _fix_ts(self): |