Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix profile issiues #582 and #556 #583

Merged
merged 3 commits into from
Oct 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions cpt/packager.py
Original file line number Diff line number Diff line change
Expand Up @@ -669,12 +669,12 @@ def run_builds(self, curpage=None, total_pages=None, base_profile_name=None,

profile_text, base_profile_text = get_profiles(self.client_cache, build,
base_profile_name)
_, base_profile_build_text = get_profiles(self.client_cache, build,
base_profile_build_name)
profile_build_text, base_profile_build_text = get_profiles(self.client_cache, build,
base_profile_build_name, True)
if not self.use_docker:
profile_abs_path = save_profile_to_tmp(profile_text)
if base_profile_build_text:
profile_build_abs_path = save_profile_to_tmp(base_profile_build_text)
profile_build_abs_path = save_profile_to_tmp(profile_build_text)
else:
profile_build_abs_path = None
r = CreateRunner(profile_abs_path, build.reference, self.conan_api,
Expand Down Expand Up @@ -731,7 +731,8 @@ def run_builds(self, curpage=None, total_pages=None, base_profile_name=None,
force_selinux=self.force_selinux,
skip_recipe_export=skip_recipe_export,
update_dependencies=self.update_dependencies,
profile_build_text=base_profile_build_text,
profile_build_text=profile_build_text,
base_profile_build_text=base_profile_build_text,
cwd=self.cwd)

r.run(pull_image=not pulled_docker_images[docker_image],
Expand Down
11 changes: 7 additions & 4 deletions cpt/profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from cpt import get_client_version


def get_profiles(client_cache, build_config, base_profile_name=None):
def get_profiles(client_cache, build_config, base_profile_name=None, is_build_profile=False):

base_profile_text = ""
if base_profile_name:
Expand All @@ -30,9 +30,12 @@ def get_profiles(client_cache, build_config, base_profile_name=None):

def pairs_lines(items):
return "\n".join(["%s=%s" % (k, v) for k, v in items])

settings = pairs_lines(sorted(build_config.settings.items()))
options = pairs_lines(build_config.options.items())
if is_build_profile:
settings=""
options=""
else:
settings = pairs_lines(sorted(build_config.settings.items()))
options = pairs_lines(build_config.options.items())
env_vars = pairs_lines(build_config.env_vars.items())
br_lines = ""
for pattern, build_requires in build_config.build_requires.items():
Expand Down
2 changes: 2 additions & 0 deletions cpt/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ def __init__(self, profile_text, base_profile_text, base_profile_name, reference
update_dependencies=False,
lockfile=None,
profile_build_text=None,
base_profile_build_text=None,
cwd=None):

self.printer = printer or Printer()
Expand Down Expand Up @@ -243,6 +244,7 @@ def __init__(self, profile_text, base_profile_text, base_profile_name, reference
self._skip_recipe_export = skip_recipe_export
self._update_dependencies = update_dependencies
self._profile_build_text = profile_build_text
self._base_profile_build_text = base_profile_build_text
self._cwd = cwd or os.getcwd()

def _pip_update_conan_command(self):
Expand Down