Skip to content

Commit

Permalink
yocto_recipe.py: don't create cache.yaml and cache.diffme
Browse files Browse the repository at this point in the history
* ros-generate-cache.sh already does that and superflore then just
  generates recipes from cache.yaml file updated by
  ros-generate-cache.sh
* fixes: ros-infrastructure#252
* needs: ros/meta-ros#643

Signed-off-by: Martin Jansa <[email protected]>
  • Loading branch information
shr-project committed Nov 20, 2019
1 parent b1ed35b commit 52bfc29
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 52 deletions.
2 changes: 0 additions & 2 deletions superflore/generators/bitbake/ros_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ def commit_changes(self, distro, commit_msg):
info('Adding changes...')
self.repo.git.add('generated-recipes-{0}'.format(distro))
self.repo.git.add('conf/ros-distro/include/{0}/*.inc'.format(distro))
self.repo.git.add('files/{0}/cache.*'.format(distro))
self.repo.git.add('files/{0}/rosdep-resolve.yaml'.format(distro))
self.repo.git.add(
'files/{0}/newer-platform-components.list'.format(distro))
Expand All @@ -63,7 +62,6 @@ def get_change_summary(self):
return '\n'.join([
sep, self.repo.git.status('--porcelain'), sep,
self.repo.git.diff('conf'), sep, self.repo.git.diff(
'files/*/cache.diffme',
'files/*/newer-platform-components.list',
'files/*/rosdep-resolve.yaml'
),
Expand Down
2 changes: 0 additions & 2 deletions superflore/generators/bitbake/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ def main():
distro.release_platforms, skip_keys)
yoctoRecipe.generate_superflore_datetime_inc(
_repo, args.ros_distro, now)
yoctoRecipe.generate_distro_cache(_repo, args.ros_distro)
yoctoRecipe.generate_rosdep_resolve(_repo, args.ros_distro)
yoctoRecipe.generate_newer_platform_components(
_repo, args.ros_distro)
Expand Down Expand Up @@ -196,7 +195,6 @@ def main():
distro.release_platforms, skip_keys)
yoctoRecipe.generate_superflore_datetime_inc(
_repo, args.ros_distro, now)
yoctoRecipe.generate_distro_cache(_repo, args.ros_distro)
yoctoRecipe.generate_rosdep_resolve(_repo, args.ros_distro)
yoctoRecipe.generate_newer_platform_components(
_repo, args.ros_distro)
Expand Down
48 changes: 0 additions & 48 deletions superflore/generators/bitbake/yocto_recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
from time import gmtime, strftime
from urllib.request import urlretrieve

from rosdistro import get_distribution_cache_string, get_index, get_index_url
from superflore.exceptions import NoPkgXml
from superflore.exceptions import UnresolvedDependency
from superflore.generators.bitbake.oe_query import OpenEmbeddedLayersDB
Expand Down Expand Up @@ -656,53 +655,6 @@ def generate_rosdistro_conf(
err('Failed to write conf {} to disk! {}'.format(conf_path, e))
raise e

@staticmethod
def generate_distro_cache(basepath, distro, skip_keys=[]):
distro_cache_dir = '{0}/files/{1}/'.format(basepath, distro)
distro_cache_path = '{0}cache.yaml'.format(distro_cache_dir)
try:
index = get_index(get_index_url())
yaml_str = get_distribution_cache_string(index, distro)
make_dir(distro_cache_dir)
with open(distro_cache_path, 'w') as distro_cache_file:
distro_cache_file.write('# {}/cache.yaml\n'.format(distro))
distro_cache_file.write(yaml_str)
ok('Wrote {0}'.format(distro_cache_path))
except OSError as e:
err('Failed to write distro cache {} to disk! {}'.format(
distro_cache_path, e))
raise e
# Generate a diff'able cache file
distro_cache_diff_path = '{}cache.diffme'.format(distro_cache_dir)
try:
def replace_all_patterns(d, text):
for k, v in d.items():
text = re.sub(k, v, text, flags=re.M)
return text
replacement_table = {
r"{([^ }][^ }]*)}": r'[[\1]]',
r"{": r"{\n",
r"}": r"\n}",
r"\[\[": r"{",
r"\]\]": r"}",
r", ": r",\n",
r"^ ": r"-----\n",
r"<version>[^<]*</version>": r"",
r"><": r">\n<",
r"^ ": r"-----\n",
r"^(source_repo_package_xmls:)": r"-----\n\1",
}
with open(distro_cache_diff_path, 'w') as distro_cache_diff_file:
distro_cache_diff_file.write(
'# {}/cache.diffme\n'.format(distro))
yaml_str = replace_all_patterns(replacement_table, yaml_str)
distro_cache_diff_file.write(yaml_str)
ok('Wrote {0}'.format(distro_cache_diff_path))
except OSError as e:
err('Failed to write diffme distro cache {} to disk! {}'.format(
distro_cache_diff_path, e))
raise e

@staticmethod
def generate_rosdep_resolve(basepath, distro):
rosdep_resolve_dir = '{0}/files/{1}/'.format(basepath, distro)
Expand Down

0 comments on commit 52bfc29

Please sign in to comment.