Commit 0d657a85 authored by Nirbheek Chauhan's avatar Nirbheek Chauhan 🐜

cerbero: Fix offline builds for subversion recipes

We weren't using the existing local sources at all when using
subversion; instead we were always deleting it and fetching
it from scratch.
parent 12b93e72
...@@ -465,21 +465,27 @@ class Svn(Source): ...@@ -465,21 +465,27 @@ class Svn(Source):
self.revision = self.config.recipe_commit( or self.revision self.revision = self.config.recipe_commit( or self.revision
def fetch(self): def fetch(self):
if os.path.exists(self.repo_dir):
cached_dir = os.path.join(self.config.cached_sources, self.package_name) cached_dir = os.path.join(self.config.cached_sources, self.package_name)
if os.path.isdir(os.path.join(cached_dir, ".svn")): if os.path.isdir(os.path.join(cached_dir, ".svn")):
if os.path.exists(self.repo_dir):
m.action(_('Copying cached repo from %s to %s instead of %s') % m.action(_('Copying cached repo from %s to %s instead of %s') %
(cached_dir, self.repo_dir, self.url)) (cached_dir, self.repo_dir, self.url))
shell.copy_dir(cached_dir, self.repo_dir) shell.copy_dir(cached_dir, self.repo_dir)
return return
os.makedirs(self.repo_dir) checkout = True
if self.offline: if os.path.exists(self.repo_dir):
raise FatalError('Offline mode: no cached svn repos found for {} at {!r}' if os.path.isdir(os.path.join(self.repo_dir, '.svn')):
''.format(self.package_name, self.config.cached_sources)) if self.offline:
svn.checkout(self.url, self.repo_dir) return
checkout = False
if checkout:
os.makedirs(self.repo_dir, exist_ok=True)
svn.checkout(self.url, self.repo_dir)
svn.update(self.repo_dir, self.revision) svn.update(self.repo_dir, self.revision)
def extract(self): def extract(self):
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment