Skip to content

Commit

Permalink
Merge branch 'release/1.12.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
lasote committed Feb 5, 2019
2 parents fd05075 + a1bdea8 commit ded64eb
Show file tree
Hide file tree
Showing 6 changed files with 116 additions and 49 deletions.
97 changes: 55 additions & 42 deletions .ci/jenkins/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,61 @@ echo "STAGES: ${flavors}"
echo "PYVERS: ${all_pyvers}"
echo "EXCLUDED TAGS: ${excluded_tags}"



// FIRST rest api tests, fail ASAP
rest_builders = [:]
for (n in ["Windows", "Linux"]) {
def the_node = n
def pyver = "py36"
rest_builders["${the_node} Rest API Test"] = {
node(the_node){
stage("REST tests ${the_node}"){
def vars = checkout scm
def base_dir = (the_node == "Windows") ? win_tmp_base : rest_tmp_base
base_dir = base_dir + "rest" + vars["GIT_COMMIT"].substring(0, 4)
def venv_dir = base_dir + "/venv"
def src_dir = base_dir + "/src"

while(fileExists(src_dir)){
src_dir = src_dir + "_"
}
while(fileExists(venv_dir)){
venv_dir = venv_dir + "_"
}

// Copy SRC to a clean folder
dir(base_dir){ // Trick to create the parent
def escaped_ws = "${WORKSPACE}".replace("\\", "/")
def cmd = "python -c \"import shutil; shutil.copytree('${escaped_ws}', '${src_dir}')\""
if (the_node == "Windows"){
bat(script: cmd)
}
else{
sh(script: cmd)
}
}

if(the_node == "Windows"){
try{
bat(script: "python ${runner} conans.test.functional.remote.rest_api_test ${pyver} ${src_dir} \"${venv_dir}\"")
}
finally{
bat(script: "rd /s /q \"${base_dir}\"")
}
}
else{
docker.image('conanio/conantests').inside("-e CONAN_USER_HOME=${src_dir} -v${src_dir}:${src_dir}") {
sh(script: "python ${runner} conans.test.functional.remote.rest_api_test ${pyver} ${src_dir} /tmp")
}
}
}
}
}
}
parallel rest_builders


try{
for (flavor in flavors){
def builders = [:]
Expand Down Expand Up @@ -183,48 +238,6 @@ try{
parallel builders
}




// Run rest_api_test without concurrency between same node
pyvers = ['py36']
for (y in pyvers) {
builders = [:]
def pyver = y
builders["Windows Rest API Test"] = {
node("Windows"){
stage("REST tests Windows ${pyver}"){
checkout scm
try{
bat(script: "python ${runner} conans.test.functional.remote.rest_api_test ${pyver} ${WORKSPACE} \"${win_tmp_base}${commit}\"")
}
finally{
bat(script: "rd /s /q \"${win_tmp_base}${commit}\"")
}
}
}
}
builders["Linux Rest API Test"] = {
node("Linux"){
stage("REST tests Linux ${pyver}"){
checkout scm
docker.image('conanio/conantests').inside("-e CONAN_USER_HOME=${WORKSPACE}") {
sh(script: "python ${runner} conans.test.functional.remote.rest_api_test ${pyver} ${WORKSPACE} /tmp/${commit}")
}
}
}
}
/*builders["Mac Rest API Test"] = {
node("Macos"){
stage("REST tests Windows ${pyver}"){
withEnv(['PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin']) {
sh(script: "tox --workdir /tmp/${commit} -e ${pyver} -- -x conans.test.functional.remote.rest_api_test")
}
}
}
}*/ // EXTREMELY SLOW, INVESTIGATE
parallel builders
}
if (env.BRANCH_NAME == "develop") {
// Deploy snapshot to test pypi if branch develop
node("Linux") {
Expand Down
2 changes: 1 addition & 1 deletion conans/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@
SERVER_CAPABILITIES = [COMPLEX_SEARCH_CAPABILITY, REVISIONS] # Server is always with revisions
DEFAULT_REVISION_V1 = "0"

__version__ = '1.12.0'
__version__ = '1.12.1'
5 changes: 2 additions & 3 deletions conans/client/graph/graph_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,10 @@ def _load_deps(self, node, down_reqs, dep_graph, public_deps, down_ref, down_opt
def _conflicting_references(previous_ref, new_ref):
if previous_ref.copy_clear_rev() != new_ref.copy_clear_rev():
return REFERENCE_CONFLICT
# Computed node, has to have a revision, at least 0
assert(previous_ref.revision is not None)
# Computed node, if is Editable, has revision=None
# If new_ref.revision is None we cannot assume any conflict, the user hasn't specified
# a revision, so it's ok any previous_ref
if new_ref.revision and previous_ref.revision != new_ref.revision:
if previous_ref.revision and new_ref.revision and previous_ref.revision != new_ref.revision:
return REVISION_CONFLICT
return False

Expand Down
11 changes: 8 additions & 3 deletions conans/model/graph_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
import os

from conans.client.profile_loader import _load_profile
from conans.errors import ConanException
from conans.model.options import OptionsValues
from conans.model.ref import ConanFileReference
from conans.tools import save
from conans.util.files import load
from conans.model.ref import ConanFileReference


GRAPH_INFO_FILE = "graph_info.json"
Expand All @@ -24,7 +25,11 @@ def load(path):
if not path:
raise IOError("Invalid path")
p = path if os.path.isfile(path) else os.path.join(path, GRAPH_INFO_FILE)
return GraphInfo.loads(load(p))
content = load(p)
try:
return GraphInfo.loads(content)
except Exception as e:
raise ConanException("Error parsing GraphInfo from file '{}': {}".format(p, e))

@staticmethod
def loads(text):
Expand All @@ -38,7 +43,7 @@ def loads(text):
options = None
else:
options = OptionsValues(options)
root = graph_json["root"]
root = graph_json.get("root", {"name": None, "version": None, "user": None, "channel": None})
root_ref = ConanFileReference(root["name"], root["version"], root["user"], root["channel"],
validate=False)
return GraphInfo(profile=profile, options=options, root_ref=root_ref)
Expand Down
18 changes: 18 additions & 0 deletions conans/test/functional/command/info_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from conans.test.utils.cpp_test_files import cpp_hello_conan_files
from conans.test.utils.tools import TestClient
from conans.util.files import load, save
from conans.test.utils.conanfile import TestConanFile


class InfoTest(unittest.TestCase):
Expand Down Expand Up @@ -611,3 +612,20 @@ class MyTest(ConanFile):
html_content = load(html_path)
self.assertIn("<h3>Pkg/0.2@lasote/testing</h3>", html_content)
self.assertIn("<li><b>topics</b>: foo", html_content)

def wrong_graph_info_test(self):
# https://github.com/conan-io/conan/issues/4443
conanfile = TestConanFile()
client = TestClient()
client.save({"conanfile.py": str(conanfile)})
client.run("install .")
path = os.path.join(client.current_folder, "graph_info.json")
graph_info = load(path)
graph_info = json.loads(graph_info)
graph_info.pop("root")
save(path, json.dumps(graph_info))
client.run("info .")
self.assertIn("conanfile.py (Hello/0.1@None/None)", client.out)
save(path, "broken thing")
client.run("info .", assert_error=True)
self.assertIn("ERROR: Error parsing GraphInfo from file", client.out)
32 changes: 32 additions & 0 deletions conans/test/functional/editable/transitive_editable_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# coding=utf-8

import os
import unittest

from conans.test.utils.tools import TestClient
from conans.test.utils.conanfile import TestConanFile
from conans.util.files import mkdir


class TransitiveEditableTest(unittest.TestCase):

def test_transitive_editables(self):
# https://github.com/conan-io/conan/issues/4445
client = TestClient()
conanfileC = TestConanFile("LibC", "0.1")
client.save({"conanfile.py": str(conanfileC)})
client.run("link . LibC/0.1@user/testing")

client2 = TestClient(client.base_folder)
conanfileB = TestConanFile("LibB", "0.1", requires=["LibC/0.1@user/testing"])

client2.save({"conanfile.py": str(conanfileB)})
client2.run("create . user/testing")

conanfileA = TestConanFile("LibA", "0.1", requires=["LibB/0.1@user/testing",
"LibC/0.1@user/testing"])
client2.save({"conanfile.py": str(conanfileA)})
client2.run("install .")
client2.current_folder = os.path.join(client2.current_folder, "build")
mkdir(client2.current_folder)
client2.run("install ..")

0 comments on commit ded64eb

Please sign in to comment.