conan-io / conan-package-tools

Conan Package Tools. Helps with massive package creation and CI integration (Travis CI, Appveyor...)
MIT License
165 stars 70 forks source link

Uploading recipe only when build_policy='always' #234

Open db4 opened 6 years ago

db4 commented 6 years ago

I have a recipe with build_policy='always' that I would like to test with CI and if the result is good, upload it to a conan repo. Unfortunately this does not currently work:

Uploading ocaml_installer/0.0.1@dbely/testing to remote 'upload_repo'

Uploading conanmanifest.txt                                           

Uploading conanfile.py                                                

Uploaded conan recipe 'ocaml_installer/0.0.1@dbely/testing' to 'upload_repo': http://docker1:8081/artifactory/api/conan/conan-local
Traceback (most recent call last):
  File "build.py", line 23, in <module>
    builder.run()
  File "/usr/local/lib/python2.7/dist-packages/cpt/packager.py", line 376, in run
    self.run_builds(base_profile_name=base_profile_name)
  File "/usr/local/lib/python2.7/dist-packages/cpt/packager.py", line 453, in run_builds
    r.run()
  File "/usr/local/lib/python2.7/dist-packages/cpt/runner.py", line 76, in run
    self._uploader.upload_packages(self._reference, self._upload)
  File "/usr/local/lib/python2.7/dist-packages/cpt/uploader.py", line 23, in upload_packages
    self.conan_api.upload(str(reference), all_packages=True, remote=remote_name, force=True)
  File "/usr/local/lib/python2.7/dist-packages/conans/client/conan_api.py", line 78, in wrapper
    return f(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/conans/client/conan_api.py", line 747, in upload
    retry_wait, skip_upload, integrity_check, no_overwrite, remote)
  File "/usr/local/lib/python2.7/dist-packages/conans/client/cmd/uploader.py", line 67, in upload
    skip_upload, integrity_check, no_overwrite, remote_name, recorder)
  File "/usr/local/lib/python2.7/dist-packages/conans/client/cmd/uploader.py", line 95, in _upload
    raise ConanException("Conanfile has build_policy='always', "
conans.errors.ConanException: Conanfile has build_policy='always', no packages can be uploaded

Is it possible to tell conan-package-tools somehow that this is intentional and only the recipe should be uploaded?

danimtb commented 6 years ago

I think there is no way to tell CPT to upload recipes with build_policy=always ATM as this is trying to upload all packages. This causes that exception to let user know that there are no packages to upload.

lasote commented 6 years ago

Currently, you cannot specify it. We need to check if it could be detected from the recipe or otherwise enable a new flag to upload only the recipe.