Skip to content

Commit

Permalink
Make user/channel part of most package_id modes (#11477)
Browse files Browse the repository at this point in the history
* use user/channel in package_id

* fix tests

* fix functional tests
  • Loading branch information
memsharded authored Jun 17, 2022
1 parent 79ae5ff commit fa83005
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 15 deletions.
20 changes: 15 additions & 5 deletions conans/model/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,31 +97,41 @@ def unrelated_mode(self):
def semver_mode(self):
self.name = self._ref.name
self.version = _VersionRepr(self._ref.version).stable()
self.user = self.channel = self.package_id = None
self.user = self._ref.user
self.channel = self._ref.channel
self.package_id = None
self.recipe_revision = None

def full_version_mode(self):
self.name = self._ref.name
self.version = self._ref.version
self.user = self.channel = self.package_id = None
self.user = self._ref.user
self.channel = self._ref.channel
self.package_id = None
self.recipe_revision = None

def patch_mode(self):
self.name = self._ref.name
self.version = _VersionRepr(self._ref.version).patch()
self.user = self.channel = self.package_id = None
self.user = self._ref.user
self.channel = self._ref.channel
self.package_id = None
self.recipe_revision = None

def minor_mode(self):
self.name = self._ref.name
self.version = _VersionRepr(self._ref.version).minor()
self.user = self.channel = self.package_id = None
self.user = self._ref.user
self.channel = self._ref.channel
self.package_id = None
self.recipe_revision = None

def major_mode(self):
self.name = self._ref.name
self.version = _VersionRepr(self._ref.version).major()
self.user = self.channel = self.package_id = None
self.user = self._ref.user
self.channel = self._ref.channel
self.package_id = None
self.recipe_revision = None

def full_recipe_mode(self):
Expand Down
4 changes: 2 additions & 2 deletions conans/test/functional/graph/test_graph_build_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ def build_all():


foo_id = "efa83b160a55b033c4ea706ddb980cd708e3ba1b"
bar_id = "8dcbed6f1d74e477e5cb4c720cabe6c391d59ea0"
foobar_id = "a9ec6bebb0b06aa725ce41bcc07555b5a0630796"
bar_id = "7d0bb2b97d4339b0d3ded1418a2593f35b9cf267"
foobar_id = "af8f885f621ba7baac3f5b1d2c18cfdf5ba2550c"


def check_if_build_from_sources(refs_modes, output):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def test_version_full_version_schema(self):
# but will look for the same package_id
self.client.run("install .", assert_error=True)
self.assertIn("ERROR: Missing binary: "
"hello2/2.3.8@lasote/stable:f25bd0cc2b8eec83e11ca16e79f4e43539cd93b9",
"hello2/2.3.8@lasote/stable:971e20f31a0d8deb18f03a0f8f72fd95623a8e29",
self.client.out)

# Now change the Hello version and build it, if we install out requires is
Expand Down Expand Up @@ -248,17 +248,17 @@ def test_package_id_requires_patch_mode(self):
self._export("libd", "0.1.0", channel=channel, package_id_text=None,
requires=["libc/0.1.0@user/testing"])
self.client.run("create . --name=libd --version=0.1.0 --user=user --channel=testing", assert_error=True)
package_id_missing = "c4e90f390819b782c27ad290de6727acbcbc76bd"
package_id_missing = "18e1a54bf351cd291da5a01ef545ce338243285f"
self.assertIn(f"""ERROR: Missing binary: libc/0.1.0@user/testing:{package_id_missing}
libc/0.1.0@user/testing: WARN: Can't find a 'libc/0.1.0@user/testing' package binary '{package_id_missing}' for the configuration:
[options]
an_option=off
[requires]
liba/0.1.0
libb/0.1.0
libbar/0.1.0
libfoo/0.1.0""", self.client.out)
liba/0.1.0@user/testing
libb/0.1.0@user/testing
libbar/0.1.0@user/testing
libfoo/0.1.0@user/testing""", self.client.out)


class PackageIDErrorTest(unittest.TestCase):
Expand Down
3 changes: 1 addition & 2 deletions conans/test/integration/py_requires/python_requires_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
import re
import textwrap
import time
import unittest
Expand Down Expand Up @@ -728,7 +727,7 @@ def build(self):
"python_requires2/1.0@user/test": "Cache"}, python=True)
# - packages
client.assert_listed_binary({"project/1.0@user/test":
("1d71f9c410465b607aaf217320808237e019989f", "Build")})
("257a966344bb19ae8ef0c208eff085952902e25f", "Build")})

# - no mention to alias
self.assertNotIn("alias", client.out)
Expand Down

0 comments on commit fa83005

Please sign in to comment.