conan-io / conan

Conan - The open-source C and C++ package manager
https://conan.io
MIT License
7.96k stars 952 forks source link

[bug] Conan Copy behavior Windows/Linux #16458

Closed fellinga closed 3 weeks ago

fellinga commented 3 weeks ago

I started to export (conan export-pkg) packages on Linux instead of Windows - the package looks different now.

It seems that Conan copy() on Windows copied all files in the source folder including files in subfolder and copy() on Linux only copies files directly in the source folder leaving files in subfolder behind. We do not want to keep_path, we only want to copy files in "folder" and all its subfolder to the destination (flat).

This is our code in conanfile.py:

        # SourceCode
        codeFolders = [ os.path.join(self.build_folder,"folder1"),
                        os.path.join(self.build_folder,"folder2", "src"),
                        os.path.join(self.build_folder,"folder2", "custom")]

        for folder in codeFolders:
            #inc
            copy(self, "*.hpp", folder, dst=os.path.join(self.package_folder, "inc"), keep_path=False)
            #src
            copy(self, "*.cpp", folder, dst=os.path.join(self.package_folder, "src"), keep_path=False)
            copy(self, "*.c", folder, dst=os.path.join(self.package_folder, "src"), keep_path=False)

Is this intentional?

memsharded commented 3 weeks ago

Hi @fellinga

Thanks for reporting. I am trying to reproduce it, but I haven't been able so far. I have added a test that I think it covers this case in https://github.com/conan-io/conan/pull/16459, in case you can have a look.

Could you please try to share exact reproduction steps (including the code to reproduce)? Many thanks!

fellinga commented 3 weeks ago

Hi @memsharded,

thanks for immediate response! I double checked our commits and we didn't have any since the last successful pipeline but we overlooked the fact that one folder name was "SRC" and not "src" which is obviously a different thing on Linux.

Sorry for the false alarm.. but I think the new test is a very positive outcome of this issue!

Thanks!

memsharded commented 3 weeks ago

Sounds good, happy that you found the root issue, thanks for the feedback!