New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feature] Automatic directory management in source unpack support #6479
Comments
Hi! I've seen this behavior on desktop tools too, and it is useful in general terms, but for an automated tool... I think it is not so annoying to have that extra directory. I would like to hear more feedback from the community that is contributing with recipes to Conan Center to know if it would be useful or they will still rename the directory to If it is really useful, as an opt-in, it won't break anything and we can consider including it. Thanks for the suggestion! |
Just fyi, because I feel that I probably wasn't completely clear in my initial posting based on your response: the main issue I see is not the fact that there might be an extra directory (there'll be an extra directory anyway, even with this scheme), but that the name of the extra directory has to be constructed every time from the package version, adding a lot of boiler-plate code - especially if upstream doesn't follow the packagename-version scheme. (Most packages do, but some don't.) Anyway, thanks for considering this, and as I said, I'd be willing to implement this if you approve. |
I see, it is about providing a
would be:
instead of:
From the UX perspective, I find it a useful feature, although the
As a Conan developer, I prefer to keep things simple and, whenever it is possible, to keep the same signature as the underlying functions we are calling instead of adding a layer of functionality on top of it. That's my only concern, but I'll tag this as a feature request, and share it with the team, so we can prioritize it. Nevertheless, if you want to contribute to Conan and you create the PR we will consider it. |
👍 @chris-se, waiting for your PR, if you need help writing the feature or the tests, just ping me. Thanks! |
Thanks! I'll start working on it. |
thanks for the suggestion. for the time being, I was thinking about the same. I have simple implementation (not for conan, for my own scripts):
|
It'd be really great to have that for the CCI. Some archive names are harder to decipher, like for example ones from direct commit hash links - you either pass the hash to the recipe or glob downloaded files, both ways are inconvenient. |
As there has not been progress here, and we want to release 1.23, removing the milestone. When we have something to review, we will plan the release to be merged in. Thanks! |
I'm a big fan of this. In Conan-Center there are several recipes that are doing tricks in the |
#8208 implemented |
Debian's
dpkg-source
has a nice feature when unpacking upstream tarballs to ensure that the target directory always has a specific name. It will do the following:The following situations exist then:
Archive contains a directory tree in the following form:
dir/
dir/CMakeLists.txt
dir/sourcefile.c
Calling
dpkg-source -x
would create a directory of the expected name (in Debian's casepackage-version
) and that directory would contain theCMakeLists.txt
file and thesourcefile.c
file - regardless of the namedir/
within the archive.Archive contains a directory tree in the following form:
CMakeLists.txt
sourcefile.c
Calling
dpkg-source -x
would create the same result as before, even though the archive doesn't contain a subdirectory.I think something like that would be interesting for conan, because I see the following pattern very often in recipies:
_source_subfolder
(or something otherwise deterministic)Since the rename step requires the user to know the directory name within the source archive, and projects might change that name between releases, this can add quite a bit of complexity to the conan file.
Since this changes the behavior of unzip / get I would suggest adding a keyword argument
autodir
(defaultFalse
) that introduces this new behavior.Example usage could be:
This would ensure that the contents of the downloaded archive is available in the directory
_source_subfolder
according to the described algorithm, regardless of how the archive was organized internally.I could implement this and provide a pull request if this is something you'd be interested in adding to conan.
The text was updated successfully, but these errors were encountered: