Skip to content

Commit

Permalink
fix upload package id (#5824)
Browse files Browse the repository at this point in the history
  • Loading branch information
memsharded authored and lasote committed Sep 26, 2019
1 parent 7ae393d commit 23fa59f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 15 deletions.
2 changes: 1 addition & 1 deletion conans/client/cmd/uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def upload(self, reference_or_pattern, remotes, upload_recorder, package_id=None
def _collects_refs_to_upload(self, package_id, reference_or_pattern, confirm):
""" validate inputs and compute the refs (without revisions) to be uploaded
"""
if package_id and not check_valid_ref(reference_or_pattern):
if package_id and not check_valid_ref(reference_or_pattern, strict_mode=False):
raise ConanException("-p parameter only allowed with a valid recipe reference, "
"not with a pattern")

Expand Down
16 changes: 3 additions & 13 deletions conans/test/functional/command/remove_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from conans.test.utils.cpp_test_files import cpp_hello_conan_files
from conans.test.utils.test_files import temp_folder
from conans.test.utils.tools import NO_SETTINGS_PACKAGE_ID, TestBufferConanOutput, TestClient, \
TestServer
TestServer, GenConanfile
from conans.util.env_reader import get_env
from conans.util.files import load

Expand Down Expand Up @@ -493,24 +493,14 @@ def setUp(self):
self.client = TestClient(servers=servers, users={"default": [("lasote", "password")]})

def local_test(self):
conanfile = textwrap.dedent("""
from conans import ConanFile
class Test(ConanFile):
pass
""")
self.client.save({"conanfile.py": conanfile})
self.client.save({"conanfile.py": GenConanfile()})
self.client.run("create . lib/1.0@")
self.client.run("remove lib/1.0 -f")
folder = self.client.cache.package_layout(ConanFileReference.loads("lib/1.0@")).export()
self.assertFalse(os.path.exists(folder))

def remote_test(self):
conanfile = textwrap.dedent("""
from conans import ConanFile
class Test(ConanFile):
pass
""")
self.client.save({"conanfile.py": conanfile})
self.client.save({"conanfile.py": GenConanfile()})
self.client.run("create . lib/1.0@")
self.client.run("upload lib/1.0 -r default -c --all")
self.client.run("remove lib/1.0 -f")
Expand Down
6 changes: 5 additions & 1 deletion conans/test/functional/command/upload_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,6 @@ def upload_without_user_channel_test(self):

client.run('create . lib/1.0@')
self.assertIn("lib/1.0: Package '{}' created".format(NO_SETTINGS_PACKAGE_ID), client.out)

client.run('upload lib/1.0 -c --all')
self.assertIn("Uploaded conan recipe 'lib/1.0' to 'default'", client.out)

Expand All @@ -740,3 +739,8 @@ def upload_without_user_channel_test(self):

path = server.server_store.package(pref)
self.assertIn("/lib/1.0/_/_/0/package", path.replace("\\", "/"))

# Should be possible with explicit package
client.run('upload lib/1.0:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9')
self.assertIn("Uploading package 1/1: 5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9 to 'default'",
client.out)

0 comments on commit 23fa59f

Please sign in to comment.