question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Export-pkg assumes only package() method modifies package_directory

See original GitHub issue

To help us debug your issue please explain:

  • I’ve read the CONTRIBUTING guide.
  • I’ve specified the Conan version, operating system version and any tool that can be relevant.
  • I’ve explained the steps to reproduce the error or the motivation/use case of the question/suggestion.

Conan version: 1.0.2

Issue

When using conan export-pkg to export a package, conan assumes the recipe’s package() method is all that needs to be invoked.

As per the guide, cmake-projects can use the helper cmake.install() in their build() method, if targets are already setup for installation in CMake.

Steps to reproduce

Given the following conanfile:

class TestpkgConan(ConanFile):
    name = "testpkg"
    version = "0.1"
    generators = "cmake"
    exports_sources = "src/*"

    def build(self):
        # Doing a copy here to simluate cmake.install()
        self.run("mkdir -p package/share && cp src/CMakeLists.txt package/share/")

    def package(self):
        # Noop
        return

And the following shell session:

λ conan build .
...
λ conan package .
PROJECT: Generating the package
PROJECT: Package folder testpkg/package
PROJECT: Calling package()
PROJECT package(): WARN: No files copied!
PROJECT: Package 'package' created
λ conan export-pkg . testpkg/0.1@sheeo/testing
testpkg/0.1@sheeo/testing export: Copied 1 '.h' files: hello.h
testpkg/0.1@sheeo/testing export: Copied 1 '.cpp' files: hello.cpp
testpkg/0.1@sheeo/testing export: Copied 1 '.txt' files: CMakeLists.txt
Packaging to 5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9
λ conan export-pkg -f . testpkg/0.1@sheeo/testing
...
testpkg/0.1@sheeo/testing: Calling package()
testpkg/0.1@sheeo/testing package(): WARN: No files copied!
testpkg/0.1@sheeo/testing: Package '5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9' created

It should be expected that the package folder contains the CMakeLists.txt file copied in the build() step, however, only the following files are present:

λ ls -la ~/.conan/data/testpkg/0.1/sheeo/testing/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9
total 16
-rw-r--r--  1 sheeo  staff   150B Jan 22 13:49 conaninfo.txt
-rw-r--r--  1 sheeo  staff    59B Jan 22 13:49 conanmanifest.txt

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
Sheeocommented, Jan 24, 2018

Yep, that’d be sufficient 👍

0reactions
danimtbcommented, Aug 7, 2018

@bryceschober there is a proposed PR in the docs to update that section conan-io/docs#750 too

Read more comments on GitHub >

github_iconTop Results From Across the Web

conan export-pkg — conan 1.53.0 documentation
The export-pkg command let you create a package from already existing files in your working folder, it can be useful if you are...
Read more >
The Buildroot user manual
In the official tree, most of the package sources are retrieved using wget from ftp, http or https locations. A few packages are...
Read more >
The import package - The Comprehensive R Archive Network
Problem (2) refers to the case where packages export different objects with ... point is that one can only import one object at...
Read more >
R Packages (2e) - 8 Data
8.2 Exported data. The most common location for package data is (surprise!) data/ . We recommend that each file in this directory be...
Read more >
3 Common Tasks — The Yocto Project ® 4.1.999 documentation
Assuming you have sourced the build environment setup script (i.e. oe-init-build-env) and you are in the Build Directory, use BitBake to process your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found