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

#282 Add CONAN_REMOVE_OUTDATE_PACKAGES option #4

Open
wants to merge 36 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
ab4b673
Bump Conan version to 1.28.0
uilianries Jul 29, 2020
27614f7
#515 Fix CPT_TEST_FOLDER=False
uilianries Jul 30, 2020
2d62917
#515 Add invalid test_folder test
uilianries Jul 30, 2020
584b56f
#515 Update OSX version to 10.3
uilianries Jul 30, 2020
33585f3
Merge pull request #518 from uilianries/hotfix/test-folder-disable
uilianries Jul 30, 2020
e6490ba
Merge pull request #516 from conan-io/release/0.34.1
czoido Jul 31, 2020
8dc8d19
Support Conan 1.29
uilianries Sep 1, 2020
0da7baa
Merge pull request #522 from conan-io/release/0.34.2
czoido Sep 2, 2020
6b06ed3
Accept Conan 1.30
uilianries Oct 1, 2020
9b782a6
Merge pull request #527 from conan-io/release/0.34.3
czoido Oct 5, 2020
f38dd04
Merge pull request #529 from conan-io/master
uilianries Oct 26, 2020
4fc377e
build static before shared
ericLemanissier Feb 25, 2020
ed5b021
fix unit tests
ericLemanissier Oct 27, 2020
ab246f0
Merge pull request #468 from ericLemanissier/patch-2
uilianries Oct 30, 2020
245b721
Update max Conan version to 1.31.0
uilianries Oct 30, 2020
86e2dcc
Merge pull request #530 from conan-io/release/0.34.4
czoido Nov 1, 2020
c0a3165
Bump dev version (#531)
uilianries Nov 17, 2020
96303de
Pass cwd to DockerCreateRunner, #447
theirix Oct 21, 2020
06696a3
Fix test_docker_cwd on Windows, #447
theirix Oct 30, 2020
b6d6816
Merge pull request #528 from theirix/docker-cwd
uilianries Nov 18, 2020
6e32035
Hide sensitive information from getting displayed/logged.
kasunch Nov 19, 2020
a6459bd
Added the missing function argument.
kasunch Nov 19, 2020
3110972
Validate hide sensitive data
uilianries Nov 30, 2020
d156da1
Avoid import error on Conan 1.32
uilianries Dec 2, 2020
60e495b
Test devel first
uilianries Dec 2, 2020
4f2e554
Add developmen test on Windows
uilianries Dec 2, 2020
40b5d2a
Merge pull request #538 from uilianries/hotfix/conan-import-error
uilianries Dec 2, 2020
c65cd53
Merge pull request #536 from kasunch/hidesensitive
uilianries Dec 3, 2020
776861e
Update development verstion to 0.35.0
uilianries Dec 3, 2020
6f4758b
Update develop version to 0.36.0
uilianries Dec 3, 2020
485e4f9
pass CONAN_USERNAME envvar to docker (#479)
Artalus Mar 10, 2020
08768f2
#479 Validate hotfix for _ username
uilianries Mar 15, 2021
8630068
#479 Improve env var for test_docker_underscore_user_channel
uilianries Mar 15, 2021
c533ea8
#479 Add Docker pull retry
uilianries Mar 15, 2021
67cfe3a
#479 Add small interval for docker pull retry
uilianries Mar 15, 2021
16f0a3d
#479 Fix unexpected indent for docker tests
uilianries Mar 15, 2021
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
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,11 @@ cacert.pem

# tmp eclipse markdown viewer
/.README*


# Virtualenv
env/
venv/

# Coverage
.coveragerc
25 changes: 12 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ jobs:
fast_finish: true
include:

- stage: Conan Development - Linux
if: branch != master AND branch !~ /release*/
python: 2.7
env: TOXENV=py27-conan-dev
- python: 3.7
if: branch != master AND branch !~ /release*/
env: TOXENV=py37-conan-dev
dist: xenial

- stage: Conan Latest - Linux
python: 2.7
env: TOXENV=py27-conan-latest
Expand All @@ -16,23 +25,13 @@ jobs:
- stage: Conan Latest - Macos
language: generic
os: osx
osx_image: xcode8.3
osx_image: xcode10.3
env: PYVER=py27 TOXENV=py27-conan-latest
- language: generic
os: osx
osx_image: xcode8.3
osx_image: xcode10.3
env: PYVER=py37 TOXENV=py37-conan-latest

- stage: Conan Development - Linux
if: branch != master AND branch !~ /release*/
python: 2.7
env: TOXENV=py27-conan-dev
- python: 3.7
if: branch != master AND branch !~ /release*/
env: TOXENV=py37-conan-dev
dist: xenial



install:
- .ci/travis/install.sh
Expand All @@ -41,4 +40,4 @@ script:
- .ci/travis/run.sh

after_success:
- bash <(curl -s https://codecov.io/bash)
- bash <(curl -s https://codecov.io/bash)
10 changes: 10 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
environment:
matrix:
- PYTHON: "C:\\Python27"
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
USE_UNSUPPORTED_CONAN_WITH_PYTHON_2: "1"
TOXENV: "py27-conan-dev"

- PYTHON: "C:\\Python37"
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
USE_UNSUPPORTED_CONAN_WITH_PYTHON_2: "1"
TOXENV: "py37-conan-dev"

- PYTHON: "C:\\Python27"
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
USE_UNSUPPORTED_CONAN_WITH_PYTHON_2: "1"
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions cpt/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@

__version__ = '0.34.0'
NEWEST_CONAN_SUPPORTED = "1.27.000"
__version__ = '0.36.0-dev'


def get_client_version():
from conans.model.version import Version
from conans import __version__ as client_version
from os import getenv
# It is a mess comparing dev versions, lets assume that the -dev is the further release
return Version(client_version.replace("-dev", ""))
8 changes: 4 additions & 4 deletions cpt/builds_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def get_mingw_builds(mingw_configurations, mingw_installer_reference,
build_requires = {"*": [mingw_installer_reference]}

if shared_option_name and not build_all_options_values:
for shared in [True, False]:
for shared in [False, True]:
opt = copy.copy(options)
opt[shared_option_name] = shared
builds += _make_mingw_builds(settings, opt, build_requires, build_types, cppstds, reference)
Expand Down Expand Up @@ -367,7 +367,7 @@ def get_osx_apple_clang_builds(apple_clang_versions, archs, shared_option_name,
for arch in archs:
for cppstd in cppstds:
if shared_option_name and not build_all_options_values:
for shared in [True, False]:
for shared in [False, True]:
opt = copy.copy(options)
opt[shared_option_name] = shared
for build_type_it in build_types:
Expand Down Expand Up @@ -414,7 +414,7 @@ def get_linux_gcc_builds(gcc_versions, archs, shared_option_name, pure_c, build_
for arch in archs:
for cppstd in cppstds:
if shared_option_name and not build_all_options_values:
for shared in [True, False]:
for shared in [False, True]:
opt = copy.copy(options)
opt[shared_option_name] = shared
for build_type_it in build_types:
Expand Down Expand Up @@ -464,7 +464,7 @@ def get_linux_clang_builds(clang_versions, archs, shared_option_name, pure_c, bu
for arch in archs:
for cppstd in cppstds:
if shared_option_name and not build_all_options_values:
for shared in [True, False]:
for shared in [False, True]:
opt = copy.copy(options)
opt[shared_option_name] = shared
for build_type_it in build_types:
Expand Down
19 changes: 3 additions & 16 deletions cpt/packager.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from conans.model.ref import ConanFileReference
from conans.model.version import Version

from cpt import NEWEST_CONAN_SUPPORTED, get_client_version
from cpt import get_client_version
from cpt.auth import AuthManager
from cpt.builds_generator import BuildConf, BuildGenerator
from cpt.ci_manager import CIManager
Expand Down Expand Up @@ -346,18 +346,6 @@ def valid_pair(var, value):
for var, value in self.__dict__.items()
if valid_pair(var, value)})

self._newest_supported_conan_version = Version(NEWEST_CONAN_SUPPORTED).minor(fill=False)
self._client_conan_version = conan_version

def _check_conan_version(self):
tmp = self._newest_supported_conan_version
if Version(self._client_conan_version).minor(fill=False) > tmp:
msg = "Conan/CPT version mismatch. Conan version installed: " \
"%s . This version of CPT supports only Conan < %s" \
"" % (self._client_conan_version, str(tmp))
self.printer.print_message(msg)
raise Exception(msg)

# For Docker on Windows, including Linux containers on Windows
@property
def is_lcow(self):
Expand Down Expand Up @@ -569,8 +557,6 @@ def update_build_if(self, predicate, new_settings=None, new_options=None, new_en
self._builds = updated_builds

def run(self, base_profile_name=None, summary_file=None):
self._check_conan_version()

env_vars = self.auth_manager.env_vars()
env_vars.update(self.remotes_manager.env_vars())
with tools.environment_append(env_vars):
Expand Down Expand Up @@ -718,7 +704,8 @@ def run_builds(self, curpage=None, total_pages=None, base_profile_name=None):
lockfile=self.lockfile,
force_selinux=self.force_selinux,
skip_recipe_export=skip_recipe_export,
update_dependencies=self.update_dependencies)
update_dependencies=self.update_dependencies,
cwd=self.cwd)

r.run(pull_image=not pulled_docker_images[docker_image],
docker_entry_script=self.docker_entry_script)
Expand Down
4 changes: 2 additions & 2 deletions cpt/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
six>=1.10.0, <1.15.0
conan>=1.7.0, <1.28.0
six>=1.10.0,<=1.15.0
conan>=1.7.0
tabulate>=0.8.0, <0.9.0
33 changes: 25 additions & 8 deletions cpt/runner.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import os
import sys
import subprocess
import re
import time
from collections import namedtuple

from conans import tools
Expand Down Expand Up @@ -62,6 +64,9 @@ def __init__(self, profile_abs_path, reference, conan_api, uploader,

self._profile = load_profile(profile_abs_path, cache)

if isinstance(self._test_folder, str) and self._test_folder.lower() == "false":
self._test_folder = False

@property
def settings(self):
return self._profile.settings
Expand Down Expand Up @@ -181,7 +186,8 @@ def __init__(self, profile_text, base_profile_text, base_profile_name, reference
force_selinux=None,
skip_recipe_export=False,
update_dependencies=False,
lockfile=None):
lockfile=None,
cwd=None):

self.printer = printer or Printer()
self._upload = upload
Expand Down Expand Up @@ -216,6 +222,7 @@ def __init__(self, profile_text, base_profile_text, base_profile_name, reference
self._force_selinux = force_selinux
self._skip_recipe_export = skip_recipe_export
self._update_dependencies = update_dependencies
self._cwd = cwd or os.getcwd()

def _pip_update_conan_command(self):
commands = []
Expand Down Expand Up @@ -295,7 +302,7 @@ def run(self, pull_image=True, docker_entry_script=None):
command = ('%s docker run --rm -v "%s:%s/project%s" %s %s %s %s %s '
'"%s cd project && '
'%s run_create_in_docker "' % (self._sudo_docker_command,
os.getcwd(),
self._cwd,
self._docker_conan_home,
volume_options,
env_vars_text,
Expand All @@ -319,9 +326,15 @@ def run(self, pull_image=True, docker_entry_script=None):

def pull_image(self):
with self.printer.foldable_output("docker pull"):
ret = self._runner("%s docker pull %s" % (self._sudo_docker_command, self._docker_image))
if ret != 0:
raise Exception("Error pulling the image: %s" % self._docker_image)
for retry in range(1, 4):
ret = self._runner("%s docker pull %s" % (self._sudo_docker_command, self._docker_image))
if ret == 0:
break
elif retry == 3:
raise Exception("Error pulling the image: %s" % self._docker_image)
self.printer.print_message("Could not pull docker image '{}'. Retry ({})"
.format(self._docker_image, retry))
time.sleep(3)

def get_env_vars(self):
ret = {key: value for key, value in os.environ.items() if key.startswith("CONAN_") and
Expand All @@ -332,7 +345,7 @@ def get_env_vars(self):
ret["CPT_BASE_PROFILE"] = escape_env(self._base_profile_text)
ret["CPT_BASE_PROFILE_NAME"] = escape_env(self._base_profile_name)

ret["CONAN_USERNAME"] = escape_env(self._reference.user)
ret["CONAN_USERNAME"] = escape_env(self._reference.user or ret.get("CONAN_USERNAME"))
ret["CONAN_TEMP_TEST_FOLDER"] = "1" # test package folder to a temp one
ret["CPT_UPLOAD_ENABLED"] = self._upload
ret["CPT_UPLOAD_RETRY"] = self._upload_retry
Expand Down Expand Up @@ -370,8 +383,12 @@ def __init__(self, runner, printer):
self.runner = runner
self.printer = printer

def __call__(self, command):
self.printer.print_command(command)
def __call__(self, command, hide_sensitive=True):
cmd_str = command
if hide_sensitive:
cmd_str = re.sub(r'(CONAN_LOGIN_USERNAME[_\w+]*)=\"(\w+)\"', r'\1="xxxxxxxx"', cmd_str)
cmd_str = re.sub(r'(CONAN_PASSWORD[_\w+]*)=\"(\w+)\"', r'\1="xxxxxxxx"', cmd_str)
self.printer.print_command(cmd_str)
sys.stderr.flush()
sys.stdout.flush()
return self.runner(command)
16 changes: 16 additions & 0 deletions cpt/test/assets/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import os
import shutil


def copy_assets(src_folder, dst_folder, assets=None):
assets_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "files")
if src_folder:
src_folder = os.path.join(assets_path, src_folder)
assets = assets or os.listdir(src_folder)
for asset in assets:
s = os.path.join(src_folder, asset)
d = os.path.join(dst_folder, asset)
if os.path.isdir(s):
shutil.copytree(s, d)
else:
shutil.copy2(s, d)
Loading